Mercurial > hgsubversion
comparison tests/fixtures/renames.sh @ 69:63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Handle copies of items from revision X into revision Y where X is not the
parent of Y. This cannot happen in Mercurial because copies always happen
between parents and children. A file copy is recorded if:
1- Source and destination revs are in the same branch.
2- The file is unchanged (content, type, removal) through all revisions between
destination and source, not including source and destination.
Directory copies are registered only if the previous rules apply on all copied
items.
[1] is there because file copies across branches are meaningless in Mercurial
world. We could have tried to remap the source rev to a similar one in the
correct branch, but anyway the intent is wrong.
[2] is more questionable but I think it's better this way for we live in a
non-perfect svn world. In theory, 99% of copies out there should come from the
direct parent. But the direct parent is a fuzzy notion when you can have a
working directory composed of different directory at different revisions. So we
assume that stuff copied from past revisions exactly matching the content of
the direct parent revision is really copied from the parent revision. The
alternative would be to discard the copy, which would always happen unless
people kept updating the working directory after every commit (see
tests).
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Wed, 05 Nov 2008 13:37:08 +0100 |
parents | e0c86ebe05e3 |
children | bf1e8b8ed452 |
comparison
equal
deleted
inserted
replaced
68:e0c86ebe05e3 | 69:63ece4ea25c9 |
---|---|
16 svnurl=file://`pwd`/testrepo | 16 svnurl=file://`pwd`/testrepo |
17 svn import project-orig $svnurl -m "init project" | 17 svn import project-orig $svnurl -m "init project" |
18 | 18 |
19 svn co $svnurl project | 19 svn co $svnurl project |
20 cd project/trunk | 20 cd project/trunk |
21 # Entries for regular tests | |
21 echo a > a | 22 echo a > a |
22 echo b > b | 23 echo b > b |
23 mkdir -p da/db | 24 mkdir -p da/db |
24 echo c > da/daf | 25 echo c > da/daf |
25 echo d > da/db/dbf | 26 echo d > da/db/dbf |
27 # Entries to test delete + copy | |
26 echo deleted > deletedfile | 28 echo deleted > deletedfile |
27 mkdir deleteddir | 29 mkdir deleteddir |
28 echo deleteddir > deleteddir/f | 30 echo deleteddir > deleteddir/f |
29 svn add a b da deletedfile deleteddir | 31 # Entries to test copy before change |
32 echo changed > changed | |
33 mkdir changeddir | |
34 echo changed2 > changeddir/f | |
35 # Entries unchanged in the rest of history | |
36 echo unchanged > unchanged | |
37 mkdir unchangeddir | |
38 echo unchanged2 > unchangeddir/f | |
39 svn add a b da deletedfile deleteddir changed changeddir unchanged unchangeddir | |
30 svn ci -m "add a and b" | 40 svn ci -m "add a and b" |
41 # Remove files to be copied later | |
31 svn rm deletedfile | 42 svn rm deletedfile |
32 svn rm deleteddir | 43 svn rm deleteddir |
44 # Update files to be copied before this change | |
45 echo changed >> changed | |
46 echo changed2 >> changeddir/f | |
33 svn ci -m "delete files and dirs" | 47 svn ci -m "delete files and dirs" |
34 cd ../branches | 48 cd ../branches |
35 svn cp ../trunk branch1 | 49 svn cp ../trunk branch1 |
36 svn ci -m "create branch1" | 50 svn ci -m "create branch1" |
37 cd branch1 | 51 cd branch1 |
61 svn ci -m "copy b from branch1" | 75 svn ci -m "copy b from branch1" |
62 # Copy deleted stuff from the past | 76 # Copy deleted stuff from the past |
63 svn cp $svnurl/trunk/deletedfile@2 deletedfile | 77 svn cp $svnurl/trunk/deletedfile@2 deletedfile |
64 svn cp $svnurl/trunk/deleteddir@2 deleteddir | 78 svn cp $svnurl/trunk/deleteddir@2 deleteddir |
65 svn ci -m "copy stuff from the past" | 79 svn ci -m "copy stuff from the past" |
80 # Copy data from the past before it was changed | |
81 svn cp $svnurl/trunk/changed@2 changed2 | |
82 svn cp $svnurl/trunk/changeddir@2 changeddir2 | |
83 svn ci -m "copy stuff from the past before change" | |
84 # Copy unchanged stuff from the past. Since no changed occured in these files | |
85 # between the source and parent revision, we record them as copy from parent | |
86 # instead of source rev. | |
87 svn cp $svnurl/trunk/unchanged@2 unchanged2 | |
88 svn cp $svnurl/trunk/unchangeddir@2 unchangeddir2 | |
89 svn ci -m "copy unchanged stuff from the past" | |
66 cd ../.. | 90 cd ../.. |
67 | 91 |
68 svnadmin dump testrepo > ../renames.svndump | 92 svnadmin dump testrepo > ../renames.svndump |