Mercurial > hg
comparison hgext/convert/__init__.py @ 5173:6b4c332f241b
convert: hg: optionally create branches as clones
If convert.hg.clonebranches is set, branches will be created as clones of
their parent revisions. All clones will be subdirectories of the
destination path.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Wed, 15 Aug 2007 13:21:23 -0700 |
parents | d4fa6bafc43a |
children | 33015dac5df5 |
comparison
equal
deleted
inserted
replaced
5172:f53d97d651f4 | 5173:6b4c332f241b |
---|---|
192 commit = self.commitcache[rev] | 192 commit = self.commitcache[rev] |
193 do_copies = hasattr(self.dest, 'copyfile') | 193 do_copies = hasattr(self.dest, 'copyfile') |
194 filenames = [] | 194 filenames = [] |
195 | 195 |
196 files, copies = self.source.getchanges(rev) | 196 files, copies = self.source.getchanges(rev) |
197 parents = [self.map[r] for r in commit.parents] | |
198 if commit.parents: | |
199 pbranch = self.commitcache[commit.parents[0]].branch | |
200 else: | |
201 pbranch = None | |
202 self.dest.setbranch(commit.branch, pbranch, parents) | |
197 for f, v in files: | 203 for f, v in files: |
198 newf = self.mapfile(f) | 204 newf = self.mapfile(f) |
199 if not newf: | 205 if not newf: |
200 continue | 206 continue |
201 filenames.append(newf) | 207 filenames.append(newf) |
211 copyf = self.mapfile(copies[f]) | 217 copyf = self.mapfile(copies[f]) |
212 if copyf: | 218 if copyf: |
213 # Merely marks that a copy happened. | 219 # Merely marks that a copy happened. |
214 self.dest.copyfile(copyf, newf) | 220 self.dest.copyfile(copyf, newf) |
215 | 221 |
216 parents = [self.map[r] for r in commit.parents] | |
217 newnode = self.dest.putcommit(filenames, parents, commit) | 222 newnode = self.dest.putcommit(filenames, parents, commit) |
218 self.mapentry(rev, newnode) | 223 self.mapentry(rev, newnode) |
219 | 224 |
220 def convert(self): | 225 def convert(self): |
221 try: | 226 try: |