##// END OF EJS Templates
convert/gnuarch: follow continuation-of revisions...
Edouard Gomez -
r7585:075b7ef0 default
parent child Browse files
Show More
@@ -63,32 +63,59 b' class gnuarch_source(converter_source, c'
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 self.ui.status(_('analyzing tree version %s...\n') % self.treeversion)
67
68 # Get name of temporary directory
66 # Get name of temporary directory
69 version = self.treeversion.split('/')
67 version = self.treeversion.split('/')
70 self.tmppath = os.path.join(tempfile.gettempdir(),
68 self.tmppath = os.path.join(tempfile.gettempdir(),
71 'hg-%s' % version[1])
69 'hg-%s' % version[1])
72
70
73 # Generate parents dictionary
71 # Generate parents dictionary
74 child = []
72 self.parents[None] = []
75 output, status = self.runlines('revisions', '-f', self.treeversion)
73 treeversion = self.treeversion
76 self.checkexit(status, 'archive registered?')
74 child = None
77 for l in output:
75 while treeversion:
78 rev = l.strip()
76 self.ui.status(_('analyzing tree version %s...\n') % treeversion)
79 self.changes[rev] = self.gnuarch_rev(rev)
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
90 for l in output:
91 rev = l.strip()
92 self.changes[rev] = self.gnuarch_rev(rev)
93 self.parents[rev] = []
80
94
81 # Read author, date and summary
95 # Read author, date and summary
82 catlog, status = self.run('cat-log', '-d', self.path, rev)
96 catlog, status = self.run('cat-log', '-d', self.path, rev)
83 if status:
97 if status:
84 catlog = self.run0('cat-archive-log', rev)
98 catlog = self.run0('cat-archive-log', rev)
85 self._parsecatlog(catlog, rev)
99 self._parsecatlog(catlog, rev)
100
101 # Populate the parents map
102 self.parents[child].append(rev)
86
103
87 self.parents[rev] = child
104 # Keep track of the current revision as the child of the next
88 child = [rev]
105 # revision scanned
89 if rev == self.rev:
106 child = rev
90 break
107
91 self.parents[None] = child
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])
113 break
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 def after(self):
120 def after(self):
94 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
121 self.ui.debug(_('cleaning up %s\n') % self.tmppath)
@@ -162,23 +189,19 b' class gnuarch_source(converter_source, c'
162 return os.system(cmdline)
189 return os.system(cmdline)
163
190
164 def _update(self, rev):
191 def _update(self, rev):
165 if rev[-6:] == 'base-0':
192 self.ui.debug(_('applying revision %s...\n') % rev)
166 # Initialise 'base-0' revision
193 changeset, status = self.runlines('replay', '-d', self.tmppath,
194 rev)
195 if status:
196 # Something went wrong while merging (baz or tla
197 # issue?), get latest revision and try from there
198 shutil.rmtree(self.tmppath, ignore_errors=True)
167 self._obtainrevision(rev)
199 self._obtainrevision(rev)
168 else:
200 else:
169 self.ui.debug(_('applying revision %s...\n') % rev)
201 old_rev = self.parents[rev][0]
170 changeset, status = self.runlines('replay', '-d', self.tmppath,
202 self.ui.debug(_('computing changeset between %s and %s...\n')
171 rev)
203 % (old_rev, rev))
172 if status:
204 self._parsechangeset(changeset, rev)
173 # Something went wrong while merging (baz or tla
174 # issue?), get latest revision and try from there
175 shutil.rmtree(self.tmppath, ignore_errors=True)
176 self._obtainrevision(rev)
177 else:
178 old_rev = self.parents[rev][0]
179 self.ui.debug(_('computing changeset between %s and %s...\n')
180 % (old_rev, rev))
181 self._parsechangeset(changeset, rev)
182
205
183 def _getfile(self, name, rev):
206 def _getfile(self, name, rev):
184 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
207 mode = os.lstat(os.path.join(self.tmppath, name)).st_mode
General Comments 0
You need to be logged in to leave comments. Login now