Show More
@@ -41,6 +41,15 b' except ImportError:' | |||||
41 | class SvnPathNotFound(Exception): |
|
41 | class SvnPathNotFound(Exception): | |
42 | pass |
|
42 | pass | |
43 |
|
43 | |||
|
44 | def revsplit(rev): | |||
|
45 | """Parse a revision string and return (uuid, path, revnum).""" | |||
|
46 | url, revnum = rev.rsplit('@', 1) | |||
|
47 | parts = url.split('/', 1) | |||
|
48 | mod = '' | |||
|
49 | if len(parts) > 1: | |||
|
50 | mod = '/' + parts[1] | |||
|
51 | return parts[0][4:], mod, int(revnum) | |||
|
52 | ||||
44 | def geturl(path): |
|
53 | def geturl(path): | |
45 | try: |
|
54 | try: | |
46 | return svn.client.url_from_path(svn.core.svn_path_canonicalize(path)) |
|
55 | return svn.client.url_from_path(svn.core.svn_path_canonicalize(path)) | |
@@ -286,7 +295,7 b' class svn_source(converter_source):' | |||||
286 | def setrevmap(self, revmap): |
|
295 | def setrevmap(self, revmap): | |
287 | lastrevs = {} |
|
296 | lastrevs = {} | |
288 | for revid in revmap.iterkeys(): |
|
297 | for revid in revmap.iterkeys(): | |
289 |
uuid, module, revnum = |
|
298 | uuid, module, revnum = revsplit(revid) | |
290 | lastrevnum = lastrevs.setdefault(module, revnum) |
|
299 | lastrevnum = lastrevs.setdefault(module, revnum) | |
291 | if revnum > lastrevnum: |
|
300 | if revnum > lastrevnum: | |
292 | lastrevs[module] = revnum |
|
301 | lastrevs[module] = revnum | |
@@ -381,7 +390,7 b' class svn_source(converter_source):' | |||||
381 | files, self.removed, copies = self.expandpaths(rev, paths, parents) |
|
390 | files, self.removed, copies = self.expandpaths(rev, paths, parents) | |
382 | else: |
|
391 | else: | |
383 | # Perform a full checkout on roots |
|
392 | # Perform a full checkout on roots | |
384 |
uuid, module, revnum = |
|
393 | uuid, module, revnum = revsplit(rev) | |
385 | entries = svn.client.ls(self.baseurl + urllib.quote(module), |
|
394 | entries = svn.client.ls(self.baseurl + urllib.quote(module), | |
386 | optrev(revnum), True, self.ctx) |
|
395 | optrev(revnum), True, self.ctx) | |
387 | files = [n for n, e in entries.iteritems() |
|
396 | files = [n for n, e in entries.iteritems() | |
@@ -403,7 +412,7 b' class svn_source(converter_source):' | |||||
403 |
|
412 | |||
404 | def getcommit(self, rev): |
|
413 | def getcommit(self, rev): | |
405 | if rev not in self.commits: |
|
414 | if rev not in self.commits: | |
406 |
uuid, module, revnum = |
|
415 | uuid, module, revnum = revsplit(rev) | |
407 | self.module = module |
|
416 | self.module = module | |
408 | self.reparent(module) |
|
417 | self.reparent(module) | |
409 | # We assume that: |
|
418 | # We assume that: | |
@@ -530,16 +539,6 b' class svn_source(converter_source):' | |||||
530 | def revnum(self, rev): |
|
539 | def revnum(self, rev): | |
531 | return int(rev.split('@')[-1]) |
|
540 | return int(rev.split('@')[-1]) | |
532 |
|
541 | |||
533 | def revsplit(self, rev): |
|
|||
534 | url, revnum = rev.rsplit('@', 1) |
|
|||
535 | revnum = int(revnum) |
|
|||
536 | parts = url.split('/', 1) |
|
|||
537 | uuid = parts.pop(0)[4:] |
|
|||
538 | mod = '' |
|
|||
539 | if parts: |
|
|||
540 | mod = '/' + parts[0] |
|
|||
541 | return uuid, mod, revnum |
|
|||
542 |
|
||||
543 | def latest(self, path, stop=0): |
|
542 | def latest(self, path, stop=0): | |
544 | """Find the latest revid affecting path, up to stop. It may return |
|
543 | """Find the latest revid affecting path, up to stop. It may return | |
545 | a revision in a different module, since a branch may be moved without |
|
544 | a revision in a different module, since a branch may be moved without | |
@@ -606,7 +605,7 b' class svn_source(converter_source):' | |||||
606 | changed, removed = set(), set() |
|
605 | changed, removed = set(), set() | |
607 | copies = {} |
|
606 | copies = {} | |
608 |
|
607 | |||
609 |
new_module, revnum = |
|
608 | new_module, revnum = revsplit(rev)[1:] | |
610 | if new_module != self.module: |
|
609 | if new_module != self.module: | |
611 | self.module = new_module |
|
610 | self.module = new_module | |
612 | self.reparent(self.module) |
|
611 | self.reparent(self.module) | |
@@ -623,7 +622,7 b' class svn_source(converter_source):' | |||||
623 | continue |
|
622 | continue | |
624 | # Copy sources not in parent revisions cannot be |
|
623 | # Copy sources not in parent revisions cannot be | |
625 | # represented, ignore their origin for now |
|
624 | # represented, ignore their origin for now | |
626 |
pmodule, prevnum = |
|
625 | pmodule, prevnum = revsplit(parents[0])[1:] | |
627 | if ent.copyfrom_rev < prevnum: |
|
626 | if ent.copyfrom_rev < prevnum: | |
628 | continue |
|
627 | continue | |
629 | copyfrom_path = self.getrelpath(ent.copyfrom_path, pmodule) |
|
628 | copyfrom_path = self.getrelpath(ent.copyfrom_path, pmodule) | |
@@ -634,7 +633,7 b' class svn_source(converter_source):' | |||||
634 | copies[self.recode(entrypath)] = self.recode(copyfrom_path) |
|
633 | copies[self.recode(entrypath)] = self.recode(copyfrom_path) | |
635 | elif kind == 0: # gone, but had better be a deleted *file* |
|
634 | elif kind == 0: # gone, but had better be a deleted *file* | |
636 | self.ui.debug("gone from %s\n" % ent.copyfrom_rev) |
|
635 | self.ui.debug("gone from %s\n" % ent.copyfrom_rev) | |
637 |
pmodule, prevnum = |
|
636 | pmodule, prevnum = revsplit(parents[0])[1:] | |
638 | parentpath = pmodule + "/" + entrypath |
|
637 | parentpath = pmodule + "/" + entrypath | |
639 | fromkind = self._checkpath(entrypath, prevnum, pmodule) |
|
638 | fromkind = self._checkpath(entrypath, prevnum, pmodule) | |
640 |
|
639 | |||
@@ -660,7 +659,7 b' class svn_source(converter_source):' | |||||
660 | if ent.action == 'R' and parents: |
|
659 | if ent.action == 'R' and parents: | |
661 | # If a directory is replacing a file, mark the previous |
|
660 | # If a directory is replacing a file, mark the previous | |
662 | # file as deleted |
|
661 | # file as deleted | |
663 |
pmodule, prevnum = |
|
662 | pmodule, prevnum = revsplit(parents[0])[1:] | |
664 | pkind = self._checkpath(entrypath, prevnum, pmodule) |
|
663 | pkind = self._checkpath(entrypath, prevnum, pmodule) | |
665 | if pkind == svn.core.svn_node_file: |
|
664 | if pkind == svn.core.svn_node_file: | |
666 | removed.add(self.recode(entrypath)) |
|
665 | removed.add(self.recode(entrypath)) | |
@@ -682,7 +681,7 b' class svn_source(converter_source):' | |||||
682 | continue |
|
681 | continue | |
683 | # Copy sources not in parent revisions cannot be |
|
682 | # Copy sources not in parent revisions cannot be | |
684 | # represented, ignore their origin for now |
|
683 | # represented, ignore their origin for now | |
685 |
pmodule, prevnum = |
|
684 | pmodule, prevnum = revsplit(parents[0])[1:] | |
686 | if ent.copyfrom_rev < prevnum: |
|
685 | if ent.copyfrom_rev < prevnum: | |
687 | continue |
|
686 | continue | |
688 | copyfrompath = self.getrelpath(ent.copyfrom_path, pmodule) |
|
687 | copyfrompath = self.getrelpath(ent.copyfrom_path, pmodule) | |
@@ -737,7 +736,7 b' class svn_source(converter_source):' | |||||
737 | # ent.copyfrom_rev may not be the actual last revision |
|
736 | # ent.copyfrom_rev may not be the actual last revision | |
738 | previd = self.latest(newpath, ent.copyfrom_rev) |
|
737 | previd = self.latest(newpath, ent.copyfrom_rev) | |
739 | if previd is not None: |
|
738 | if previd is not None: | |
740 |
prevmodule, prevnum = |
|
739 | prevmodule, prevnum = revsplit(previd)[1:] | |
741 | if prevnum >= self.startrev: |
|
740 | if prevnum >= self.startrev: | |
742 | parents = [previd] |
|
741 | parents = [previd] | |
743 | self.ui.note( |
|
742 | self.ui.note( | |
@@ -834,7 +833,7 b' class svn_source(converter_source):' | |||||
834 | raise IOError() |
|
833 | raise IOError() | |
835 | mode = '' |
|
834 | mode = '' | |
836 | try: |
|
835 | try: | |
837 |
new_module, revnum = |
|
836 | new_module, revnum = revsplit(rev)[1:] | |
838 | if self.module != new_module: |
|
837 | if self.module != new_module: | |
839 | self.module = new_module |
|
838 | self.module = new_module | |
840 | self.reparent(self.module) |
|
839 | self.reparent(self.module) |
General Comments 0
You need to be logged in to leave comments.
Login now