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