comparison hgext/convert/gnuarch.py @ 7582:3b2383c90034

convert/gnuarch: use fully qualified revisions There is no need loosing information in the conversion process. This could lead to wrong shamap mappings if different archives used the same 'version' naming.
author Edouard Gomez <ed.gomez@free.fr>
date Sun, 04 Jan 2009 02:36:48 +0100
parents 3742981341c1
children 77fec2d270ae
comparison
equal deleted inserted replaced
7581:3742981341c1 7582:3b2383c90034
64 self.tmppath = os.path.join(tempfile.gettempdir(), 64 self.tmppath = os.path.join(tempfile.gettempdir(),
65 'hg-%s' % version[1]) 65 'hg-%s' % version[1])
66 66
67 # Generate parents dictionary 67 # Generate parents dictionary
68 child = [] 68 child = []
69 output, status = self.runlines('revisions', self.treeversion) 69 output, status = self.runlines('revisions', '-f', self.treeversion)
70 self.checkexit(status, 'archive registered?') 70 self.checkexit(status, 'archive registered?')
71 for l in output: 71 for l in output:
72 rev = l.strip() 72 rev = l.strip()
73 self.changes[rev] = self.gnuarch_rev(rev) 73 self.changes[rev] = self.gnuarch_rev(rev)
74 74
154 cmdline = util.quotecommand(' '.join(cmdline)) 154 cmdline = util.quotecommand(' '.join(cmdline))
155 self.ui.debug(cmdline, '\n') 155 self.ui.debug(cmdline, '\n')
156 return os.system(cmdline) 156 return os.system(cmdline)
157 157
158 def _update(self, rev): 158 def _update(self, rev):
159 if rev == 'base-0': 159 if rev[-6:] == 'base-0':
160 # Initialise 'base-0' revision 160 # Initialise 'base-0' revision
161 self._obtainrevision(rev) 161 self._obtainrevision(rev)
162 else: 162 else:
163 self.ui.debug(_('applying revision %s...\n') % rev) 163 self.ui.debug(_('applying revision %s...\n') % rev)
164 revision = '%s--%s' % (self.treeversion, rev)
165 changeset, status = self.runlines('replay', '-d', self.tmppath, 164 changeset, status = self.runlines('replay', '-d', self.tmppath,
166 revision) 165 rev)
167 if status: 166 if status:
168 # Something went wrong while merging (baz or tla 167 # Something went wrong while merging (baz or tla
169 # issue?), get latest revision and try from there 168 # issue?), get latest revision and try from there
170 shutil.rmtree(self.tmppath, ignore_errors=True) 169 shutil.rmtree(self.tmppath, ignore_errors=True)
171 self._obtainrevision(rev) 170 self._obtainrevision(rev)
219 copies[s] = d 218 copies[s] = d
220 return changes, copies 219 return changes, copies
221 220
222 def _obtainrevision(self, rev): 221 def _obtainrevision(self, rev):
223 self.ui.debug(_('obtaining revision %s...\n') % rev) 222 self.ui.debug(_('obtaining revision %s...\n') % rev)
224 revision = '%s--%s' % (self.treeversion, rev) 223 output = self._execute('get', rev, self.tmppath)
225 output = self._execute('get', revision, self.tmppath)
226 self.checkexit(output) 224 self.checkexit(output)
227 self.ui.debug(_('analysing revision %s...\n') % rev) 225 self.ui.debug(_('analysing revision %s...\n') % rev)
228 files = self._readcontents(self.tmppath) 226 files = self._readcontents(self.tmppath)
229 self.changes[rev].add_files += files 227 self.changes[rev].add_files += files
230 228