##// END OF EJS Templates
convert/gnuarch: follow continuation-of revisions...
Edouard Gomez -
r7585:075b7ef0 default
parent child Browse files
Show More
@@ -63,20 +63,34 b' class gnuarch_source(converter_source, c'
63 63 output = self.run0('tree-version', '-d', self.path)
64 64 self.treeversion = output.strip()
65 65
66 self.ui.status(_('analyzing tree version %s...\n') % self.treeversion)
67
68 66 # Get name of temporary directory
69 67 version = self.treeversion.split('/')
70 68 self.tmppath = os.path.join(tempfile.gettempdir(),
71 69 'hg-%s' % version[1])
72 70
73 71 # Generate parents dictionary
74 child = []
75 output, status = self.runlines('revisions', '-f', self.treeversion)
76 self.checkexit(status, 'archive registered?')
72 self.parents[None] = []
73 treeversion = self.treeversion
74 child = None
75 while treeversion:
76 self.ui.status(_('analyzing tree version %s...\n') % treeversion)
77
78 archive = treeversion.split('/')[0]
79 if archive not in self.archives:
80 self.ui.status(_('tree analysis stopped because it points to an unregistered archive %s...\n') % archive)
81 break
82
83 # Get the complete list of revisions for that tree version
84 output, status = self.runlines('revisions', '-r', '-f', treeversion)
85 self.checkexit(status, 'failed retrieveing revisions for %s' % treeversion)
86
87 # No new iteration unless a revision has a continuation-of header
88 treeversion = None
89
77 90 for l in output:
78 91 rev = l.strip()
79 92 self.changes[rev] = self.gnuarch_rev(rev)
93 self.parents[rev] = []
80 94
81 95 # Read author, date and summary
82 96 catlog, status = self.run('cat-log', '-d', self.path, rev)
@@ -84,11 +98,24 b' class gnuarch_source(converter_source, c'
84 98 catlog = self.run0('cat-archive-log', rev)
85 99 self._parsecatlog(catlog, rev)
86 100
87 self.parents[rev] = child
88 child = [rev]
89 if rev == self.rev:
101 # Populate the parents map
102 self.parents[child].append(rev)
103
104 # Keep track of the current revision as the child of the next
105 # revision scanned
106 child = rev
107
108 # Check if we have to follow the usual incremental history
109 # or if we have to 'jump' to a different treeversion given
110 # by the continuation-of header.
111 if self.changes[rev].continuationof:
112 treeversion = '--'.join(self.changes[rev].continuationof.split('--')[:-1])
90 113 break
91 self.parents[None] = child
114
115 # If we reached a base-0 revision w/o any continuation-of
116 # header, it means the tree history ends here.
117 if rev[-6:] == 'base-0':
118 break
92 119
93 120 def after(self):
94 121 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
@@ -162,10 +189,6 b' class gnuarch_source(converter_source, c'
162 189 return os.system(cmdline)
163 190
164 191 def _update(self, rev):
165 if rev[-6:] == 'base-0':
166 # Initialise 'base-0' revision
167 self._obtainrevision(rev)
168 else:
169 192 self.ui.debug(_('applying revision %s...\n') % rev)
170 193 changeset, status = self.runlines('replay', '-d', self.tmppath,
171 194 rev)
General Comments 0
You need to be logged in to leave comments. Login now