Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/convert/subversion.py @ 4793:ea618c5934f3
convert: svn: get parent for branch creation events
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Tue, 03 Jul 2007 15:34:30 -0700 |
parents | 1f10a6cccdb5 |
children | 26857a6f9dd0 |
comparison
equal
deleted
inserted
replaced
4792:1f10a6cccdb5 | 4793:ea618c5934f3 |
---|---|
122 | 122 |
123 self.last_changed = self.latest(self.module, latest) | 123 self.last_changed = self.latest(self.module, latest) |
124 | 124 |
125 self.head = self.rev(self.last_changed) | 125 self.head = self.rev(self.last_changed) |
126 | 126 |
127 def rev(self, revnum): | 127 def rev(self, revnum, module=None): |
128 return (u"svn:%s%s@%s" % (self.uuid, self.module, revnum)).decode(self.encoding) | 128 if not module: |
129 module = self.module | |
130 return (u"svn:%s%s@%s" % (self.uuid, module, revnum)).decode(self.encoding) | |
129 | 131 |
130 def revnum(self, rev): | 132 def revnum(self, rev): |
131 return int(rev.split('@')[-1]) | 133 return int(rev.split('@')[-1]) |
132 | 134 |
133 def revsplit(self, rev): | 135 def revsplit(self, rev): |
241 | 243 |
242 copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. | 244 copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. |
243 copies = {} | 245 copies = {} |
244 entries = [] | 246 entries = [] |
245 rev = self.rev(revnum) | 247 rev = self.rev(revnum) |
248 parents = [] | |
246 try: | 249 try: |
247 branch = self.module.split("/")[-1] | 250 branch = self.module.split("/")[-1] |
248 if branch == 'trunk': | 251 if branch == 'trunk': |
249 branch = '' | 252 branch = '' |
250 except IndexError: | 253 except IndexError: |
251 branch = None | 254 branch = None |
252 | 255 |
253 for path in orig_paths: | 256 for path in orig_paths: |
254 # self.ui.write("path %s\n" % path) | 257 # self.ui.write("path %s\n" % path) |
255 if path == self.module: # Follow branching back in history | 258 if path == self.module: # Follow branching back in history |
259 import pdb | |
260 pdb.set_trace() | |
256 ent = orig_paths[path] | 261 ent = orig_paths[path] |
257 if ent: | 262 if ent: |
258 if ent.copyfrom_path: | 263 if ent.copyfrom_path: |
259 self.modulemap[ent.copyfrom_rev] = ent.copyfrom_path | 264 self.modulemap[ent.copyfrom_rev] = ent.copyfrom_path |
265 parents = [self.rev(ent.copyfrom_rev, ent.copyfrom_path)] | |
260 else: | 266 else: |
261 self.ui.debug("No copyfrom path, don't know what to do.\n") | 267 self.ui.debug("No copyfrom path, don't know what to do.\n") |
262 # Maybe it was added and there is no more history. | 268 # Maybe it was added and there is no more history. |
263 entrypath = get_entry_from_path(path, module=self.module) | 269 entrypath = get_entry_from_path(path, module=self.module) |
264 # self.ui.write("entrypath %s\n" % entrypath) | 270 # self.ui.write("entrypath %s\n" % entrypath) |
266 # Outside our area of interest | 272 # Outside our area of interest |
267 self.ui.debug("boring@%s: %s\n" % (revnum, path)) | 273 self.ui.debug("boring@%s: %s\n" % (revnum, path)) |
268 continue | 274 continue |
269 entry = entrypath.decode(self.encoding) | 275 entry = entrypath.decode(self.encoding) |
270 ent = orig_paths[path] | 276 ent = orig_paths[path] |
271 if not entrypath: | |
272 # TODO: branch creation event | |
273 pass | |
274 | 277 |
275 kind = svn.ra.check_path(self.ra, entrypath, revnum) | 278 kind = svn.ra.check_path(self.ra, entrypath, revnum) |
276 if kind == svn.core.svn_node_file: | 279 if kind == svn.core.svn_node_file: |
277 if ent.copyfrom_path: | 280 if ent.copyfrom_path: |
278 copyfrom_path = get_entry_from_path(ent.copyfrom_path) | 281 copyfrom_path = get_entry_from_path(ent.copyfrom_path) |
431 author = author and self.recode(author) or '' | 434 author = author and self.recode(author) or '' |
432 | 435 |
433 cset = commit(author=author, | 436 cset = commit(author=author, |
434 date=util.datestr(date), | 437 date=util.datestr(date), |
435 desc=log, | 438 desc=log, |
436 parents=[], | 439 parents=parents, |
437 copies=copies, | 440 copies=copies, |
438 branch=branch) | 441 branch=branch) |
439 | 442 |
440 if self.child_cset and self.child_rev != rev: | 443 if self.child_cset and self.child_rev != rev: |
441 self.child_cset.parents = [rev] | 444 self.child_cset.parents = [rev] |