Show More
@@ -1,210 +1,214 | |||||
1 | # monotone support for the convert extension |
|
1 | # monotone support for the convert extension | |
2 |
|
2 | |||
3 | import os, re, time |
|
3 | import os, re, time | |
4 | from mercurial import util |
|
4 | from mercurial import util | |
5 | from common import NoRepo, MissingTool, commit, converter_source, checktool |
|
5 | from common import NoRepo, MissingTool, commit, converter_source, checktool | |
6 | from common import commandline |
|
6 | from common import commandline | |
7 | from mercurial.i18n import _ |
|
7 | from mercurial.i18n import _ | |
8 |
|
8 | |||
9 | class monotone_source(converter_source, commandline): |
|
9 | class monotone_source(converter_source, commandline): | |
10 | def __init__(self, ui, path=None, rev=None): |
|
10 | def __init__(self, ui, path=None, rev=None): | |
11 | converter_source.__init__(self, ui, path, rev) |
|
11 | converter_source.__init__(self, ui, path, rev) | |
12 | commandline.__init__(self, ui, 'mtn') |
|
12 | commandline.__init__(self, ui, 'mtn') | |
13 |
|
13 | |||
14 | self.ui = ui |
|
14 | self.ui = ui | |
15 | self.path = path |
|
15 | self.path = path | |
16 |
|
16 | |||
17 | # regular expressions for parsing monotone output |
|
17 | # regular expressions for parsing monotone output | |
18 | space = r'\s*' |
|
18 | space = r'\s*' | |
19 | name = r'\s+"((?:\\"|[^"])*)"\s*' |
|
19 | name = r'\s+"((?:\\"|[^"])*)"\s*' | |
20 | value = name |
|
20 | value = name | |
21 | revision = r'\s+\[(\w+)\]\s*' |
|
21 | revision = r'\s+\[(\w+)\]\s*' | |
22 | lines = r'(?:.|\n)+' |
|
22 | lines = r'(?:.|\n)+' | |
23 |
|
23 | |||
24 | self.dir_re = re.compile(space + "dir" + name) |
|
24 | self.dir_re = re.compile(space + "dir" + name) | |
25 | self.file_re = re.compile(space + "file" + name + "content" + revision) |
|
25 | self.file_re = re.compile(space + "file" + name + "content" + revision) | |
26 | self.add_file_re = re.compile(space + "add_file" + name + "content" + revision) |
|
26 | self.add_file_re = re.compile(space + "add_file" + name + "content" + revision) | |
27 | self.patch_re = re.compile(space + "patch" + name + "from" + revision + "to" + revision) |
|
27 | self.patch_re = re.compile(space + "patch" + name + "from" + revision + "to" + revision) | |
28 | self.rename_re = re.compile(space + "rename" + name + "to" + name) |
|
28 | self.rename_re = re.compile(space + "rename" + name + "to" + name) | |
29 | self.delete_re = re.compile(space + "delete" + name) |
|
29 | self.delete_re = re.compile(space + "delete" + name) | |
30 | self.tag_re = re.compile(space + "tag" + name + "revision" + revision) |
|
30 | self.tag_re = re.compile(space + "tag" + name + "revision" + revision) | |
31 | self.cert_re = re.compile(lines + space + "name" + name + "value" + value) |
|
31 | self.cert_re = re.compile(lines + space + "name" + name + "value" + value) | |
32 |
|
32 | |||
33 | attr = space + "file" + lines + space + "attr" + space |
|
33 | attr = space + "file" + lines + space + "attr" + space | |
34 | self.attr_execute_re = re.compile(attr + '"mtn:execute"' + space + '"true"') |
|
34 | self.attr_execute_re = re.compile(attr + '"mtn:execute"' + space + '"true"') | |
35 |
|
35 | |||
36 | # cached data |
|
36 | # cached data | |
37 | self.manifest_rev = None |
|
37 | self.manifest_rev = None | |
38 | self.manifest = None |
|
38 | self.manifest = None | |
39 | self.files = None |
|
39 | self.files = None | |
40 | self.dirs = None |
|
40 | self.dirs = None | |
41 |
|
41 | |||
42 | norepo = NoRepo (_("%s does not look like a monotone repo") % path) |
|
42 | norepo = NoRepo (_("%s does not look like a monotone repo") % path) | |
43 | if not os.path.exists(path): |
|
43 | if not os.path.exists(path): | |
44 | raise norepo |
|
44 | raise norepo | |
45 |
|
45 | |||
46 | checktool('mtn', abort=False) |
|
46 | checktool('mtn', abort=False) | |
47 |
|
47 | |||
48 | # test if there are any revisions |
|
48 | # test if there are any revisions | |
49 | self.rev = None |
|
49 | self.rev = None | |
50 | try: |
|
50 | try: | |
51 | self.getheads() |
|
51 | self.getheads() | |
52 | except: |
|
52 | except: | |
53 | raise norepo |
|
53 | raise norepo | |
54 | self.rev = rev |
|
54 | self.rev = rev | |
55 |
|
55 | |||
56 | def mtnrun(self, *args, **kwargs): |
|
56 | def mtnrun(self, *args, **kwargs): | |
57 | kwargs['d'] = self.path |
|
57 | kwargs['d'] = self.path | |
58 | return self.run0('automate', *args, **kwargs) |
|
58 | return self.run0('automate', *args, **kwargs) | |
59 |
|
59 | |||
60 | def mtnloadmanifest(self, rev): |
|
60 | def mtnloadmanifest(self, rev): | |
61 | if self.manifest_rev == rev: |
|
61 | if self.manifest_rev == rev: | |
62 | return |
|
62 | return | |
63 | self.manifest = self.mtnrun("get_manifest_of", rev).split("\n\n") |
|
63 | self.manifest = self.mtnrun("get_manifest_of", rev).split("\n\n") | |
64 | self.manifest_rev = rev |
|
64 | self.manifest_rev = rev | |
65 | self.files = {} |
|
65 | self.files = {} | |
66 | self.dirs = {} |
|
66 | self.dirs = {} | |
67 |
|
67 | |||
68 | for e in self.manifest: |
|
68 | for e in self.manifest: | |
69 | m = self.file_re.match(e) |
|
69 | m = self.file_re.match(e) | |
70 | if m: |
|
70 | if m: | |
71 | attr = "" |
|
71 | attr = "" | |
72 | name = m.group(1) |
|
72 | name = m.group(1) | |
73 | node = m.group(2) |
|
73 | node = m.group(2) | |
74 | if self.attr_execute_re.match(e): |
|
74 | if self.attr_execute_re.match(e): | |
75 | attr += "x" |
|
75 | attr += "x" | |
76 | self.files[name] = (node, attr) |
|
76 | self.files[name] = (node, attr) | |
77 | m = self.dir_re.match(e) |
|
77 | m = self.dir_re.match(e) | |
78 | if m: |
|
78 | if m: | |
79 | self.dirs[m.group(1)] = True |
|
79 | self.dirs[m.group(1)] = True | |
80 |
|
80 | |||
81 | def mtnisfile(self, name, rev): |
|
81 | def mtnisfile(self, name, rev): | |
82 | # a non-file could be a directory or a deleted or renamed file |
|
82 | # a non-file could be a directory or a deleted or renamed file | |
83 | self.mtnloadmanifest(rev) |
|
83 | self.mtnloadmanifest(rev) | |
84 | try: |
|
84 | try: | |
85 | self.files[name] |
|
85 | self.files[name] | |
86 | return True |
|
86 | return True | |
87 | except KeyError: |
|
87 | except KeyError: | |
88 | return False |
|
88 | return False | |
89 |
|
89 | |||
90 | def mtnisdir(self, name, rev): |
|
90 | def mtnisdir(self, name, rev): | |
91 | self.mtnloadmanifest(rev) |
|
91 | self.mtnloadmanifest(rev) | |
92 | try: |
|
92 | try: | |
93 | self.dirs[name] |
|
93 | self.dirs[name] | |
94 | return True |
|
94 | return True | |
95 | except KeyError: |
|
95 | except KeyError: | |
96 | return False |
|
96 | return False | |
97 |
|
97 | |||
98 | def mtngetcerts(self, rev): |
|
98 | def mtngetcerts(self, rev): | |
99 | certs = {"author":"<missing>", "date":"<missing>", |
|
99 | certs = {"author":"<missing>", "date":"<missing>", | |
100 | "changelog":"<missing>", "branch":"<missing>"} |
|
100 | "changelog":"<missing>", "branch":"<missing>"} | |
101 | cert_list = self.mtnrun("certs", rev).split('\n\n key "') |
|
101 | cert_list = self.mtnrun("certs", rev).split('\n\n key "') | |
102 | for e in cert_list: |
|
102 | for e in cert_list: | |
103 | m = self.cert_re.match(e) |
|
103 | m = self.cert_re.match(e) | |
104 | if m: |
|
104 | if m: | |
105 | name, value = m.groups() |
|
105 | name, value = m.groups() | |
106 | value = value.replace(r'\"', '"') |
|
106 | value = value.replace(r'\"', '"') | |
107 | value = value.replace(r'\\', '\\') |
|
107 | value = value.replace(r'\\', '\\') | |
108 | certs[name] = value |
|
108 | certs[name] = value | |
109 | # Monotone may have subsecond dates: 2005-02-05T09:39:12.364306 |
|
109 | # Monotone may have subsecond dates: 2005-02-05T09:39:12.364306 | |
110 | certs["date"] = certs["date"].split('.')[0] |
|
110 | certs["date"] = certs["date"].split('.')[0] | |
111 | return certs |
|
111 | return certs | |
112 |
|
112 | |||
113 | # implement the converter_source interface: |
|
113 | # implement the converter_source interface: | |
114 |
|
114 | |||
115 | def getheads(self): |
|
115 | def getheads(self): | |
116 | if not self.rev: |
|
116 | if not self.rev: | |
117 | return self.mtnrun("leaves").splitlines() |
|
117 | return self.mtnrun("leaves").splitlines() | |
118 | else: |
|
118 | else: | |
119 | return [self.rev] |
|
119 | return [self.rev] | |
120 |
|
120 | |||
121 | def getchanges(self, rev): |
|
121 | def getchanges(self, rev): | |
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 | ignoremove = {} |
|
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 | ignoremove[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 | |
136 | # Delete/rename is handled later when the convert engine |
|
136 | # Delete/rename is handled later when the convert engine | |
137 | # discovers an IOError exception from getfile, |
|
137 | # discovers an IOError exception from getfile, | |
138 | # but only if we add the "from" file to the list of changes. |
|
138 | # but only if we add the "from" file to the list of changes. | |
139 | m = self.delete_re.match(e) |
|
139 | m = self.delete_re.match(e) | |
140 | if m: |
|
140 | if m: | |
141 | files[m.group(1)] = rev |
|
141 | files[m.group(1)] = rev | |
142 | m = self.rename_re.match(e) |
|
142 | m = self.rename_re.match(e) | |
143 | if m: |
|
143 | if m: | |
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 | ignoremove[toname] = 1 | |
148 | copies[toname] = fromname |
|
148 | copies[toname] = fromname | |
149 | files[toname] = rev |
|
149 | files[toname] = rev | |
150 | files[fromname] = rev |
|
150 | files[fromname] = rev | |
151 | elif self.mtnisdir(toname, rev): |
|
151 | elif self.mtnisdir(toname, rev): | |
152 | renameddirs.append((fromname, toname)) |
|
152 | renameddirs.append((fromname, toname)) | |
153 |
|
153 | |||
154 | # Directory renames can be handled only once we have recorded |
|
154 | # Directory renames can be handled only once we have recorded | |
155 | # all new files |
|
155 | # all new files | |
156 | for fromdir, todir in renameddirs: |
|
156 | for fromdir, todir in renameddirs: | |
157 | renamed = {} |
|
157 | renamed = {} | |
158 | for tofile in self.files: |
|
158 | for tofile in self.files: | |
159 | if tofile in ignoremove: |
|
159 | if tofile in ignoremove: | |
160 | continue |
|
160 | continue | |
161 | if tofile.startswith(todir + '/'): |
|
161 | if tofile.startswith(todir + '/'): | |
162 | renamed[tofile] = fromdir + tofile[len(todir):] |
|
162 | renamed[tofile] = fromdir + tofile[len(todir):] | |
|
163 | # Avoid chained moves like: | |||
|
164 | # d1(/a) => d3/d1(/a) | |||
|
165 | # d2 => d3 | |||
|
166 | ignoremove[tofile] = 1 | |||
163 | for tofile, fromfile in renamed.items(): |
|
167 | for tofile, fromfile in renamed.items(): | |
164 | self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") |
|
168 | self.ui.debug (_("copying file in renamed dir from '%s' to '%s'") | |
165 | % (fromfile, tofile), '\n') |
|
169 | % (fromfile, tofile), '\n') | |
166 | files[tofile] = rev |
|
170 | files[tofile] = rev | |
167 | copies[tofile] = fromfile |
|
171 | copies[tofile] = fromfile | |
168 | for fromfile in renamed.values(): |
|
172 | for fromfile in renamed.values(): | |
169 | files[fromfile] = rev |
|
173 | files[fromfile] = rev | |
170 |
|
174 | |||
171 | return (files.items(), copies) |
|
175 | return (files.items(), copies) | |
172 |
|
176 | |||
173 | def getmode(self, name, rev): |
|
177 | def getmode(self, name, rev): | |
174 | self.mtnloadmanifest(rev) |
|
178 | self.mtnloadmanifest(rev) | |
175 | try: |
|
179 | try: | |
176 | node, attr = self.files[name] |
|
180 | node, attr = self.files[name] | |
177 | return attr |
|
181 | return attr | |
178 | except KeyError: |
|
182 | except KeyError: | |
179 | return "" |
|
183 | return "" | |
180 |
|
184 | |||
181 | def getfile(self, name, rev): |
|
185 | def getfile(self, name, rev): | |
182 | if not self.mtnisfile(name, rev): |
|
186 | if not self.mtnisfile(name, rev): | |
183 | raise IOError() # file was deleted or renamed |
|
187 | raise IOError() # file was deleted or renamed | |
184 | try: |
|
188 | try: | |
185 | return self.mtnrun("get_file_of", name, r=rev) |
|
189 | return self.mtnrun("get_file_of", name, r=rev) | |
186 | except: |
|
190 | except: | |
187 | raise IOError() # file was deleted or renamed |
|
191 | raise IOError() # file was deleted or renamed | |
188 |
|
192 | |||
189 | def getcommit(self, rev): |
|
193 | def getcommit(self, rev): | |
190 | certs = self.mtngetcerts(rev) |
|
194 | certs = self.mtngetcerts(rev) | |
191 | return commit( |
|
195 | return commit( | |
192 | author=certs["author"], |
|
196 | author=certs["author"], | |
193 | date=util.datestr(util.strdate(certs["date"], "%Y-%m-%dT%H:%M:%S")), |
|
197 | date=util.datestr(util.strdate(certs["date"], "%Y-%m-%dT%H:%M:%S")), | |
194 | desc=certs["changelog"], |
|
198 | desc=certs["changelog"], | |
195 | rev=rev, |
|
199 | rev=rev, | |
196 | parents=self.mtnrun("parents", rev).splitlines(), |
|
200 | parents=self.mtnrun("parents", rev).splitlines(), | |
197 | branch=certs["branch"]) |
|
201 | branch=certs["branch"]) | |
198 |
|
202 | |||
199 | def gettags(self): |
|
203 | def gettags(self): | |
200 | tags = {} |
|
204 | tags = {} | |
201 | for e in self.mtnrun("tags").split("\n\n"): |
|
205 | for e in self.mtnrun("tags").split("\n\n"): | |
202 | m = self.tag_re.match(e) |
|
206 | m = self.tag_re.match(e) | |
203 | if m: |
|
207 | if m: | |
204 | tags[m.group(1)] = m.group(2) |
|
208 | tags[m.group(1)] = m.group(2) | |
205 | return tags |
|
209 | return tags | |
206 |
|
210 | |||
207 | def getchangedfiles(self, rev, i): |
|
211 | def getchangedfiles(self, rev, i): | |
208 | # This function is only needed to support --filemap |
|
212 | # This function is only needed to support --filemap | |
209 | # ... and we don't support that |
|
213 | # ... and we don't support that | |
210 | raise NotImplementedError() |
|
214 | raise NotImplementedError() |
@@ -1,122 +1,146 | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" mtn || exit 80 |
|
3 | "$TESTDIR/hghave" mtn || exit 80 | |
4 |
|
4 | |||
5 | # Monotone directory is called .monotone on *nix and monotone |
|
5 | # Monotone directory is called .monotone on *nix and monotone | |
6 | # on Windows. Having a variable here ease test patching. |
|
6 | # on Windows. Having a variable here ease test patching. | |
7 | mtndir=.monotone |
|
7 | mtndir=.monotone | |
8 | echo "[extensions]" >> $HGRCPATH |
|
8 | echo "[extensions]" >> $HGRCPATH | |
9 | echo "convert=" >> $HGRCPATH |
|
9 | echo "convert=" >> $HGRCPATH | |
10 | echo 'hgext.graphlog =' >> $HGRCPATH |
|
10 | echo 'hgext.graphlog =' >> $HGRCPATH | |
11 |
|
11 | |||
12 | HOME=`pwd`/do_not_use_HOME_mtn; export HOME |
|
12 | HOME=`pwd`/do_not_use_HOME_mtn; export HOME | |
13 | # Windows version of monotone home |
|
13 | # Windows version of monotone home | |
14 | APPDATA=$HOME; export APPDATA |
|
14 | APPDATA=$HOME; export APPDATA | |
15 |
|
15 | |||
16 | echo % tedious monotone keys configuration |
|
16 | echo % tedious monotone keys configuration | |
17 | # The /dev/null redirection is necessary under Windows, or |
|
17 | # The /dev/null redirection is necessary under Windows, or | |
18 | # it complains about home directory permissions |
|
18 | # it complains about home directory permissions | |
19 | mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF |
|
19 | mtn --quiet genkey test@selenic.com 1>/dev/null 2>&1 <<EOF | |
20 | passphrase |
|
20 | passphrase | |
21 | passphrase |
|
21 | passphrase | |
22 | EOF |
|
22 | EOF | |
23 | cat >> $HOME/$mtndir/monotonerc <<EOF |
|
23 | cat >> $HOME/$mtndir/monotonerc <<EOF | |
24 | function get_passphrase(keypair_id) |
|
24 | function get_passphrase(keypair_id) | |
25 | return "passphrase" |
|
25 | return "passphrase" | |
26 | end |
|
26 | end | |
27 | EOF |
|
27 | EOF | |
28 |
|
28 | |||
29 | echo % create monotone repository |
|
29 | echo % create monotone repository | |
30 | mtn db init --db=repo.mtn |
|
30 | mtn db init --db=repo.mtn | |
31 | mtn --db=repo.mtn --branch=com.selenic.test setup workingdir |
|
31 | mtn --db=repo.mtn --branch=com.selenic.test setup workingdir | |
32 | cd workingdir |
|
32 | cd workingdir | |
33 | echo a > a |
|
33 | echo a > a | |
34 | mkdir dir |
|
34 | mkdir dir | |
35 | echo b > dir/b |
|
35 | echo b > dir/b | |
36 | echo d > dir/d |
|
36 | echo d > dir/d | |
37 | python -c 'file("bin", "wb").write("a\\x00b")' |
|
37 | python -c 'file("bin", "wb").write("a\\x00b")' | |
38 | echo c > c |
|
38 | echo c > c | |
39 | mtn add a dir/b dir/d c bin |
|
39 | mtn add a dir/b dir/d c bin | |
40 | mtn ci -m initialize |
|
40 | mtn ci -m initialize | |
41 | echo % update monotone working directory |
|
41 | echo % update monotone working directory | |
42 | mtn mv a dir/a |
|
42 | mtn mv a dir/a | |
43 | echo a >> dir/a |
|
43 | echo a >> dir/a | |
44 | echo b >> dir/b |
|
44 | echo b >> dir/b | |
45 | mtn drop c |
|
45 | mtn drop c | |
46 | python -c 'file("bin", "wb").write("b\\x00c")' |
|
46 | python -c 'file("bin", "wb").write("b\\x00c")' | |
47 | mtn ci -m update1 |
|
47 | mtn ci -m update1 | |
48 | cd .. |
|
48 | cd .. | |
49 |
|
49 | |||
50 | echo % convert once |
|
50 | echo % convert once | |
51 | hg convert -s mtn repo.mtn |
|
51 | hg convert -s mtn repo.mtn | |
52 |
|
52 | |||
53 | cd workingdir |
|
53 | cd workingdir | |
54 | echo e > e |
|
54 | echo e > e | |
55 | mtn add e |
|
55 | mtn add e | |
56 | mtn drop dir/b |
|
56 | mtn drop dir/b | |
57 | mtn mv bin bin2 |
|
57 | mtn mv bin bin2 | |
58 | mtn ci -m 'update2 "with" quotes' |
|
58 | mtn ci -m 'update2 "with" quotes' | |
59 | echo '% test directory move' |
|
59 | echo '% test directory move' | |
60 | mkdir -p dir1/subdir1 |
|
60 | mkdir -p dir1/subdir1 | |
61 | mkdir -p dir1/subdir2_other |
|
61 | mkdir -p dir1/subdir2_other | |
62 | echo file1 > dir1/subdir1/file1 |
|
62 | echo file1 > dir1/subdir1/file1 | |
63 | echo file2 > dir1/subdir2_other/file1 |
|
63 | echo file2 > dir1/subdir2_other/file1 | |
64 | mtn add dir1/subdir1/file1 dir1/subdir2_other/file1 |
|
64 | mtn add dir1/subdir1/file1 dir1/subdir2_other/file1 | |
65 | mtn ci -m createdir1 |
|
65 | mtn ci -m createdir1 | |
66 | mtn rename dir1/subdir1 dir1/subdir2 |
|
66 | mtn rename dir1/subdir1 dir1/subdir2 | |
67 | mtn ci -m movedir1 |
|
67 | mtn ci -m movedir1 | |
68 | echo '% test subdirectory move' |
|
68 | echo '% test subdirectory move' | |
69 | mtn mv dir dir2 |
|
69 | mtn mv dir dir2 | |
70 | echo newfile > dir2/newfile |
|
70 | echo newfile > dir2/newfile | |
71 | mtn drop dir2/d |
|
71 | mtn drop dir2/d | |
72 | mtn add dir2/newfile |
|
72 | mtn add dir2/newfile | |
73 | mtn ci -m movedir |
|
73 | mtn ci -m movedir | |
74 | # Test directory removal with empty directory |
|
74 | # Test directory removal with empty directory | |
75 | mkdir dir2/dir |
|
75 | mkdir dir2/dir | |
76 | mkdir dir2/dir/subdir |
|
76 | mkdir dir2/dir/subdir | |
77 | echo f > dir2/dir/subdir/f |
|
77 | echo f > dir2/dir/subdir/f | |
78 | mkdir dir2/dir/emptydir |
|
78 | mkdir dir2/dir/emptydir | |
79 | mtn add --quiet -R dir2/dir |
|
79 | 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' |
|
83 | echo '% test directory and file move' | |
84 | mkdir -p dir3/d1 |
|
84 | mkdir -p dir3/d1 | |
85 | echo a > dir3/a |
|
85 | echo a > dir3/a | |
86 | mtn add dir3/a dir3/d1 |
|
86 | mtn add dir3/a dir3/d1 | |
87 | mtn ci -m dirfilemove |
|
87 | mtn ci -m dirfilemove | |
88 | mtn mv dir3/a dir3/d1/a |
|
88 | mtn mv dir3/a dir3/d1/a | |
89 | mtn mv dir3/d1 dir3/d2 |
|
89 | mtn mv dir3/d1 dir3/d2 | |
90 | mtn ci -m dirfilemove2 |
|
90 | mtn ci -m dirfilemove2 | |
|
91 | echo '% test directory move into another directory move' | |||
|
92 | mkdir dir4 | |||
|
93 | mkdir dir5 | |||
|
94 | echo a > dir4/a | |||
|
95 | mtn add dir4/a dir5 | |||
|
96 | mtn ci -m dirdirmove | |||
|
97 | mtn mv dir5 dir6 | |||
|
98 | mtn mv dir4 dir6/dir4 | |||
|
99 | mtn ci -m dirdirmove2 | |||
|
100 | echo '% test diverging directory moves' | |||
|
101 | mkdir -p dir7/dir9/dir8 | |||
|
102 | echo a > dir7/dir9/dir8/a | |||
|
103 | echo b > dir7/dir9/b | |||
|
104 | echo c > dir7/c | |||
|
105 | mtn add -R dir7 | |||
|
106 | mtn ci -m divergentdirmove | |||
|
107 | mtn mv dir7 dir7-2 | |||
|
108 | mtn mv dir7-2/dir9 dir9-2 | |||
|
109 | mtn mv dir9-2/dir8 dir8-2 | |||
|
110 | mtn ci -m divergentdirmove2 | |||
91 | cd .. |
|
111 | cd .. | |
92 |
|
112 | |||
93 | echo % convert incrementally |
|
113 | echo % convert incrementally | |
94 | hg convert -s mtn repo.mtn |
|
114 | hg convert -s mtn repo.mtn | |
95 |
|
115 | |||
96 | glog() |
|
116 | glog() | |
97 | { |
|
117 | { | |
98 | hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@" |
|
118 | hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@" | |
99 | } |
|
119 | } | |
100 |
|
120 | |||
101 | cd repo.mtn-hg |
|
121 | cd repo.mtn-hg | |
102 | hg up -C |
|
122 | hg up -C | |
103 | glog |
|
123 | glog | |
104 | echo % manifest |
|
124 | echo % manifest | |
105 | hg manifest |
|
125 | hg manifest | |
106 | echo % contents |
|
126 | echo % contents | |
107 | cat dir2/a |
|
127 | cat dir2/a | |
108 | test -d dir2/dir && echo 'removed dir2/dir is still there!' |
|
128 | test -d dir2/dir && echo 'removed dir2/dir is still there!' | |
109 |
|
129 | |||
110 | echo % file move |
|
130 | echo % file move | |
111 | hg log -v -C -r 1 | grep copies |
|
131 | hg log -v -C -r 1 | grep copies | |
112 | echo % check directory move |
|
132 | echo % check directory move | |
113 | hg manifest -r 4 |
|
133 | hg manifest -r 4 | |
114 | test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' |
|
134 | test -d dir1/subdir2 || echo 'new dir1/subdir2 does not exist!' | |
115 | test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' |
|
135 | test -d dir1/subdir1 && echo 'renamed dir1/subdir1 is still there!' | |
116 | hg log -v -C -r 4 | grep copies |
|
136 | hg log -v -C -r 4 | grep copies | |
117 | echo % check file remove with directory move |
|
137 | echo % check file remove with directory move | |
118 | hg manifest -r 5 |
|
138 | hg manifest -r 5 | |
119 | echo % check file move with directory move |
|
139 | echo % check file move with directory move | |
120 | hg manifest -r 9 |
|
140 | hg manifest -r 9 | |
|
141 | echo % check file directory directory move | |||
|
142 | hg manifest -r 11 | |||
|
143 | echo % check divergent directory moves | |||
|
144 | hg manifest -r 13 | |||
121 | exit 0 |
|
145 | exit 0 | |
122 |
|
146 |
@@ -1,137 +1,199 | |||||
1 | % tedious monotone keys configuration |
|
1 | % tedious monotone keys configuration | |
2 | % create monotone repository |
|
2 | % create monotone repository | |
3 | mtn: adding a to workspace manifest |
|
3 | mtn: adding a to workspace manifest | |
4 | mtn: adding bin to workspace manifest |
|
4 | mtn: adding bin to workspace manifest | |
5 | mtn: adding c to workspace manifest |
|
5 | mtn: adding c to workspace manifest | |
6 | mtn: adding dir to workspace manifest |
|
6 | mtn: adding dir to workspace manifest | |
7 | mtn: adding dir/b to workspace manifest |
|
7 | mtn: adding dir/b to workspace manifest | |
8 | mtn: adding dir/d to workspace manifest |
|
8 | mtn: adding dir/d to workspace manifest | |
9 | mtn: beginning commit on branch 'com.selenic.test' |
|
9 | mtn: beginning commit on branch 'com.selenic.test' | |
10 | mtn: committed revision 0f6e5e4f2e7d2a8ef312408f57618abf026afd90 |
|
10 | mtn: committed revision 0f6e5e4f2e7d2a8ef312408f57618abf026afd90 | |
11 | % update monotone working directory |
|
11 | % update monotone working directory | |
12 | mtn: skipping dir, already accounted for in workspace |
|
12 | mtn: skipping dir, already accounted for in workspace | |
13 | mtn: renaming a to dir/a in workspace manifest |
|
13 | mtn: renaming a to dir/a in workspace manifest | |
14 | mtn: dropping c from workspace manifest |
|
14 | mtn: dropping c from workspace manifest | |
15 | mtn: beginning commit on branch 'com.selenic.test' |
|
15 | mtn: beginning commit on branch 'com.selenic.test' | |
16 | mtn: committed revision 51d0a982464573a2a2cf5ee2c9219c652aaebeff |
|
16 | mtn: committed revision 51d0a982464573a2a2cf5ee2c9219c652aaebeff | |
17 | % convert once |
|
17 | % convert once | |
18 | assuming destination repo.mtn-hg |
|
18 | assuming destination repo.mtn-hg | |
19 | initializing destination repo.mtn-hg repository |
|
19 | initializing destination repo.mtn-hg repository | |
20 | scanning source... |
|
20 | scanning source... | |
21 | sorting... |
|
21 | sorting... | |
22 | converting... |
|
22 | converting... | |
23 | 1 initialize |
|
23 | 1 initialize | |
24 | 0 update1 |
|
24 | 0 update1 | |
25 | mtn: adding e to workspace manifest |
|
25 | mtn: adding e to workspace manifest | |
26 | mtn: dropping dir/b from workspace manifest |
|
26 | mtn: dropping dir/b from workspace manifest | |
27 | mtn: renaming bin to bin2 in workspace manifest |
|
27 | mtn: renaming bin to bin2 in workspace manifest | |
28 | mtn: beginning commit on branch 'com.selenic.test' |
|
28 | mtn: beginning commit on branch 'com.selenic.test' | |
29 | mtn: committed revision ebe58335d85d8cb176b6d0a12be04f5314b998da |
|
29 | mtn: committed revision ebe58335d85d8cb176b6d0a12be04f5314b998da | |
30 | % test directory move |
|
30 | % test directory move | |
31 | mtn: adding dir1 to workspace manifest |
|
31 | mtn: adding dir1 to workspace manifest | |
32 | mtn: adding dir1/subdir1 to workspace manifest |
|
32 | mtn: adding dir1/subdir1 to workspace manifest | |
33 | mtn: adding dir1/subdir1/file1 to workspace manifest |
|
33 | mtn: adding dir1/subdir1/file1 to workspace manifest | |
34 | mtn: adding dir1/subdir2_other to workspace manifest |
|
34 | mtn: adding dir1/subdir2_other to workspace manifest | |
35 | mtn: adding dir1/subdir2_other/file1 to workspace manifest |
|
35 | mtn: adding dir1/subdir2_other/file1 to workspace manifest | |
36 | mtn: beginning commit on branch 'com.selenic.test' |
|
36 | mtn: beginning commit on branch 'com.selenic.test' | |
37 | mtn: committed revision a8d62bc04fee4d2936d28e98bbcc81686dd74306 |
|
37 | mtn: committed revision a8d62bc04fee4d2936d28e98bbcc81686dd74306 | |
38 | mtn: skipping dir1, already accounted for in workspace |
|
38 | mtn: skipping dir1, already accounted for in workspace | |
39 | mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest |
|
39 | mtn: renaming dir1/subdir1 to dir1/subdir2 in workspace manifest | |
40 | mtn: beginning commit on branch 'com.selenic.test' |
|
40 | mtn: beginning commit on branch 'com.selenic.test' | |
41 | mtn: committed revision 2c3d241bbbfe538b1b51d910f5676407e3f4d3a6 |
|
41 | mtn: committed revision 2c3d241bbbfe538b1b51d910f5676407e3f4d3a6 | |
42 | % test subdirectory move |
|
42 | % test subdirectory move | |
43 | mtn: renaming dir to dir2 in workspace manifest |
|
43 | mtn: renaming dir to dir2 in workspace manifest | |
44 | mtn: dropping dir2/d from workspace manifest |
|
44 | mtn: dropping dir2/d from workspace manifest | |
45 | mtn: adding dir2/newfile to workspace manifest |
|
45 | mtn: adding dir2/newfile to workspace manifest | |
46 | mtn: beginning commit on branch 'com.selenic.test' |
|
46 | mtn: beginning commit on branch 'com.selenic.test' | |
47 | mtn: committed revision fdb5a02dae8bfce3a79b3393680af471016e1b4c |
|
47 | mtn: committed revision fdb5a02dae8bfce3a79b3393680af471016e1b4c | |
48 | mtn: beginning commit on branch 'com.selenic.test' |
|
48 | mtn: beginning commit on branch 'com.selenic.test' | |
49 | mtn: committed revision 8bbf76d717001d24964e4604739fdcd0f539fc88 |
|
49 | mtn: committed revision 8bbf76d717001d24964e4604739fdcd0f539fc88 | |
50 | mtn: dropping dir2/dir/subdir/f from workspace manifest |
|
50 | mtn: dropping dir2/dir/subdir/f from workspace manifest | |
51 | mtn: dropping dir2/dir/subdir from workspace manifest |
|
51 | mtn: dropping dir2/dir/subdir from workspace manifest | |
52 | mtn: dropping dir2/dir/emptydir from workspace manifest |
|
52 | mtn: dropping dir2/dir/emptydir from workspace manifest | |
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 |
|
56 | % test directory and file move | |
57 | mtn: adding dir3 to workspace manifest |
|
57 | mtn: adding dir3 to workspace manifest | |
58 | mtn: adding dir3/a to workspace manifest |
|
58 | mtn: adding dir3/a to workspace manifest | |
59 | mtn: adding dir3/d1 to workspace manifest |
|
59 | mtn: adding dir3/d1 to workspace manifest | |
60 | mtn: beginning commit on branch 'com.selenic.test' |
|
60 | mtn: beginning commit on branch 'com.selenic.test' | |
61 | mtn: committed revision 47b192f720faa622f48c68d1eb075b26d405aa8b |
|
61 | mtn: committed revision 47b192f720faa622f48c68d1eb075b26d405aa8b | |
62 | mtn: skipping dir3/d1, already accounted for in workspace |
|
62 | mtn: skipping dir3/d1, already accounted for in workspace | |
63 | mtn: renaming dir3/a to dir3/d1/a in workspace manifest |
|
63 | mtn: renaming dir3/a to dir3/d1/a in workspace manifest | |
64 | mtn: skipping dir3, already accounted for in workspace |
|
64 | mtn: skipping dir3, already accounted for in workspace | |
65 | mtn: renaming dir3/d1 to dir3/d2 in workspace manifest |
|
65 | mtn: renaming dir3/d1 to dir3/d2 in workspace manifest | |
66 | mtn: beginning commit on branch 'com.selenic.test' |
|
66 | mtn: beginning commit on branch 'com.selenic.test' | |
67 | mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632 |
|
67 | mtn: committed revision 8b543a400d3ee7f6d4bb1835b9b9e3747c8cb632 | |
|
68 | % test directory move into another directory move | |||
|
69 | mtn: adding dir4 to workspace manifest | |||
|
70 | mtn: adding dir4/a to workspace manifest | |||
|
71 | mtn: adding dir5 to workspace manifest | |||
|
72 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
73 | mtn: committed revision 466e0b2afc7a55aa2b4ab2f57cb240bb6cd66fc7 | |||
|
74 | mtn: renaming dir5 to dir6 in workspace manifest | |||
|
75 | mtn: skipping dir6, already accounted for in workspace | |||
|
76 | mtn: renaming dir4 to dir6/dir4 in workspace manifest | |||
|
77 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
78 | mtn: committed revision 3d1f77ebad0c23a5d14911be3b670f990991b749 | |||
|
79 | % test diverging directory moves | |||
|
80 | mtn: adding dir7 to workspace manifest | |||
|
81 | mtn: adding dir7/c to workspace manifest | |||
|
82 | mtn: adding dir7/dir9 to workspace manifest | |||
|
83 | mtn: adding dir7/dir9/b to workspace manifest | |||
|
84 | mtn: adding dir7/dir9/dir8 to workspace manifest | |||
|
85 | mtn: adding dir7/dir9/dir8/a to workspace manifest | |||
|
86 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
87 | mtn: committed revision 08a08511f18b428d840199b062de90d0396bc2ed | |||
|
88 | mtn: renaming dir7 to dir7-2 in workspace manifest | |||
|
89 | mtn: renaming dir7-2/dir9 to dir9-2 in workspace manifest | |||
|
90 | mtn: renaming dir9-2/dir8 to dir8-2 in workspace manifest | |||
|
91 | mtn: beginning commit on branch 'com.selenic.test' | |||
|
92 | mtn: committed revision 4a736634505795f17786fffdf2c9cbf5b11df6f6 | |||
68 | % convert incrementally |
|
93 | % convert incrementally | |
69 | assuming destination repo.mtn-hg |
|
94 | assuming destination repo.mtn-hg | |
70 | scanning source... |
|
95 | scanning source... | |
71 | sorting... |
|
96 | sorting... | |
72 | converting... |
|
97 | converting... | |
73 |
|
|
98 | 11 update2 "with" quotes | |
74 |
|
|
99 | 10 createdir1 | |
75 |
|
|
100 | 9 movedir1 | |
76 |
|
|
101 | 8 movedir | |
77 |
|
|
102 | 7 emptydir | |
78 |
|
|
103 | 6 dropdirectory | |
79 |
|
|
104 | 5 dirfilemove | |
80 |
|
|
105 | 4 dirfilemove2 | |
81 | 7 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
106 | 3 dirdirmove | |
82 | @ 9 "dirfilemove2" files: dir3/a dir3/d2/a |
|
107 | 2 dirdirmove2 | |
|
108 | 1 divergentdirmove | |||
|
109 | 0 divergentdirmove2 | |||
|
110 | 11 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
111 | @ 13 "divergentdirmove2" files: dir7-2/c dir7/c dir7/dir9/b dir7/dir9/dir8/a dir8-2/a dir9-2/b | |||
|
112 | | | |||
|
113 | o 12 "divergentdirmove" files: dir7/c dir7/dir9/b dir7/dir9/dir8/a | |||
|
114 | | | |||
|
115 | o 11 "dirdirmove2" files: dir4/a dir6/dir4/a | |||
|
116 | | | |||
|
117 | o 10 "dirdirmove" files: dir4/a | |||
|
118 | | | |||
|
119 | o 9 "dirfilemove2" files: dir3/a dir3/d2/a | |||
83 | | |
|
120 | | | |
84 | o 8 "dirfilemove" files: dir3/a |
|
121 | o 8 "dirfilemove" files: dir3/a | |
85 | | |
|
122 | | | |
86 | o 7 "dropdirectory" files: dir2/dir/subdir/f |
|
123 | o 7 "dropdirectory" files: dir2/dir/subdir/f | |
87 | | |
|
124 | | | |
88 | o 6 "emptydir" files: dir2/dir/subdir/f |
|
125 | o 6 "emptydir" files: dir2/dir/subdir/f | |
89 | | |
|
126 | | | |
90 | o 5 "movedir" files: dir/a dir/d dir2/a dir2/newfile |
|
127 | o 5 "movedir" files: dir/a dir/d dir2/a dir2/newfile | |
91 | | |
|
128 | | | |
92 | o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 |
|
129 | o 4 "movedir1" files: dir1/subdir1/file1 dir1/subdir2/file1 | |
93 | | |
|
130 | | | |
94 | o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1 |
|
131 | o 3 "createdir1" files: dir1/subdir1/file1 dir1/subdir2_other/file1 | |
95 | | |
|
132 | | | |
96 | o 2 "update2 "with" quotes" files: bin bin2 dir/b e |
|
133 | o 2 "update2 "with" quotes" files: bin bin2 dir/b e | |
97 | | |
|
134 | | | |
98 | o 1 "update1" files: a bin c dir/a dir/b |
|
135 | o 1 "update1" files: a bin c dir/a dir/b | |
99 | | |
|
136 | | | |
100 | o 0 "initialize" files: a bin c dir/b dir/d |
|
137 | o 0 "initialize" files: a bin c dir/b dir/d | |
101 |
|
138 | |||
102 | % manifest |
|
139 | % manifest | |
103 | bin2 |
|
140 | bin2 | |
104 | dir1/subdir2/file1 |
|
141 | dir1/subdir2/file1 | |
105 | dir1/subdir2_other/file1 |
|
142 | dir1/subdir2_other/file1 | |
106 | dir2/a |
|
143 | dir2/a | |
107 | dir2/newfile |
|
144 | dir2/newfile | |
108 | dir3/d2/a |
|
145 | dir3/d2/a | |
|
146 | dir6/dir4/a | |||
|
147 | dir7-2/c | |||
|
148 | dir8-2/a | |||
|
149 | dir9-2/b | |||
109 | e |
|
150 | e | |
110 | % contents |
|
151 | % contents | |
111 | a |
|
152 | a | |
112 | a |
|
153 | a | |
113 | % file move |
|
154 | % file move | |
114 | copies: dir/a (a) |
|
155 | copies: dir/a (a) | |
115 | % check directory move |
|
156 | % check directory move | |
116 | bin2 |
|
157 | bin2 | |
117 | dir/a |
|
158 | dir/a | |
118 | dir/d |
|
159 | dir/d | |
119 | dir1/subdir2/file1 |
|
160 | dir1/subdir2/file1 | |
120 | dir1/subdir2_other/file1 |
|
161 | dir1/subdir2_other/file1 | |
121 | e |
|
162 | e | |
122 | copies: dir1/subdir2/file1 (dir1/subdir1/file1) |
|
163 | copies: dir1/subdir2/file1 (dir1/subdir1/file1) | |
123 | % check file remove with directory move |
|
164 | % check file remove with directory move | |
124 | bin2 |
|
165 | bin2 | |
125 | dir1/subdir2/file1 |
|
166 | dir1/subdir2/file1 | |
126 | dir1/subdir2_other/file1 |
|
167 | dir1/subdir2_other/file1 | |
127 | dir2/a |
|
168 | dir2/a | |
128 | dir2/newfile |
|
169 | dir2/newfile | |
129 | e |
|
170 | e | |
130 | % check file move with directory move |
|
171 | % check file move with directory move | |
131 | bin2 |
|
172 | bin2 | |
132 | dir1/subdir2/file1 |
|
173 | dir1/subdir2/file1 | |
133 | dir1/subdir2_other/file1 |
|
174 | dir1/subdir2_other/file1 | |
134 | dir2/a |
|
175 | dir2/a | |
135 | dir2/newfile |
|
176 | dir2/newfile | |
136 | dir3/d2/a |
|
177 | dir3/d2/a | |
137 | e |
|
178 | e | |
|
179 | % check file directory directory move | |||
|
180 | bin2 | |||
|
181 | dir1/subdir2/file1 | |||
|
182 | dir1/subdir2_other/file1 | |||
|
183 | dir2/a | |||
|
184 | dir2/newfile | |||
|
185 | dir3/d2/a | |||
|
186 | dir6/dir4/a | |||
|
187 | e | |||
|
188 | % check divergent directory moves | |||
|
189 | bin2 | |||
|
190 | dir1/subdir2/file1 | |||
|
191 | dir1/subdir2_other/file1 | |||
|
192 | dir2/a | |||
|
193 | dir2/newfile | |||
|
194 | dir3/d2/a | |||
|
195 | dir6/dir4/a | |||
|
196 | dir7-2/c | |||
|
197 | dir8-2/a | |||
|
198 | dir9-2/b | |||
|
199 | e |
General Comments 0
You need to be logged in to leave comments.
Login now