##// END OF EJS Templates
convert/gnuarch: fix switched copy source and destination...
Patrick Mezard -
r7567:0946294d default
parent child Browse files
Show More
@@ -1,299 +1,298 b''
1 # GNU Arch support for the convert extension
1 # GNU Arch support for the convert extension
2
2
3 from common import NoRepo, commandline, commit, converter_source
3 from common import NoRepo, commandline, commit, converter_source
4 from mercurial.i18n import _
4 from mercurial.i18n import _
5 from mercurial import util
5 from mercurial import util
6 import os, shutil, tempfile, stat
6 import os, shutil, tempfile, stat
7
7
8 class gnuarch_source(converter_source, commandline):
8 class gnuarch_source(converter_source, commandline):
9
9
10 class gnuarch_rev:
10 class gnuarch_rev:
11 def __init__(self, rev):
11 def __init__(self, rev):
12 self.rev = rev
12 self.rev = rev
13 self.summary = ''
13 self.summary = ''
14 self.date = None
14 self.date = None
15 self.author = ''
15 self.author = ''
16 self.add_files = []
16 self.add_files = []
17 self.mod_files = []
17 self.mod_files = []
18 self.del_files = []
18 self.del_files = []
19 self.ren_files = {}
19 self.ren_files = {}
20 self.ren_dirs = {}
20 self.ren_dirs = {}
21
21
22 def __init__(self, ui, path, rev=None):
22 def __init__(self, ui, path, rev=None):
23 super(gnuarch_source, self).__init__(ui, path, rev=rev)
23 super(gnuarch_source, self).__init__(ui, path, rev=rev)
24
24
25 if not os.path.exists(os.path.join(path, '{arch}')):
25 if not os.path.exists(os.path.join(path, '{arch}')):
26 raise NoRepo(_("%s does not look like a GNU Arch repo") % path)
26 raise NoRepo(_("%s does not look like a GNU Arch repo") % path)
27
27
28 # Could use checktool, but we want to check for baz or tla.
28 # Could use checktool, but we want to check for baz or tla.
29 self.execmd = None
29 self.execmd = None
30 if util.find_exe('baz'):
30 if util.find_exe('baz'):
31 self.execmd = 'baz'
31 self.execmd = 'baz'
32 else:
32 else:
33 if util.find_exe('tla'):
33 if util.find_exe('tla'):
34 self.execmd = 'tla'
34 self.execmd = 'tla'
35 else:
35 else:
36 raise util.Abort(_('cannot find a GNU Arch tool'))
36 raise util.Abort(_('cannot find a GNU Arch tool'))
37
37
38 commandline.__init__(self, ui, self.execmd)
38 commandline.__init__(self, ui, self.execmd)
39
39
40 self.path = os.path.realpath(path)
40 self.path = os.path.realpath(path)
41 self.tmppath = None
41 self.tmppath = None
42
42
43 self.treeversion = None
43 self.treeversion = None
44 self.lastrev = None
44 self.lastrev = None
45 self.changes = {}
45 self.changes = {}
46 self.parents = {}
46 self.parents = {}
47 self.tags = {}
47 self.tags = {}
48 self.modecache = {}
48 self.modecache = {}
49
49
50 def before(self):
50 def before(self):
51 if self.execmd == 'tla':
51 if self.execmd == 'tla':
52 output = self.run0('tree-version', self.path)
52 output = self.run0('tree-version', self.path)
53 else:
53 else:
54 output = self.run0('tree-version', '-d', self.path)
54 output = self.run0('tree-version', '-d', self.path)
55 self.treeversion = output.strip()
55 self.treeversion = output.strip()
56
56
57 self.ui.status(_('analyzing tree version %s...\n') % self.treeversion)
57 self.ui.status(_('analyzing tree version %s...\n') % self.treeversion)
58
58
59 # Get name of temporary directory
59 # Get name of temporary directory
60 version = self.treeversion.split('/')
60 version = self.treeversion.split('/')
61 self.tmppath = os.path.join(tempfile.gettempdir(),
61 self.tmppath = os.path.join(tempfile.gettempdir(),
62 'hg-%s' % version[1])
62 'hg-%s' % version[1])
63
63
64 # Generate parents dictionary
64 # Generate parents dictionary
65 child = []
65 child = []
66 output, status = self.runlines('revisions', self.treeversion)
66 output, status = self.runlines('revisions', self.treeversion)
67 self.checkexit(status, 'archive registered?')
67 self.checkexit(status, 'archive registered?')
68 for l in output:
68 for l in output:
69 rev = l.strip()
69 rev = l.strip()
70 self.changes[rev] = self.gnuarch_rev(rev)
70 self.changes[rev] = self.gnuarch_rev(rev)
71
71
72 # Read author, date and summary
72 # Read author, date and summary
73 catlog = self.runlines0('cat-log', '-d', self.path, rev)
73 catlog = self.runlines0('cat-log', '-d', self.path, rev)
74 self._parsecatlog(catlog, rev)
74 self._parsecatlog(catlog, rev)
75
75
76 self.parents[rev] = child
76 self.parents[rev] = child
77 child = [rev]
77 child = [rev]
78 if rev == self.rev:
78 if rev == self.rev:
79 break
79 break
80 self.parents[None] = child
80 self.parents[None] = child
81
81
82 def after(self):
82 def after(self):
83 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
83 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
84 shutil.rmtree(self.tmppath, ignore_errors=True)
84 shutil.rmtree(self.tmppath, ignore_errors=True)
85
85
86 def getheads(self):
86 def getheads(self):
87 return self.parents[None]
87 return self.parents[None]
88
88
89 def getfile(self, name, rev):
89 def getfile(self, name, rev):
90 if rev != self.lastrev:
90 if rev != self.lastrev:
91 raise util.Abort(_('internal calling inconsistency'))
91 raise util.Abort(_('internal calling inconsistency'))
92
92
93 # Raise IOError if necessary (i.e. deleted files).
93 # Raise IOError if necessary (i.e. deleted files).
94 if not os.path.exists(os.path.join(self.tmppath, name)):
94 if not os.path.exists(os.path.join(self.tmppath, name)):
95 raise IOError
95 raise IOError
96
96
97 data, mode = self._getfile(name, rev)
97 data, mode = self._getfile(name, rev)
98 self.modecache[(name, rev)] = mode
98 self.modecache[(name, rev)] = mode
99
99
100 return data
100 return data
101
101
102 def getmode(self, name, rev):
102 def getmode(self, name, rev):
103 return self.modecache[(name, rev)]
103 return self.modecache[(name, rev)]
104
104
105 def getchanges(self, rev):
105 def getchanges(self, rev):
106 self.modecache = {}
106 self.modecache = {}
107 self._update(rev)
107 self._update(rev)
108 changes = []
108 changes = []
109 copies = {}
109 copies = {}
110
110
111 for f in self.changes[rev].add_files:
111 for f in self.changes[rev].add_files:
112 changes.append((f, rev))
112 changes.append((f, rev))
113
113
114 for f in self.changes[rev].mod_files:
114 for f in self.changes[rev].mod_files:
115 changes.append((f, rev))
115 changes.append((f, rev))
116
116
117 for f in self.changes[rev].del_files:
117 for f in self.changes[rev].del_files:
118 changes.append((f, rev))
118 changes.append((f, rev))
119
119
120 for src in self.changes[rev].ren_files:
120 for src in self.changes[rev].ren_files:
121 to = self.changes[rev].ren_files[src]
121 to = self.changes[rev].ren_files[src]
122 changes.append((src, rev))
122 changes.append((src, rev))
123 changes.append((to, rev))
123 changes.append((to, rev))
124 copies[src] = to
124 copies[to] = src
125
125
126 for src in self.changes[rev].ren_dirs:
126 for src in self.changes[rev].ren_dirs:
127 to = self.changes[rev].ren_dirs[src]
127 to = self.changes[rev].ren_dirs[src]
128 chgs, cps = self._rendirchanges(src, to);
128 chgs, cps = self._rendirchanges(src, to);
129 changes += [(f, rev) for f in chgs]
129 changes += [(f, rev) for f in chgs]
130 for c in cps:
130 copies.update(cps)
131 copies[c] = cps[c]
132
131
133 self.lastrev = rev
132 self.lastrev = rev
134 return util.sort(changes), copies
133 return util.sort(util.unique(changes)), copies
135
134
136 def getcommit(self, rev):
135 def getcommit(self, rev):
137 changes = self.changes[rev]
136 changes = self.changes[rev]
138 return commit(author = changes.author, date = changes.date,
137 return commit(author = changes.author, date = changes.date,
139 desc = changes.summary, parents = self.parents[rev])
138 desc = changes.summary, parents = self.parents[rev])
140
139
141 def gettags(self):
140 def gettags(self):
142 return self.tags
141 return self.tags
143
142
144 def _execute(self, cmd, *args, **kwargs):
143 def _execute(self, cmd, *args, **kwargs):
145 cmdline = [self.execmd, cmd]
144 cmdline = [self.execmd, cmd]
146 cmdline += args
145 cmdline += args
147 cmdline = [util.shellquote(arg) for arg in cmdline]
146 cmdline = [util.shellquote(arg) for arg in cmdline]
148 cmdline += ['>', util.nulldev, '2>', util.nulldev]
147 cmdline += ['>', util.nulldev, '2>', util.nulldev]
149 cmdline = util.quotecommand(' '.join(cmdline))
148 cmdline = util.quotecommand(' '.join(cmdline))
150 self.ui.debug(cmdline, '\n')
149 self.ui.debug(cmdline, '\n')
151 return os.system(cmdline)
150 return os.system(cmdline)
152
151
153 def _update(self, rev):
152 def _update(self, rev):
154 if rev == 'base-0':
153 if rev == 'base-0':
155 # Initialise 'base-0' revision
154 # Initialise 'base-0' revision
156 self._obtainrevision(rev)
155 self._obtainrevision(rev)
157 else:
156 else:
158 self.ui.debug(_('applying revision %s...\n') % rev)
157 self.ui.debug(_('applying revision %s...\n') % rev)
159 revision = '%s--%s' % (self.treeversion, rev)
158 revision = '%s--%s' % (self.treeversion, rev)
160 changeset, status = self.runlines('replay', '-d', self.tmppath,
159 changeset, status = self.runlines('replay', '-d', self.tmppath,
161 revision)
160 revision)
162 if status:
161 if status:
163 # Something went wrong while merging (baz or tla
162 # Something went wrong while merging (baz or tla
164 # issue?), get latest revision and try from there
163 # issue?), get latest revision and try from there
165 shutil.rmtree(self.tmppath, ignore_errors=True)
164 shutil.rmtree(self.tmppath, ignore_errors=True)
166 self._obtainrevision(rev)
165 self._obtainrevision(rev)
167 else:
166 else:
168 old_rev = self.parents[rev][0]
167 old_rev = self.parents[rev][0]
169 self.ui.debug(_('computing changeset between %s and %s...\n')
168 self.ui.debug(_('computing changeset between %s and %s...\n')
170 % (old_rev, rev))
169 % (old_rev, rev))
171 rev_a = '%s--%s' % (self.treeversion, old_rev)
170 rev_a = '%s--%s' % (self.treeversion, old_rev)
172 rev_b = '%s--%s' % (self.treeversion, rev)
171 rev_b = '%s--%s' % (self.treeversion, rev)
173 self._parsechangeset(changeset, rev)
172 self._parsechangeset(changeset, rev)
174
173
175 def _getfile(self, name, rev):
174 def _getfile(self, name, rev):
176 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
175 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
177 if stat.S_ISLNK(mode):
176 if stat.S_ISLNK(mode):
178 data = os.readlink(os.path.join(self.tmppath, name))
177 data = os.readlink(os.path.join(self.tmppath, name))
179 mode = mode and 'l' or ''
178 mode = mode and 'l' or ''
180 else:
179 else:
181 data = open(os.path.join(self.tmppath, name), 'rb').read()
180 data = open(os.path.join(self.tmppath, name), 'rb').read()
182 mode = (mode & 0111) and 'x' or ''
181 mode = (mode & 0111) and 'x' or ''
183 return data, mode
182 return data, mode
184
183
185 def _exclude(self, name):
184 def _exclude(self, name):
186 exclude = [ '{arch}', '.arch-ids', '.arch-inventory' ]
185 exclude = [ '{arch}', '.arch-ids', '.arch-inventory' ]
187 for exc in exclude:
186 for exc in exclude:
188 if name.find(exc) != -1:
187 if name.find(exc) != -1:
189 return True
188 return True
190 return False
189 return False
191
190
192 def _readcontents(self, path):
191 def _readcontents(self, path):
193 files = []
192 files = []
194 contents = os.listdir(path)
193 contents = os.listdir(path)
195 while len(contents) > 0:
194 while len(contents) > 0:
196 c = contents.pop()
195 c = contents.pop()
197 p = os.path.join(path, c)
196 p = os.path.join(path, c)
198 # os.walk could be used, but here we avoid internal GNU
197 # os.walk could be used, but here we avoid internal GNU
199 # Arch files and directories, thus saving a lot time.
198 # Arch files and directories, thus saving a lot time.
200 if not self._exclude(p):
199 if not self._exclude(p):
201 if os.path.isdir(p):
200 if os.path.isdir(p):
202 contents += [os.path.join(c, f) for f in os.listdir(p)]
201 contents += [os.path.join(c, f) for f in os.listdir(p)]
203 else:
202 else:
204 files.append(c)
203 files.append(c)
205 return files
204 return files
206
205
207 def _rendirchanges(self, src, dest):
206 def _rendirchanges(self, src, dest):
208 changes = []
207 changes = []
209 copies = {}
208 copies = {}
210 files = self._readcontents(os.path.join(self.tmppath, dest))
209 files = self._readcontents(os.path.join(self.tmppath, dest))
211 for f in files:
210 for f in files:
212 s = os.path.join(src, f)
211 s = os.path.join(src, f)
213 d = os.path.join(dest, f)
212 d = os.path.join(dest, f)
214 changes.append(s)
213 changes.append(s)
215 changes.append(d)
214 changes.append(d)
216 copies[s] = d
215 copies[d] = s
217 return changes, copies
216 return changes, copies
218
217
219 def _obtainrevision(self, rev):
218 def _obtainrevision(self, rev):
220 self.ui.debug(_('obtaining revision %s...\n') % rev)
219 self.ui.debug(_('obtaining revision %s...\n') % rev)
221 revision = '%s--%s' % (self.treeversion, rev)
220 revision = '%s--%s' % (self.treeversion, rev)
222 output = self._execute('get', revision, self.tmppath)
221 output = self._execute('get', revision, self.tmppath)
223 self.checkexit(output)
222 self.checkexit(output)
224 self.ui.debug(_('analysing revision %s...\n') % rev)
223 self.ui.debug(_('analysing revision %s...\n') % rev)
225 files = self._readcontents(self.tmppath)
224 files = self._readcontents(self.tmppath)
226 self.changes[rev].add_files += files
225 self.changes[rev].add_files += files
227
226
228 def _stripbasepath(self, path):
227 def _stripbasepath(self, path):
229 if path.startswith('./'):
228 if path.startswith('./'):
230 return path[2:]
229 return path[2:]
231 return path
230 return path
232
231
233 def _parsecatlog(self, data, rev):
232 def _parsecatlog(self, data, rev):
234 summary = []
233 summary = []
235 for l in data:
234 for l in data:
236 l = l.strip()
235 l = l.strip()
237 if summary:
236 if summary:
238 summary.append(l)
237 summary.append(l)
239 elif l.startswith('Summary:'):
238 elif l.startswith('Summary:'):
240 summary.append(l[len('Summary: '):])
239 summary.append(l[len('Summary: '):])
241 elif l.startswith('Standard-date:'):
240 elif l.startswith('Standard-date:'):
242 date = l[len('Standard-date: '):]
241 date = l[len('Standard-date: '):]
243 strdate = util.strdate(date, '%Y-%m-%d %H:%M:%S')
242 strdate = util.strdate(date, '%Y-%m-%d %H:%M:%S')
244 self.changes[rev].date = util.datestr(strdate)
243 self.changes[rev].date = util.datestr(strdate)
245 elif l.startswith('Creator:'):
244 elif l.startswith('Creator:'):
246 self.changes[rev].author = l[len('Creator: '):]
245 self.changes[rev].author = l[len('Creator: '):]
247 self.changes[rev].summary = '\n'.join(summary)
246 self.changes[rev].summary = '\n'.join(summary)
248
247
249 def _parsechangeset(self, data, rev):
248 def _parsechangeset(self, data, rev):
250 for l in data:
249 for l in data:
251 l = l.strip()
250 l = l.strip()
252 # Added file (ignore added directory)
251 # Added file (ignore added directory)
253 if l.startswith('A') and not l.startswith('A/'):
252 if l.startswith('A') and not l.startswith('A/'):
254 file = self._stripbasepath(l[1:].strip())
253 file = self._stripbasepath(l[1:].strip())
255 if not self._exclude(file):
254 if not self._exclude(file):
256 self.changes[rev].add_files.append(file)
255 self.changes[rev].add_files.append(file)
257 # Deleted file (ignore deleted directory)
256 # Deleted file (ignore deleted directory)
258 elif l.startswith('D') and not l.startswith('D/'):
257 elif l.startswith('D') and not l.startswith('D/'):
259 file = self._stripbasepath(l[1:].strip())
258 file = self._stripbasepath(l[1:].strip())
260 if not self._exclude(file):
259 if not self._exclude(file):
261 self.changes[rev].del_files.append(file)
260 self.changes[rev].del_files.append(file)
262 # Modified binary file
261 # Modified binary file
263 elif l.startswith('Mb'):
262 elif l.startswith('Mb'):
264 file = self._stripbasepath(l[2:].strip())
263 file = self._stripbasepath(l[2:].strip())
265 if not self._exclude(file):
264 if not self._exclude(file):
266 self.changes[rev].mod_files.append(file)
265 self.changes[rev].mod_files.append(file)
267 # Modified link
266 # Modified link
268 elif l.startswith('M->'):
267 elif l.startswith('M->'):
269 file = self._stripbasepath(l[3:].strip())
268 file = self._stripbasepath(l[3:].strip())
270 if not self._exclude(file):
269 if not self._exclude(file):
271 self.changes[rev].mod_files.append(file)
270 self.changes[rev].mod_files.append(file)
272 # Modified file
271 # Modified file
273 elif l.startswith('M'):
272 elif l.startswith('M'):
274 file = self._stripbasepath(l[1:].strip())
273 file = self._stripbasepath(l[1:].strip())
275 if not self._exclude(file):
274 if not self._exclude(file):
276 self.changes[rev].mod_files.append(file)
275 self.changes[rev].mod_files.append(file)
277 # Renamed file (or link)
276 # Renamed file (or link)
278 elif l.startswith('=>'):
277 elif l.startswith('=>'):
279 files = l[2:].strip().split(' ')
278 files = l[2:].strip().split(' ')
280 if len(files) == 1:
279 if len(files) == 1:
281 files = l[2:].strip().split('\t')
280 files = l[2:].strip().split('\t')
282 src = self._stripbasepath(files[0])
281 src = self._stripbasepath(files[0])
283 dst = self._stripbasepath(files[1])
282 dst = self._stripbasepath(files[1])
284 if not self._exclude(src) and not self._exclude(dst):
283 if not self._exclude(src) and not self._exclude(dst):
285 self.changes[rev].ren_files[src] = dst
284 self.changes[rev].ren_files[src] = dst
286 # Conversion from file to link or from link to file (modified)
285 # Conversion from file to link or from link to file (modified)
287 elif l.startswith('ch'):
286 elif l.startswith('ch'):
288 file = self._stripbasepath(l[2:].strip())
287 file = self._stripbasepath(l[2:].strip())
289 if not self._exclude(file):
288 if not self._exclude(file):
290 self.changes[rev].mod_files.append(file)
289 self.changes[rev].mod_files.append(file)
291 # Renamed directory
290 # Renamed directory
292 elif l.startswith('/>'):
291 elif l.startswith('/>'):
293 dirs = l[2:].strip().split(' ')
292 dirs = l[2:].strip().split(' ')
294 if len(dirs) == 1:
293 if len(dirs) == 1:
295 dirs = l[2:].strip().split('\t')
294 dirs = l[2:].strip().split('\t')
296 src = self._stripbasepath(dirs[0])
295 src = self._stripbasepath(dirs[0])
297 dst = self._stripbasepath(dirs[1])
296 dst = self._stripbasepath(dirs[1])
298 if not self._exclude(src) and not self._exclude(dst):
297 if not self._exclude(src) and not self._exclude(dst):
299 self.changes[rev].ren_dirs[src] = dst
298 self.changes[rev].ren_dirs[src] = dst
@@ -1,73 +1,82 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 "$TESTDIR/hghave" baz || exit 80
3 "$TESTDIR/hghave" baz || exit 80
4
4
5 mkdir do_not_use_HOME_baz
5 mkdir do_not_use_HOME_baz
6 cd do_not_use_HOME_baz
6 cd do_not_use_HOME_baz
7 HOME=`pwd`; export HOME
7 HOME=`pwd`; export HOME
8 cd ..
8 cd ..
9 baz my-id "mercurial <mercurial@selenic.com>"
9 baz my-id "mercurial <mercurial@selenic.com>"
10
10
11 echo "[extensions]" >> $HGRCPATH
11 echo "[extensions]" >> $HGRCPATH
12 echo "convert=" >> $HGRCPATH
12 echo "convert=" >> $HGRCPATH
13 echo 'hgext.graphlog =' >> $HGRCPATH
13 echo 'hgext.graphlog =' >> $HGRCPATH
14
14
15 echo % create baz archive
15 echo % create baz archive
16 baz make-archive baz@mercurial--convert hg-test-convert-baz
16 baz make-archive baz@mercurial--convert hg-test-convert-baz
17
17
18 echo % initialize baz repo
18 echo % initialize baz repo
19 mkdir baz-repo
19 mkdir baz-repo
20 cd baz-repo/
20 cd baz-repo/
21 baz init-tree baz@mercurial--convert/baz--test--0
21 baz init-tree baz@mercurial--convert/baz--test--0
22 baz import
22 baz import
23
23
24 echo % create initial files
24 echo % create initial files
25 echo 'this is a file' > a
25 echo 'this is a file' > a
26 baz add a
26 baz add a
27 mkdir src
27 mkdir src
28 baz add src
28 baz add src
29 cd src
29 cd src
30 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
30 dd count=1 if=/dev/zero of=b > /dev/null 2> /dev/null
31 baz add b
31 baz add b
32 baz commit -s "added a file, src and src/b (binary)"
32 baz commit -s "added a file, src and src/b (binary)"
33
33
34 echo % create link file and modify a
34 echo % create link file and modify a
35 ln -s ../a a-link
35 ln -s ../a a-link
36 baz add a-link
36 baz add a-link
37 echo 'this a modification to a' >> ../a
37 echo 'this a modification to a' >> ../a
38 baz commit -s "added link to a and modify a"
38 baz commit -s "added link to a and modify a"
39
39
40 echo % create second link and modify b
40 echo % create second link and modify b
41 ln -s ../a a-link-2
41 ln -s ../a a-link-2
42 baz add a-link-2
42 baz add a-link-2
43 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
43 dd count=1 seek=1 if=/dev/zero of=b > /dev/null 2> /dev/null
44 baz commit -s "added second link and modify b"
44 baz commit -s "added second link and modify b"
45
45
46 echo % b file to link and a-link-2 to regular file
46 echo % b file to link and a-link-2 to regular file
47 rm -f a-link-2
47 rm -f a-link-2
48 echo 'this is now a regular file' > a-link-2
48 echo 'this is now a regular file' > a-link-2
49 ln -sf ../a b
49 ln -sf ../a b
50 baz commit -s "file to link and link to file test"
50 baz commit -s "file to link and link to file test"
51
51
52 echo % move a-link-2 file and src directory
52 echo % move a-link-2 file and src directory
53 cd ..
53 cd ..
54 baz mv src/a-link-2 c
54 baz mv src/a-link-2 c
55 baz mv src test
55 baz mv src test
56 baz commit -s "move and rename a-link-2 file and src directory"
56 baz commit -s "move and rename a-link-2 file and src directory"
57
57
58 echo % move and add the moved file again
59 echo e > e
60 baz add e
61 baz commit -s "add e"
62 baz mv e f
63 echo ee > e
64 baz add e
65 baz commit -s "move e and recreate it again"
58 cd ..
66 cd ..
59
67
60 echo % converting baz repo to Mercurial
68 echo % converting baz repo to Mercurial
61 hg convert baz-repo baz-repo-hg
69 hg convert baz-repo baz-repo-hg
62
70
63 baz register-archive -d baz@mercurial--convert
71 baz register-archive -d baz@mercurial--convert
64
72
65 glog()
73 glog()
66 {
74 {
67 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
75 hg glog --template '#rev# "#desc|firstline#" files: #files#\n' "$@"
68 }
76 }
69
77
70 echo % show graph log
78 echo % show graph log
71 glog -R baz-repo-hg
79 glog -R baz-repo-hg
72 hg up -q -R baz-repo-hg
80 hg up -q -R baz-repo-hg
73 hg -R baz-repo-hg manifest --debug
81 hg -R baz-repo-hg manifest --debug
82 hg -R baz-repo-hg log -r 5 -r 7 -C --debug | grep copies
@@ -1,75 +1,96 b''
1 % create baz archive
1 % create baz archive
2 % initialize baz repo
2 % initialize baz repo
3 * creating version baz@mercurial--convert/baz--test--0
3 * creating version baz@mercurial--convert/baz--test--0
4 * imported baz@mercurial--convert/baz--test--0
4 * imported baz@mercurial--convert/baz--test--0
5 % create initial files
5 % create initial files
6 * build pristine tree for baz@mercurial--convert/baz--test--0--base-0
6 * build pristine tree for baz@mercurial--convert/baz--test--0--base-0
7 * Scanning for full-tree revision: .
7 * Scanning for full-tree revision: .
8 * from import revision: baz@mercurial--convert/baz--test--0--base-0
8 * from import revision: baz@mercurial--convert/baz--test--0--base-0
9 A/ .arch-ids
9 A/ .arch-ids
10 A/ src
10 A/ src
11 A/ src/.arch-ids
11 A/ src/.arch-ids
12 A .arch-ids/a.id
12 A .arch-ids/a.id
13 A a
13 A a
14 A src/.arch-ids/=id
14 A src/.arch-ids/=id
15 A src/.arch-ids/b.id
15 A src/.arch-ids/b.id
16 A src/b
16 A src/b
17 * update pristine tree (baz@mercurial--convert/baz--test--0--base-0 => baz--test--0--patch-1)
17 * update pristine tree (baz@mercurial--convert/baz--test--0--base-0 => baz--test--0--patch-1)
18 * committed baz@mercurial--convert/baz--test--0--patch-1
18 * committed baz@mercurial--convert/baz--test--0--patch-1
19 % create link file and modify a
19 % create link file and modify a
20 A src/.arch-ids/a-link.id
20 A src/.arch-ids/a-link.id
21 A src/a-link
21 A src/a-link
22 M a
22 M a
23 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-1 => baz--test--0--patch-2)
23 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-1 => baz--test--0--patch-2)
24 * committed baz@mercurial--convert/baz--test--0--patch-2
24 * committed baz@mercurial--convert/baz--test--0--patch-2
25 % create second link and modify b
25 % create second link and modify b
26 A src/.arch-ids/a-link-2.id
26 A src/.arch-ids/a-link-2.id
27 A src/a-link-2
27 A src/a-link-2
28 Mb src/b
28 Mb src/b
29 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-2 => baz--test--0--patch-3)
29 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-2 => baz--test--0--patch-3)
30 * committed baz@mercurial--convert/baz--test--0--patch-3
30 * committed baz@mercurial--convert/baz--test--0--patch-3
31 % b file to link and a-link-2 to regular file
31 % b file to link and a-link-2 to regular file
32 fl src/b
32 fl src/b
33 lf src/a-link-2
33 lf src/a-link-2
34 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-3 => baz--test--0--patch-4)
34 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-3 => baz--test--0--patch-4)
35 * committed baz@mercurial--convert/baz--test--0--patch-4
35 * committed baz@mercurial--convert/baz--test--0--patch-4
36 % move a-link-2 file and src directory
36 % move a-link-2 file and src directory
37 D/ src/.arch-ids
37 D/ src/.arch-ids
38 A/ test/.arch-ids
38 A/ test/.arch-ids
39 /> src test
39 /> src test
40 => src/.arch-ids/a-link-2.id .arch-ids/c.id
40 => src/.arch-ids/a-link-2.id .arch-ids/c.id
41 => src/a-link-2 c
41 => src/a-link-2 c
42 => src/.arch-ids/=id test/.arch-ids/=id
42 => src/.arch-ids/=id test/.arch-ids/=id
43 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
43 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
44 => src/.arch-ids/b.id test/.arch-ids/b.id
44 => src/.arch-ids/b.id test/.arch-ids/b.id
45 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-4 => baz--test--0--patch-5)
45 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-4 => baz--test--0--patch-5)
46 * committed baz@mercurial--convert/baz--test--0--patch-5
46 * committed baz@mercurial--convert/baz--test--0--patch-5
47 % move and add the moved file again
48 A .arch-ids/e.id
49 A e
50 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-5 => baz--test--0--patch-6)
51 * committed baz@mercurial--convert/baz--test--0--patch-6
52 A .arch-ids/e.id
53 A e
54 => .arch-ids/e.id .arch-ids/f.id
55 => e f
56 * update pristine tree (baz@mercurial--convert/baz--test--0--patch-6 => baz--test--0--patch-7)
57 * committed baz@mercurial--convert/baz--test--0--patch-7
47 % converting baz repo to Mercurial
58 % converting baz repo to Mercurial
48 initializing destination baz-repo-hg repository
59 initializing destination baz-repo-hg repository
49 analyzing tree version baz@mercurial--convert/baz--test--0...
60 analyzing tree version baz@mercurial--convert/baz--test--0...
50 scanning source...
61 scanning source...
51 sorting...
62 sorting...
52 converting...
63 converting...
53 5 initial import
64 7 initial import
54 4 added a file, src and src/b (binary)
65 6 added a file, src and src/b (binary)
55 3 added link to a and modify a
66 5 added link to a and modify a
56 2 added second link and modify b
67 4 added second link and modify b
57 1 file to link and link to file test
68 3 file to link and link to file test
58 0 move and rename a-link-2 file and src directory
69 2 move and rename a-link-2 file and src directory
70 1 add e
71 0 move e and recreate it again
59 % show graph log
72 % show graph log
73 o 7 "move e and recreate it again" files: e f
74 |
75 o 6 "add e" files: e
76 |
60 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
77 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
61 |
78 |
62 o 4 "file to link and link to file test" files: src/a-link-2 src/b
79 o 4 "file to link and link to file test" files: src/a-link-2 src/b
63 |
80 |
64 o 3 "added second link and modify b" files: src/a-link-2 src/b
81 o 3 "added second link and modify b" files: src/a-link-2 src/b
65 |
82 |
66 o 2 "added link to a and modify a" files: a src/a-link
83 o 2 "added link to a and modify a" files: a src/a-link
67 |
84 |
68 o 1 "added a file, src and src/b (binary)" files: a src/b
85 o 1 "added a file, src and src/b (binary)" files: a src/b
69 |
86 |
70 o 0 "initial import" files:
87 o 0 "initial import" files:
71
88
72 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
89 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
73 e3207be798aaf87a444a62903621edab4ddc1fb6 644 c
90 623942606de842342ac7b221ae9ccabc13b5d8c8 644 c
74 1f6b5bb93f1da278ef1fead1e4740a03d8802e9f 644 @ test/a-link
91 1a4a864db0073705a11b1439f563bfa4b46d9246 644 e
75 1f6b5bb93f1da278ef1fead1e4740a03d8802e9f 644 @ test/b
92 ab9089704d7c988687521e6adf018ebf767da7d6 644 f
93 43b4308708a4b36340566684df2e2a074b12ceb0 644 @ test/a-link
94 73773e3389ef7ec5a070519b74895d2eaa4ad5db 644 @ test/b
95 copies: c (src/a-link-2) test/a-link (src/a-link) test/b (src/b)
96 copies: f (e)
@@ -1,72 +1,72 b''
1 % create tla archive
1 % create tla archive
2 % initialize tla repo
2 % initialize tla repo
3 * creating version tla@mercurial--convert/tla--test--0
3 * creating version tla@mercurial--convert/tla--test--0
4 * imported tla@mercurial--convert/tla--test--0
4 * imported tla@mercurial--convert/tla--test--0
5 % create initial files
5 % create initial files
6 A/ .arch-ids
6 A/ .arch-ids
7 A/ src
7 A/ src
8 A/ src/.arch-ids
8 A/ src/.arch-ids
9 A .arch-ids/a.id
9 A .arch-ids/a.id
10 A a
10 A a
11 A src/.arch-ids/=id
11 A src/.arch-ids/=id
12 A src/.arch-ids/b.id
12 A src/.arch-ids/b.id
13 A src/b
13 A src/b
14 * update pristine tree (tla@mercurial--convert/tla--test--0--base-0 => tla--test--0--patch-1)
14 * update pristine tree (tla@mercurial--convert/tla--test--0--base-0 => tla--test--0--patch-1)
15 * committed tla@mercurial--convert/tla--test--0--patch-1
15 * committed tla@mercurial--convert/tla--test--0--patch-1
16 % create link file and modify a
16 % create link file and modify a
17 A src/.arch-ids/a-link.id
17 A src/.arch-ids/a-link.id
18 A src/a-link
18 A src/a-link
19 M a
19 M a
20 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-1 => tla--test--0--patch-2)
20 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-1 => tla--test--0--patch-2)
21 * committed tla@mercurial--convert/tla--test--0--patch-2
21 * committed tla@mercurial--convert/tla--test--0--patch-2
22 % create second link and modify b
22 % create second link and modify b
23 A src/.arch-ids/a-link-2.id
23 A src/.arch-ids/a-link-2.id
24 A src/a-link-2
24 A src/a-link-2
25 Mb src/b
25 Mb src/b
26 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-2 => tla--test--0--patch-3)
26 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-2 => tla--test--0--patch-3)
27 * committed tla@mercurial--convert/tla--test--0--patch-3
27 * committed tla@mercurial--convert/tla--test--0--patch-3
28 % b file to link and a-link-2 to regular file
28 % b file to link and a-link-2 to regular file
29 fl src/b
29 fl src/b
30 lf src/a-link-2
30 lf src/a-link-2
31 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-3 => tla--test--0--patch-4)
31 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-3 => tla--test--0--patch-4)
32 * committed tla@mercurial--convert/tla--test--0--patch-4
32 * committed tla@mercurial--convert/tla--test--0--patch-4
33 % move a-link-2 file and src directory
33 % move a-link-2 file and src directory
34 D/ src/.arch-ids
34 D/ src/.arch-ids
35 A/ test/.arch-ids
35 A/ test/.arch-ids
36 /> src test
36 /> src test
37 => src/.arch-ids/a-link-2.id .arch-ids/c.id
37 => src/.arch-ids/a-link-2.id .arch-ids/c.id
38 => src/a-link-2 c
38 => src/a-link-2 c
39 => src/.arch-ids/=id test/.arch-ids/=id
39 => src/.arch-ids/=id test/.arch-ids/=id
40 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
40 => src/.arch-ids/a-link.id test/.arch-ids/a-link.id
41 => src/.arch-ids/b.id test/.arch-ids/b.id
41 => src/.arch-ids/b.id test/.arch-ids/b.id
42 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-4 => tla--test--0--patch-5)
42 * update pristine tree (tla@mercurial--convert/tla--test--0--patch-4 => tla--test--0--patch-5)
43 * committed tla@mercurial--convert/tla--test--0--patch-5
43 * committed tla@mercurial--convert/tla--test--0--patch-5
44 % converting tla repo to Mercurial
44 % converting tla repo to Mercurial
45 initializing destination tla-repo-hg repository
45 initializing destination tla-repo-hg repository
46 analyzing tree version tla@mercurial--convert/tla--test--0...
46 analyzing tree version tla@mercurial--convert/tla--test--0...
47 scanning source...
47 scanning source...
48 sorting...
48 sorting...
49 converting...
49 converting...
50 5 initial import
50 5 initial import
51 4 added a file, src and src/b (binary)
51 4 added a file, src and src/b (binary)
52 3 added link to a and modify a
52 3 added link to a and modify a
53 2 added second link and modify b
53 2 added second link and modify b
54 1 file to link and link to file test
54 1 file to link and link to file test
55 0 move and rename a-link-2 file and src directory
55 0 move and rename a-link-2 file and src directory
56 % show graph log
56 % show graph log
57 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
57 o 5 "move and rename a-link-2 file and src directory" files: c src/a-link src/a-link-2 src/b test/a-link test/b
58 |
58 |
59 o 4 "file to link and link to file test" files: src/a-link-2 src/b
59 o 4 "file to link and link to file test" files: src/a-link-2 src/b
60 |
60 |
61 o 3 "added second link and modify b" files: src/a-link-2 src/b
61 o 3 "added second link and modify b" files: src/a-link-2 src/b
62 |
62 |
63 o 2 "added link to a and modify a" files: a src/a-link
63 o 2 "added link to a and modify a" files: a src/a-link
64 |
64 |
65 o 1 "added a file, src and src/b (binary)" files: a src/b
65 o 1 "added a file, src and src/b (binary)" files: a src/b
66 |
66 |
67 o 0 "initial import" files:
67 o 0 "initial import" files:
68
68
69 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
69 c4072c4b72e1cabace081888efa148ee80ca3cbb 644 a
70 e3207be798aaf87a444a62903621edab4ddc1fb6 644 c
70 623942606de842342ac7b221ae9ccabc13b5d8c8 644 c
71 1f6b5bb93f1da278ef1fead1e4740a03d8802e9f 644 @ test/a-link
71 43b4308708a4b36340566684df2e2a074b12ceb0 644 @ test/a-link
72 1f6b5bb93f1da278ef1fead1e4740a03d8802e9f 644 @ test/b
72 73773e3389ef7ec5a070519b74895d2eaa4ad5db 644 @ test/b
General Comments 0
You need to be logged in to leave comments. Login now