##// END OF EJS Templates
Merge with crew-stable
Patrick Mezard -
r7603:d702a702 merge default
parent child Browse files
Show More
@@ -1,336 +1,335 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, locale
6 import os, shutil, tempfile, stat, locale
7 from email.Parser import Parser
7 from email.Parser import Parser
8
8
9 class gnuarch_source(converter_source, commandline):
9 class gnuarch_source(converter_source, commandline):
10
10
11 class gnuarch_rev:
11 class gnuarch_rev:
12 def __init__(self, rev):
12 def __init__(self, rev):
13 self.rev = rev
13 self.rev = rev
14 self.summary = ''
14 self.summary = ''
15 self.date = None
15 self.date = None
16 self.author = ''
16 self.author = ''
17 self.continuationof = None
17 self.continuationof = None
18 self.add_files = []
18 self.add_files = []
19 self.mod_files = []
19 self.mod_files = []
20 self.del_files = []
20 self.del_files = []
21 self.ren_files = {}
21 self.ren_files = {}
22 self.ren_dirs = {}
22 self.ren_dirs = {}
23
23
24 def __init__(self, ui, path, rev=None):
24 def __init__(self, ui, path, rev=None):
25 super(gnuarch_source, self).__init__(ui, path, rev=rev)
25 super(gnuarch_source, self).__init__(ui, path, rev=rev)
26
26
27 if not os.path.exists(os.path.join(path, '{arch}')):
27 if not os.path.exists(os.path.join(path, '{arch}')):
28 raise NoRepo(_("%s does not look like a GNU Arch repo") % path)
28 raise NoRepo(_("%s does not look like a GNU Arch repo") % path)
29
29
30 # Could use checktool, but we want to check for baz or tla.
30 # Could use checktool, but we want to check for baz or tla.
31 self.execmd = None
31 self.execmd = None
32 if util.find_exe('baz'):
32 if util.find_exe('baz'):
33 self.execmd = 'baz'
33 self.execmd = 'baz'
34 else:
34 else:
35 if util.find_exe('tla'):
35 if util.find_exe('tla'):
36 self.execmd = 'tla'
36 self.execmd = 'tla'
37 else:
37 else:
38 raise util.Abort(_('cannot find a GNU Arch tool'))
38 raise util.Abort(_('cannot find a GNU Arch tool'))
39
39
40 commandline.__init__(self, ui, self.execmd)
40 commandline.__init__(self, ui, self.execmd)
41
41
42 self.path = os.path.realpath(path)
42 self.path = os.path.realpath(path)
43 self.tmppath = None
43 self.tmppath = None
44
44
45 self.treeversion = None
45 self.treeversion = None
46 self.lastrev = None
46 self.lastrev = None
47 self.changes = {}
47 self.changes = {}
48 self.parents = {}
48 self.parents = {}
49 self.tags = {}
49 self.tags = {}
50 self.modecache = {}
50 self.modecache = {}
51 self.catlogparser = Parser()
51 self.catlogparser = Parser()
52 self.locale = locale.getpreferredencoding()
52 self.locale = locale.getpreferredencoding()
53 self.archives = []
53 self.archives = []
54
54
55 def before(self):
55 def before(self):
56 # Get registered archives
56 # Get registered archives
57 self.archives = [i.rstrip('\n')
57 self.archives = [i.rstrip('\n')
58 for i in self.runlines0('archives', '-n')]
58 for i in self.runlines0('archives', '-n')]
59
59
60 if self.execmd == 'tla':
60 if self.execmd == 'tla':
61 output = self.run0('tree-version', self.path)
61 output = self.run0('tree-version', self.path)
62 else:
62 else:
63 output = self.run0('tree-version', '-d', self.path)
63 output = self.run0('tree-version', '-d', self.path)
64 self.treeversion = output.strip()
64 self.treeversion = output.strip()
65
65
66 # Get name of temporary directory
66 # Get name of temporary directory
67 version = self.treeversion.split('/')
67 version = self.treeversion.split('/')
68 self.tmppath = os.path.join(tempfile.gettempdir(),
68 self.tmppath = os.path.join(tempfile.gettempdir(),
69 'hg-%s' % version[1])
69 'hg-%s' % version[1])
70
70
71 # Generate parents dictionary
71 # Generate parents dictionary
72 self.parents[None] = []
72 self.parents[None] = []
73 treeversion = self.treeversion
73 treeversion = self.treeversion
74 child = None
74 child = None
75 while treeversion:
75 while treeversion:
76 self.ui.status(_('analyzing tree version %s...\n') % treeversion)
76 self.ui.status(_('analyzing tree version %s...\n') % treeversion)
77
77
78 archive = treeversion.split('/')[0]
78 archive = treeversion.split('/')[0]
79 if archive not in self.archives:
79 if archive not in self.archives:
80 self.ui.status(_('tree analysis stopped because it points to an unregistered archive %s...\n') % archive)
80 self.ui.status(_('tree analysis stopped because it points to an unregistered archive %s...\n') % archive)
81 break
81 break
82
82
83 # Get the complete list of revisions for that tree version
83 # Get the complete list of revisions for that tree version
84 output, status = self.runlines('revisions', '-r', '-f', treeversion)
84 output, status = self.runlines('revisions', '-r', '-f', treeversion)
85 self.checkexit(status, 'failed retrieveing revisions for %s' % treeversion)
85 self.checkexit(status, 'failed retrieveing revisions for %s' % treeversion)
86
86
87 # No new iteration unless a revision has a continuation-of header
87 # No new iteration unless a revision has a continuation-of header
88 treeversion = None
88 treeversion = None
89
89
90 for l in output:
90 for l in output:
91 rev = l.strip()
91 rev = l.strip()
92 self.changes[rev] = self.gnuarch_rev(rev)
92 self.changes[rev] = self.gnuarch_rev(rev)
93 self.parents[rev] = []
93 self.parents[rev] = []
94
94
95 # Read author, date and summary
95 # Read author, date and summary
96 catlog, status = self.run('cat-log', '-d', self.path, rev)
96 catlog, status = self.run('cat-log', '-d', self.path, rev)
97 if status:
97 if status:
98 catlog = self.run0('cat-archive-log', rev)
98 catlog = self.run0('cat-archive-log', rev)
99 self._parsecatlog(catlog, rev)
99 self._parsecatlog(catlog, rev)
100
100
101 # Populate the parents map
101 # Populate the parents map
102 self.parents[child].append(rev)
102 self.parents[child].append(rev)
103
103
104 # Keep track of the current revision as the child of the next
104 # Keep track of the current revision as the child of the next
105 # revision scanned
105 # revision scanned
106 child = rev
106 child = rev
107
107
108 # Check if we have to follow the usual incremental history
108 # Check if we have to follow the usual incremental history
109 # or if we have to 'jump' to a different treeversion given
109 # or if we have to 'jump' to a different treeversion given
110 # by the continuation-of header.
110 # by the continuation-of header.
111 if self.changes[rev].continuationof:
111 if self.changes[rev].continuationof:
112 treeversion = '--'.join(self.changes[rev].continuationof.split('--')[:-1])
112 treeversion = '--'.join(self.changes[rev].continuationof.split('--')[:-1])
113 break
113 break
114
114
115 # If we reached a base-0 revision w/o any continuation-of
115 # If we reached a base-0 revision w/o any continuation-of
116 # header, it means the tree history ends here.
116 # header, it means the tree history ends here.
117 if rev[-6:] == 'base-0':
117 if rev[-6:] == 'base-0':
118 break
118 break
119
119
120 def after(self):
120 def after(self):
121 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
121 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
122 shutil.rmtree(self.tmppath, ignore_errors=True)
122 shutil.rmtree(self.tmppath, ignore_errors=True)
123
123
124 def getheads(self):
124 def getheads(self):
125 return self.parents[None]
125 return self.parents[None]
126
126
127 def getfile(self, name, rev):
127 def getfile(self, name, rev):
128 if rev != self.lastrev:
128 if rev != self.lastrev:
129 raise util.Abort(_('internal calling inconsistency'))
129 raise util.Abort(_('internal calling inconsistency'))
130
130
131 # Raise IOError if necessary (i.e. deleted files).
131 # Raise IOError if necessary (i.e. deleted files).
132 if not os.path.exists(os.path.join(self.tmppath, name)):
132 if not os.path.exists(os.path.join(self.tmppath, name)):
133 raise IOError
133 raise IOError
134
134
135 data, mode = self._getfile(name, rev)
135 data, mode = self._getfile(name, rev)
136 self.modecache[(name, rev)] = mode
136 self.modecache[(name, rev)] = mode
137
137
138 return data
138 return data
139
139
140 def getmode(self, name, rev):
140 def getmode(self, name, rev):
141 return self.modecache[(name, rev)]
141 return self.modecache[(name, rev)]
142
142
143 def getchanges(self, rev):
143 def getchanges(self, rev):
144 self.modecache = {}
144 self.modecache = {}
145 self._update(rev)
145 self._update(rev)
146 changes = []
146 changes = []
147 copies = {}
147 copies = {}
148
148
149 for f in self.changes[rev].add_files:
149 for f in self.changes[rev].add_files:
150 changes.append((f, rev))
150 changes.append((f, rev))
151
151
152 for f in self.changes[rev].mod_files:
152 for f in self.changes[rev].mod_files:
153 changes.append((f, rev))
153 changes.append((f, rev))
154
154
155 for f in self.changes[rev].del_files:
155 for f in self.changes[rev].del_files:
156 changes.append((f, rev))
156 changes.append((f, rev))
157
157
158 for src in self.changes[rev].ren_files:
158 for src in self.changes[rev].ren_files:
159 to = self.changes[rev].ren_files[src]
159 to = self.changes[rev].ren_files[src]
160 changes.append((src, rev))
160 changes.append((src, rev))
161 changes.append((to, rev))
161 changes.append((to, rev))
162 copies[src] = to
162 copies[to] = src
163
163
164 for src in self.changes[rev].ren_dirs:
164 for src in self.changes[rev].ren_dirs:
165 to = self.changes[rev].ren_dirs[src]
165 to = self.changes[rev].ren_dirs[src]
166 chgs, cps = self._rendirchanges(src, to);
166 chgs, cps = self._rendirchanges(src, to);
167 changes += [(f, rev) for f in chgs]
167 changes += [(f, rev) for f in chgs]
168 for c in cps:
168 copies.update(cps)
169 copies[c] = cps[c]
170
169
171 self.lastrev = rev
170 self.lastrev = rev
172 return util.sort(changes), copies
171 return util.sort(util.unique(changes)), copies
173
172
174 def getcommit(self, rev):
173 def getcommit(self, rev):
175 changes = self.changes[rev]
174 changes = self.changes[rev]
176 return commit(author = changes.author, date = changes.date,
175 return commit(author = changes.author, date = changes.date,
177 desc = changes.summary, parents = self.parents[rev], rev=rev)
176 desc = changes.summary, parents = self.parents[rev], rev=rev)
178
177
179 def gettags(self):
178 def gettags(self):
180 return self.tags
179 return self.tags
181
180
182 def _execute(self, cmd, *args, **kwargs):
181 def _execute(self, cmd, *args, **kwargs):
183 cmdline = [self.execmd, cmd]
182 cmdline = [self.execmd, cmd]
184 cmdline += args
183 cmdline += args
185 cmdline = [util.shellquote(arg) for arg in cmdline]
184 cmdline = [util.shellquote(arg) for arg in cmdline]
186 cmdline += ['>', util.nulldev, '2>', util.nulldev]
185 cmdline += ['>', util.nulldev, '2>', util.nulldev]
187 cmdline = util.quotecommand(' '.join(cmdline))
186 cmdline = util.quotecommand(' '.join(cmdline))
188 self.ui.debug(cmdline, '\n')
187 self.ui.debug(cmdline, '\n')
189 return os.system(cmdline)
188 return os.system(cmdline)
190
189
191 def _update(self, rev):
190 def _update(self, rev):
192 self.ui.debug(_('applying revision %s...\n') % rev)
191 self.ui.debug(_('applying revision %s...\n') % rev)
193 changeset, status = self.runlines('replay', '-d', self.tmppath,
192 changeset, status = self.runlines('replay', '-d', self.tmppath,
194 rev)
193 rev)
195 if status:
194 if status:
196 # Something went wrong while merging (baz or tla
195 # Something went wrong while merging (baz or tla
197 # issue?), get latest revision and try from there
196 # issue?), get latest revision and try from there
198 shutil.rmtree(self.tmppath, ignore_errors=True)
197 shutil.rmtree(self.tmppath, ignore_errors=True)
199 self._obtainrevision(rev)
198 self._obtainrevision(rev)
200 else:
199 else:
201 old_rev = self.parents[rev][0]
200 old_rev = self.parents[rev][0]
202 self.ui.debug(_('computing changeset between %s and %s...\n')
201 self.ui.debug(_('computing changeset between %s and %s...\n')
203 % (old_rev, rev))
202 % (old_rev, rev))
204 self._parsechangeset(changeset, rev)
203 self._parsechangeset(changeset, rev)
205
204
206 def _getfile(self, name, rev):
205 def _getfile(self, name, rev):
207 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
206 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
208 if stat.S_ISLNK(mode):
207 if stat.S_ISLNK(mode):
209 data = os.readlink(os.path.join(self.tmppath, name))
208 data = os.readlink(os.path.join(self.tmppath, name))
210 mode = mode and 'l' or ''
209 mode = mode and 'l' or ''
211 else:
210 else:
212 data = open(os.path.join(self.tmppath, name), 'rb').read()
211 data = open(os.path.join(self.tmppath, name), 'rb').read()
213 mode = (mode & 0111) and 'x' or ''
212 mode = (mode & 0111) and 'x' or ''
214 return data, mode
213 return data, mode
215
214
216 def _exclude(self, name):
215 def _exclude(self, name):
217 exclude = [ '{arch}', '.arch-ids', '.arch-inventory' ]
216 exclude = [ '{arch}', '.arch-ids', '.arch-inventory' ]
218 for exc in exclude:
217 for exc in exclude:
219 if name.find(exc) != -1:
218 if name.find(exc) != -1:
220 return True
219 return True
221 return False
220 return False
222
221
223 def _readcontents(self, path):
222 def _readcontents(self, path):
224 files = []
223 files = []
225 contents = os.listdir(path)
224 contents = os.listdir(path)
226 while len(contents) > 0:
225 while len(contents) > 0:
227 c = contents.pop()
226 c = contents.pop()
228 p = os.path.join(path, c)
227 p = os.path.join(path, c)
229 # os.walk could be used, but here we avoid internal GNU
228 # os.walk could be used, but here we avoid internal GNU
230 # Arch files and directories, thus saving a lot time.
229 # Arch files and directories, thus saving a lot time.
231 if not self._exclude(p):
230 if not self._exclude(p):
232 if os.path.isdir(p):
231 if os.path.isdir(p):
233 contents += [os.path.join(c, f) for f in os.listdir(p)]
232 contents += [os.path.join(c, f) for f in os.listdir(p)]
234 else:
233 else:
235 files.append(c)
234 files.append(c)
236 return files
235 return files
237
236
238 def _rendirchanges(self, src, dest):
237 def _rendirchanges(self, src, dest):
239 changes = []
238 changes = []
240 copies = {}
239 copies = {}
241 files = self._readcontents(os.path.join(self.tmppath, dest))
240 files = self._readcontents(os.path.join(self.tmppath, dest))
242 for f in files:
241 for f in files:
243 s = os.path.join(src, f)
242 s = os.path.join(src, f)
244 d = os.path.join(dest, f)
243 d = os.path.join(dest, f)
245 changes.append(s)
244 changes.append(s)
246 changes.append(d)
245 changes.append(d)
247 copies[s] = d
246 copies[d] = s
248 return changes, copies
247 return changes, copies
249
248
250 def _obtainrevision(self, rev):
249 def _obtainrevision(self, rev):
251 self.ui.debug(_('obtaining revision %s...\n') % rev)
250 self.ui.debug(_('obtaining revision %s...\n') % rev)
252 output = self._execute('get', rev, self.tmppath)
251 output = self._execute('get', rev, self.tmppath)
253 self.checkexit(output)
252 self.checkexit(output)
254 self.ui.debug(_('analysing revision %s...\n') % rev)
253 self.ui.debug(_('analysing revision %s...\n') % rev)
255 files = self._readcontents(self.tmppath)
254 files = self._readcontents(self.tmppath)
256 self.changes[rev].add_files += files
255 self.changes[rev].add_files += files
257
256
258 def _stripbasepath(self, path):
257 def _stripbasepath(self, path):
259 if path.startswith('./'):
258 if path.startswith('./'):
260 return path[2:]
259 return path[2:]
261 return path
260 return path
262
261
263 def _parsecatlog(self, data, rev):
262 def _parsecatlog(self, data, rev):
264 try:
263 try:
265 catlog = self.catlogparser.parsestr(data)
264 catlog = self.catlogparser.parsestr(data)
266
265
267 # Commit date
266 # Commit date
268 self.changes[rev].date = util.datestr(
267 self.changes[rev].date = util.datestr(
269 util.strdate(catlog['Standard-date'],
268 util.strdate(catlog['Standard-date'],
270 '%Y-%m-%d %H:%M:%S'))
269 '%Y-%m-%d %H:%M:%S'))
271
270
272 # Commit author
271 # Commit author
273 self.changes[rev].author = self.recode(catlog['Creator'])
272 self.changes[rev].author = self.recode(catlog['Creator'])
274
273
275 # Commit description
274 # Commit description
276 self.changes[rev].summary = '\n\n'.join((catlog['Summary'],
275 self.changes[rev].summary = '\n\n'.join((catlog['Summary'],
277 catlog.get_payload()))
276 catlog.get_payload()))
278 self.changes[rev].summary = self.recode(self.changes[rev].summary)
277 self.changes[rev].summary = self.recode(self.changes[rev].summary)
279
278
280 # Commit revision origin when dealing with a branch or tag
279 # Commit revision origin when dealing with a branch or tag
281 if catlog.has_key('Continuation-of'):
280 if catlog.has_key('Continuation-of'):
282 self.changes[rev].continuationof = self.recode(catlog['Continuation-of'])
281 self.changes[rev].continuationof = self.recode(catlog['Continuation-of'])
283 except Exception, err:
282 except Exception, err:
284 raise util.Abort(_('could not parse cat-log of %s') % rev)
283 raise util.Abort(_('could not parse cat-log of %s') % rev)
285
284
286 def _parsechangeset(self, data, rev):
285 def _parsechangeset(self, data, rev):
287 for l in data:
286 for l in data:
288 l = l.strip()
287 l = l.strip()
289 # Added file (ignore added directory)
288 # Added file (ignore added directory)
290 if l.startswith('A') and not l.startswith('A/'):
289 if l.startswith('A') and not l.startswith('A/'):
291 file = self._stripbasepath(l[1:].strip())
290 file = self._stripbasepath(l[1:].strip())
292 if not self._exclude(file):
291 if not self._exclude(file):
293 self.changes[rev].add_files.append(file)
292 self.changes[rev].add_files.append(file)
294 # Deleted file (ignore deleted directory)
293 # Deleted file (ignore deleted directory)
295 elif l.startswith('D') and not l.startswith('D/'):
294 elif l.startswith('D') and not l.startswith('D/'):
296 file = self._stripbasepath(l[1:].strip())
295 file = self._stripbasepath(l[1:].strip())
297 if not self._exclude(file):
296 if not self._exclude(file):
298 self.changes[rev].del_files.append(file)
297 self.changes[rev].del_files.append(file)
299 # Modified binary file
298 # Modified binary file
300 elif l.startswith('Mb'):
299 elif l.startswith('Mb'):
301 file = self._stripbasepath(l[2:].strip())
300 file = self._stripbasepath(l[2:].strip())
302 if not self._exclude(file):
301 if not self._exclude(file):
303 self.changes[rev].mod_files.append(file)
302 self.changes[rev].mod_files.append(file)
304 # Modified link
303 # Modified link
305 elif l.startswith('M->'):
304 elif l.startswith('M->'):
306 file = self._stripbasepath(l[3:].strip())
305 file = self._stripbasepath(l[3:].strip())
307 if not self._exclude(file):
306 if not self._exclude(file):
308 self.changes[rev].mod_files.append(file)
307 self.changes[rev].mod_files.append(file)
309 # Modified file
308 # Modified file
310 elif l.startswith('M'):
309 elif l.startswith('M'):
311 file = self._stripbasepath(l[1:].strip())
310 file = self._stripbasepath(l[1:].strip())
312 if not self._exclude(file):
311 if not self._exclude(file):
313 self.changes[rev].mod_files.append(file)
312 self.changes[rev].mod_files.append(file)
314 # Renamed file (or link)
313 # Renamed file (or link)
315 elif l.startswith('=>'):
314 elif l.startswith('=>'):
316 files = l[2:].strip().split(' ')
315 files = l[2:].strip().split(' ')
317 if len(files) == 1:
316 if len(files) == 1:
318 files = l[2:].strip().split('\t')
317 files = l[2:].strip().split('\t')
319 src = self._stripbasepath(files[0])
318 src = self._stripbasepath(files[0])
320 dst = self._stripbasepath(files[1])
319 dst = self._stripbasepath(files[1])
321 if not self._exclude(src) and not self._exclude(dst):
320 if not self._exclude(src) and not self._exclude(dst):
322 self.changes[rev].ren_files[src] = dst
321 self.changes[rev].ren_files[src] = dst
323 # Conversion from file to link or from link to file (modified)
322 # Conversion from file to link or from link to file (modified)
324 elif l.startswith('ch'):
323 elif l.startswith('ch'):
325 file = self._stripbasepath(l[2:].strip())
324 file = self._stripbasepath(l[2:].strip())
326 if not self._exclude(file):
325 if not self._exclude(file):
327 self.changes[rev].mod_files.append(file)
326 self.changes[rev].mod_files.append(file)
328 # Renamed directory
327 # Renamed directory
329 elif l.startswith('/>'):
328 elif l.startswith('/>'):
330 dirs = l[2:].strip().split(' ')
329 dirs = l[2:].strip().split(' ')
331 if len(dirs) == 1:
330 if len(dirs) == 1:
332 dirs = l[2:].strip().split('\t')
331 dirs = l[2:].strip().split('\t')
333 src = self._stripbasepath(dirs[0])
332 src = self._stripbasepath(dirs[0])
334 dst = self._stripbasepath(dirs[1])
333 dst = self._stripbasepath(dirs[1])
335 if not self._exclude(src) and not self._exclude(dst):
334 if not self._exclude(src) and not self._exclude(dst):
336 self.changes[rev].ren_dirs[src] = dst
335 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