##// END OF EJS Templates
convert/mtn: handle files moved in a moved directory (issue1619/2)
Patrick Mezard -
r8123:933b874e default
parent child Browse files
Show More
@@ -122,14 +122,14 b' class monotone_source(converter_source, '
122 122 #revision = self.mtncmd("get_revision %s" % rev).split("\n\n")
123 123 revision = self.mtnrun("get_revision", rev).split("\n\n")
124 124 files = {}
125 addedfiles = {}
125 ignoremove = {}
126 126 renameddirs = []
127 127 copies = {}
128 128 for e in revision:
129 129 m = self.add_file_re.match(e)
130 130 if m:
131 131 files[m.group(1)] = rev
132 addedfiles[m.group(1)] = rev
132 ignoremove[m.group(1)] = rev
133 133 m = self.patch_re.match(e)
134 134 if m:
135 135 files[m.group(1)] = rev
@@ -144,6 +144,7 b' class monotone_source(converter_source, '
144 144 toname = m.group(2)
145 145 fromname = m.group(1)
146 146 if self.mtnisfile(toname, rev):
147 ignoremove[toname] = 1
147 148 copies[toname] = fromname
148 149 files[toname] = rev
149 150 files[fromname] = rev
@@ -155,7 +156,7 b' class monotone_source(converter_source, '
155 156 for fromdir, todir in renameddirs:
156 157 renamed = {}
157 158 for tofile in self.files:
158 if tofile in addedfiles:
159 if tofile in ignoremove:
159 160 continue
160 161 if tofile.startswith(todir + '/'):
161 162 renamed[tofile] = fromdir + tofile[len(todir):]
@@ -80,6 +80,14 b' mtn add --quiet -R dir2/dir'
80 80 mtn ci -m emptydir
81 81 mtn drop -R dir2/dir
82 82 mtn ci -m dropdirectory
83 echo '% test directory and file move'
84 mkdir -p dir3/d1
85 echo a > dir3/a
86 mtn add dir3/a dir3/d1
87 mtn ci -m dirfilemove
88 mtn mv dir3/a dir3/d1/a
89 mtn mv dir3/d1 dir3/d2
90 mtn ci -m dirfilemove2
83 91 cd ..
84 92
85 93 echo % convert incrementally
@@ -108,5 +116,7 b" test -d dir1/subdir1 && echo 'renamed di"
108 116 hg log -v -C -r 4 | grep copies
109 117 echo % check file remove with directory move
110 118 hg manifest -r 5
119 echo % check file move with directory move
120 hg manifest -r 9
111 121 exit 0
112 122
@@ -53,19 +53,37 b' mtn: dropping dir2/dir/emptydir from wor'
53 53 mtn: dropping dir2/dir from workspace manifest
54 54 mtn: beginning commit on branch 'com.selenic.test'
55 55 mtn: committed revision 2323d4bc324e6c82628dc04d47a9fd32ad24e322
56 % test directory and file move
57 mtn: adding dir3 to workspace manifest
58 mtn: adding dir3/a to workspace manifest
59 mtn: adding dir3/d1 to workspace manifest
60 mtn: beginning commit on branch 'com.selenic.test'
61 mtn: committed revision 47b192f720faa622f48c68d1eb075b26d405aa8b
62 mtn: skipping dir3/d1, already accounted for in workspace
63 mtn: renaming dir3/a to dir3/d1/a in workspace manifest
64 mtn: skipping dir3, already accounted for in workspace
65 mtn: renaming dir3/d1 to dir3/d2 in workspace manifest
66 mtn: beginning commit on branch 'com.selenic.test'
67 mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632
56 68 % convert incrementally
57 69 assuming destination repo.mtn-hg
58 70 scanning source...
59 71 sorting...
60 72 converting...
61 5 update2 "with" quotes
62 4 createdir1
63 3 movedir1
64 2 movedir
65 1 emptydir
66 0 dropdirectory
67 6 files updated, 0 files merged, 0 files removed, 0 files unresolved
68 @ 7 "dropdirectory" files: dir2/dir/subdir/f
73 7 update2 "with" quotes
74 6 createdir1
75 5 movedir1
76 4 movedir
77 3 emptydir
78 2 dropdirectory
79 1 dirfilemove
80 0 dirfilemove2
81 7 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 @ 9 "dirfilemove2" files: dir3/a dir3/d2/a
83 |
84 o 8 "dirfilemove" files: dir3/a
85 |
86 o 7 "dropdirectory" files: dir2/dir/subdir/f
69 87 |
70 88 o 6 "emptydir" files: dir2/dir/subdir/f
71 89 |
@@ -87,6 +105,7 b' dir1/subdir2/file1'
87 105 dir1/subdir2_other/file1
88 106 dir2/a
89 107 dir2/newfile
108 dir3/d2/a
90 109 e
91 110 % contents
92 111 a
@@ -108,3 +127,11 b' dir1/subdir2_other/file1'
108 127 dir2/a
109 128 dir2/newfile
110 129 e
130 % check file move with directory move
131 bin2
132 dir1/subdir2/file1
133 dir1/subdir2_other/file1
134 dir2/a
135 dir2/newfile
136 dir3/d2/a
137 e
General Comments 0
You need to be logged in to leave comments. Login now