Mercurial > hgsubversion
annotate 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 |
rev | line source |
---|---|
67
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 #!/bin/sh |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 # |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 # Generate renames.svndump |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 # |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
6 mkdir temp |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
7 cd temp |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
8 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 mkdir project-orig |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
10 cd project-orig |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 mkdir trunk |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
12 mkdir branches |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
13 cd .. |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
14 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
15 svnadmin create testrepo |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
16 svnurl=file://`pwd`/testrepo |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
17 svn import project-orig $svnurl -m "init project" |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
18 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
19 svn co $svnurl project |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
20 cd project/trunk |
69
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
21 # Entries for regular tests |
67
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
22 echo a > a |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
23 echo b > b |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
24 mkdir -p da/db |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
25 echo c > da/daf |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
26 echo d > da/db/dbf |
69
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
27 # Entries to test delete + copy |
68
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
28 echo deleted > deletedfile |
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
29 mkdir deleteddir |
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
30 echo deleteddir > deleteddir/f |
69
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
31 # Entries to test copy before change |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
32 echo changed > changed |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
33 mkdir changeddir |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
34 echo changed2 > changeddir/f |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
35 # Entries unchanged in the rest of history |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
36 echo unchanged > unchanged |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
37 mkdir unchangeddir |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
38 echo unchanged2 > unchangeddir/f |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
39 svn add a b da deletedfile deleteddir changed changeddir unchanged unchangeddir |
67
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 svn ci -m "add a and b" |
69
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
41 # Remove files to be copied later |
68
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
42 svn rm deletedfile |
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
43 svn rm deleteddir |
69
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
44 # Update files to be copied before this change |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
45 echo changed >> changed |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
46 echo changed2 >> changeddir/f |
68
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
47 svn ci -m "delete files and dirs" |
67
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 cd ../branches |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 svn cp ../trunk branch1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 svn ci -m "create branch1" |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 cd branch1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 echo c > c |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
53 svn add c |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
54 svn ci -m "add c" |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
55 cd ../../trunk |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
56 # Regular copy and rename |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
57 svn cp a a1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
58 svn mv a a2 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
59 # Copy and update of source and dest |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
60 svn cp b b1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
61 echo b >> b |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
62 echo c >> b1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
63 # Directory copy and renaming |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
64 svn cp da da1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
65 svn mv da da2 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
66 # Test one copy operation in branch |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
67 cd ../branches/branch1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
68 svn cp c c1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
69 echo c >> c1 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
70 cd ../.. |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
71 svn ci -m "rename and copy a, b and da" |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
72 cd trunk |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
73 # Copy across branch |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
74 svn cp ../branches/branch1/c c |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
75 svn ci -m "copy b from branch1" |
68
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
76 # Copy deleted stuff from the past |
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
77 svn cp $svnurl/trunk/deletedfile@2 deletedfile |
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
78 svn cp $svnurl/trunk/deleteddir@2 deleteddir |
e0c86ebe05e3
test_fetch_renames: test copy of deleted stuff from the past
Patrick Mezard <pmezard@gmail.com>
parents:
67
diff
changeset
|
79 svn ci -m "copy stuff from the past" |
69
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
80 # Copy data from the past before it was changed |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
81 svn cp $svnurl/trunk/changed@2 changed2 |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
82 svn cp $svnurl/trunk/changeddir@2 changeddir2 |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
83 svn ci -m "copy stuff from the past before change" |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
84 # Copy unchanged stuff from the past. Since no changed occured in these files |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
85 # between the source and parent revision, we record them as copy from parent |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
86 # instead of source rev. |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
87 svn cp $svnurl/trunk/unchanged@2 unchanged2 |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
88 svn cp $svnurl/trunk/unchangeddir@2 unchangeddir2 |
63ece4ea25c9
hg_delta_editor: register copies only if files are unchanged between source and dest
Patrick Mezard <pmezard@gmail.com>
parents:
68
diff
changeset
|
89 svn ci -m "copy unchanged stuff from the past" |
67
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
90 cd ../.. |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
91 |
e319c9168910
hg_delta_editor: register svn file copies
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
92 svnadmin dump testrepo > ../renames.svndump |