Mercurial > hg
annotate hgext/convert/subversion.py @ 4775:739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 02 Jul 2007 07:54:51 -0700 |
parents | d305852a5ec8 |
children | 03844af5ebcd |
rev | line source |
---|---|
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
1 # Subversion 1.4/1.5 Python API backend |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
2 # |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
3 # Copyright(C) 2007 Daniel Holth et al |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
4 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
5 import pprint |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
6 import locale |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
7 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
8 from mercurial import util |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
9 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
10 # Subversion stuff. Works best with very recent Python SVN bindings |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
11 # e.g. SVN 1.5 or backports. Thanks to the bzr folks for enhancing |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
12 # these bindings. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
13 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
14 from cStringIO import StringIO |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
15 |
4766
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
16 from common import NoRepo, commit, converter_source |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
17 |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
18 try: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
19 from svn.core import SubversionException, Pool |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
20 import svn.core |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
21 import svn.ra |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
22 import svn.delta |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
23 import svn |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
24 import transport |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
25 except ImportError: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
26 pass |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
27 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
28 class CompatibilityException(Exception): pass |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
29 |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
30 LOG_BATCH_SIZE = 50 |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
31 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
32 class svn_entry(object): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
33 """Emulate a Subversion path change.""" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
34 __slots__ = ['path', 'copyfrom_path', 'copyfrom_rev', 'action'] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
35 def __init__(self, entry): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
36 self.copyfrom_path = entry.copyfrom_path |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
37 self.copyfrom_rev = entry.copyfrom_rev |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
38 self.action = entry.action |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
39 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
40 def __str__(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
41 return "%s %s %s" % (self.action, self.copyfrom_path, self.copyfrom_rev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
42 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
43 def __repr__(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
44 return self.__str__() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
45 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
46 class svn_paths(object): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
47 """Emulate a Subversion ordered dictionary of changed paths.""" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
48 __slots__ = ['values', 'order'] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
49 def __init__(self, orig_paths): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
50 self.order = [] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
51 self.values = {} |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
52 if hasattr(orig_paths, 'keys'): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
53 self.order = sorted(orig_paths.keys()) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
54 self.values.update(orig_paths) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
55 return |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
56 if not orig_paths: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
57 return |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
58 for path in orig_paths: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
59 self.order.append(path) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
60 self.values[path] = svn_entry(orig_paths[path]) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
61 self.order.sort() # maybe the order it came in isn't so great... |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
62 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
63 def __iter__(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
64 return iter(self.order) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
65 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
66 def __getitem__(self, key): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
67 return self.values[key] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
68 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
69 def __str__(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
70 s = "{\n" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
71 for path in self.order: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
72 s += "'%s': %s,\n" % (path, self.values[path]) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
73 s += "}" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
74 return s |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
75 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
76 def __repr__(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
77 return self.__str__() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
78 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
79 # SVN conversion code stolen from bzr-svn and tailor |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
80 class convert_svn(converter_source): |
4766
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
81 def __init__(self, ui, url, rev=None): |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
82 try: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
83 SubversionException |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
84 except NameError: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
85 msg = 'subversion python bindings could not be loaded\n' |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
86 ui.warn(msg) |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
87 raise NoRepo(msg) |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
88 |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
89 self.ui = ui |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
90 self.encoding = locale.getpreferredencoding() |
4766
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
91 latest = None |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
92 if rev: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
93 try: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
94 latest = int(rev) |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
95 except ValueError: |
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
96 raise util.Abort('svn: revision %s is not an integer' % rev) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
97 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
98 # Support file://path@rev syntax. Useful e.g. to convert |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
99 # deleted branches. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
100 url, latest = url.rsplit("@", 1) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
101 latest = int(latest) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
102 except ValueError, e: |
4766
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
103 pass |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
104 self.url = url |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
105 self.encoding = 'UTF-8' # Subversion is always nominal UTF-8 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
106 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
107 self.transport = transport.SvnRaTransport(url = url) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
108 self.ra = self.transport.ra |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
109 self.base = svn.ra.get_repos_root(self.ra) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
110 self.module = self.url[len(self.base):] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
111 self.modulemap = {} # revision, module |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
112 self.commits = {} |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
113 self.files = {} |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
114 self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
115 except SubversionException, e: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
116 raise NoRepo("couldn't open SVN repo %s" % url) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
117 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
118 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
119 self.get_blacklist() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
120 except IOError, e: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
121 pass |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
122 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
123 if not latest: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
124 latest = svn.ra.get_latest_revnum(self.ra) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
125 dirent = svn.ra.stat(self.ra, self.module, latest) |
4773
cfbce076f2de
convert: svn: abort if module stat fails
Brendan Cully <brendan@kublai.com>
parents:
4772
diff
changeset
|
126 if not dirent: |
cfbce076f2de
convert: svn: abort if module stat fails
Brendan Cully <brendan@kublai.com>
parents:
4772
diff
changeset
|
127 raise util.Abort('module %s not found in revision %d' % (self.module, latest)) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
128 self.last_changed = dirent.created_rev |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
129 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
130 self.head = self.rev(self.last_changed) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
131 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
132 def rev(self, revnum): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
133 return (u"svn:%s%s@%s" % (self.uuid, self.module, revnum)).decode(self.encoding) |
4774
d305852a5ec8
convert: svn: add revnum() to convert rev to revnum
Brendan Cully <brendan@kublai.com>
parents:
4773
diff
changeset
|
134 |
d305852a5ec8
convert: svn: add revnum() to convert rev to revnum
Brendan Cully <brendan@kublai.com>
parents:
4773
diff
changeset
|
135 def revnum(self, rev): |
d305852a5ec8
convert: svn: add revnum() to convert rev to revnum
Brendan Cully <brendan@kublai.com>
parents:
4773
diff
changeset
|
136 return int(rev.split('@')[-1]) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
137 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
138 def get_blacklist(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
139 """Avoid certain revision numbers. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
140 It is not uncommon for two nearby revisions to cancel each other |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
141 out, e.g. 'I copied trunk into a subdirectory of itself instead |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
142 of making a branch'. The converted repository is significantly |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
143 smaller if we ignore such revisions.""" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
144 self.blacklist = set() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
145 blacklist = self.blacklist |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
146 for line in file("blacklist.txt", "r"): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
147 if not line.startswith("#"): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
148 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
149 svn_rev = int(line.strip()) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
150 blacklist.add(svn_rev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
151 except ValueError, e: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
152 pass # not an integer or a comment |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
153 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
154 def is_blacklisted(self, svn_rev): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
155 return svn_rev in self.blacklist |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
156 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
157 def reparent(self, module): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
158 svn_url = self.base + module |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
159 self.ui.debug("reparent to %s\n" % svn_url.encode(self.encoding)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
160 svn.ra.reparent(self.ra, svn_url.encode(self.encoding)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
161 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
162 def _fetch_revisions(self, from_revnum = 0, to_revnum = 347, pb=None): |
4775
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
163 # batching is broken for branches |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
164 to_revnum = 0 |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
165 if not hasattr(self, 'child_rev'): |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
166 self.child_rev = from_revnum |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
167 self.child_cset = self.commits.get(self.child_rev) |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
168 else: |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
169 self.commits[self.child_rev] = self.child_cset |
4775
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
170 # batching broken |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
171 return |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
172 # if the branch was created in the middle of the last batch, |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
173 # svn log will complain that the path doesn't exist in this batch |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
174 # so we roll the parser back to the last revision where this branch appeared |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
175 revnum = self.revnum(self.child_rev) |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
176 if revnum > from_revnum: |
739fd34f5d66
convert: svn: disable batched fetch - get the whole log immediately
Brendan Cully <brendan@kublai.com>
parents:
4774
diff
changeset
|
177 from_revnum = revnum |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
178 |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
179 self.ui.debug('Fetching revisions %d to %d\n' % (from_revnum, to_revnum)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
180 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
181 def get_entry_from_path(path, module=self.module): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
182 # Given the repository url of this wc, say |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
183 # "http://server/plone/CMFPlone/branches/Plone-2_0-branch" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
184 # extract the "entry" portion (a relative path) from what |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
185 # svn log --xml says, ie |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
186 # "/CMFPlone/branches/Plone-2_0-branch/tests/PloneTestCase.py" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
187 # that is to say "tests/PloneTestCase.py" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
188 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
189 if path.startswith(module): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
190 relative = path[len(module):] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
191 if relative.startswith('/'): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
192 return relative[1:] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
193 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
194 return relative |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
195 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
196 # The path is outside our tracked tree... |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
197 self.ui.debug('Ignoring %r since it is not under %r\n' % (path, module)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
198 return None |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
199 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
200 received = [] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
201 def rcvr(*arg, **args): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
202 orig_paths, revnum, author, date, message, pool = arg |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
203 new_orig_paths = svn_paths(orig_paths) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
204 rcvr2(new_orig_paths, revnum, author, date, message, pool) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
205 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
206 def rcvr2(orig_paths, revnum, author, date, message, pool, better_paths = None): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
207 if not self.is_blacklisted(revnum): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
208 received.append((orig_paths, revnum, author, date, message)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
209 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
210 def after_received(orig_paths, revnum, author, date, message): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
211 if revnum in self.modulemap: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
212 new_module = self.modulemap[revnum] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
213 if new_module != self.module: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
214 self.module = new_module |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
215 self.reparent(self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
216 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
217 copyfrom = {} # Map of entrypath, revision for finding source of deleted revisions. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
218 copies = {} |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
219 entries = [] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
220 self.ui.debug("Parsing revision %d\n" % revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
221 if orig_paths is not None: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
222 rev = self.rev(revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
223 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
224 branch = self.module.split("/")[-1] |
4771
e2292928cbe6
convert: svn: convert branch trunk to default
Brendan Cully <brendan@kublai.com>
parents:
4770
diff
changeset
|
225 if branch == 'trunk': |
e2292928cbe6
convert: svn: convert branch trunk to default
Brendan Cully <brendan@kublai.com>
parents:
4770
diff
changeset
|
226 branch = '' |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
227 except IndexError: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
228 branch = None |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
229 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
230 for path in orig_paths: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
231 # self.ui.write("path %s\n" % path) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
232 if path == self.module: # Follow branching back in history |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
233 ent = orig_paths[path] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
234 if ent: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
235 if ent.copyfrom_path: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
236 self.modulemap[ent.copyfrom_rev] = ent.copyfrom_path |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
237 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
238 self.ui.debug("No copyfrom path, don't know what to do.\n") |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
239 # Maybe it was added and there is no more history. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
240 entrypath = get_entry_from_path(path, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
241 # self.ui.write("entrypath %s\n" % entrypath) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
242 if not entrypath: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
243 # Outside our area of interest |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
244 self.ui.debug("boring@%s: %s\n" % (revnum, path)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
245 continue |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
246 entry = entrypath.decode(self.encoding) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
247 ent = orig_paths[path] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
248 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
249 kind = svn.ra.check_path(self.ra, entrypath, revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
250 if kind == svn.core.svn_node_file: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
251 if ent.copyfrom_path: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
252 copyfrom_path = get_entry_from_path(ent.copyfrom_path) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
253 if copyfrom_path: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
254 self.ui.debug("Copied to %s from %s@%s\n" % (entry, copyfrom_path, ent.copyfrom_rev)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
255 # It's probably important for hg that the source |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
256 # exists in the revision's parent, not just the |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
257 # ent.copyfrom_rev |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
258 fromkind = svn.ra.check_path(self.ra, copyfrom_path, ent.copyfrom_rev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
259 if fromkind != 0: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
260 copies[self.recode(entry)] = self.recode(copyfrom_path) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
261 entries.append(self.recode(entry)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
262 elif kind == 0: # gone, but had better be a deleted *file* |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
263 self.ui.debug("gone from %s\n" % ent.copyfrom_rev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
264 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
265 fromrev = revnum - 1 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
266 # might always need to be revnum - 1 in these 3 lines? |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
267 old_module = self.modulemap.get(fromrev, self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
268 basepath = old_module + "/" + get_entry_from_path(path, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
269 entrypath = old_module + "/" + get_entry_from_path(path, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
270 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
271 def lookup_parts(p): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
272 rc = None |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
273 parts = p.split("/") |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
274 for i in range(len(parts)): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
275 part = "/".join(parts[:i]) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
276 info = part, copyfrom.get(part, None) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
277 if info[1] is not None: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
278 self.ui.debug("Found parent directory %s\n" % info) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
279 rc = info |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
280 return rc |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
281 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
282 self.ui.debug("base, entry %s %s\n" % (basepath, entrypath)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
283 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
284 frompath, froment = lookup_parts(entrypath) or (None, revnum - 1) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
285 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
286 # need to remove fragment from lookup_parts and replace with copyfrom_path |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
287 if frompath is not None: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
288 self.ui.debug("munge-o-matic\n") |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
289 self.ui.debug(entrypath + '\n') |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
290 self.ui.debug(entrypath[len(frompath):] + '\n') |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
291 entrypath = froment.copyfrom_path + entrypath[len(frompath):] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
292 fromrev = froment.copyfrom_rev |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
293 self.ui.debug("Info: %s %s %s %s\n" % (frompath, froment, ent, entrypath)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
294 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
295 fromkind = svn.ra.check_path(self.ra, entrypath, fromrev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
296 if fromkind == svn.core.svn_node_file: # a deleted file |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
297 entries.append(self.recode(entry)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
298 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
299 # print "Deleted/moved non-file:", revnum, path, ent |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
300 # children = self._find_children(path, revnum - 1) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
301 # print "find children %s@%d from %d action %s" % (path, revnum, ent.copyfrom_rev, ent.action) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
302 # Sometimes this is tricky. For example: in |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
303 # The Subversion Repository revision 6940 a dir |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
304 # was copied and one of its files was deleted |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
305 # from the new location in the same commit. This |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
306 # code can't deal with that yet. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
307 if ent.action == 'C': |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
308 children = self._find_children(path, fromrev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
309 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
310 oroot = entrypath.strip('/') |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
311 nroot = path.strip('/') |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
312 children = self._find_children(oroot, fromrev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
313 children = [s.replace(oroot,nroot) for s in children] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
314 # Mark all [files, not directories] as deleted. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
315 for child in children: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
316 # Can we move a child directory and its |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
317 # parent in the same commit? (probably can). Could |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
318 # cause problems if instead of revnum -1, |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
319 # we have to look in (copyfrom_path, revnum - 1) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
320 entrypath = get_entry_from_path("/" + child, module=old_module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
321 if entrypath: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
322 entry = self.recode(entrypath.decode(self.encoding)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
323 if entry in copies: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
324 # deleted file within a copy |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
325 del copies[entry] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
326 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
327 entries.append(entry) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
328 elif kind == svn.core.svn_node_dir: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
329 # Should probably synthesize normal file entries |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
330 # and handle as above to clean up copy/rename handling. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
331 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
332 # If the directory just had a prop change, |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
333 # then we shouldn't need to look for its children. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
334 # Also this could create duplicate entries. Not sure |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
335 # whether this will matter. Maybe should make entries a set. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
336 # print "Changed directory", revnum, path, ent.action, ent.copyfrom_path, ent.copyfrom_rev |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
337 # This will fail if a directory was copied |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
338 # from another branch and then some of its files |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
339 # were deleted in the same transaction. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
340 children = self._find_children(path, revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
341 children.sort() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
342 for child in children: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
343 # Can we move a child directory and its |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
344 # parent in the same commit? (probably can). Could |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
345 # cause problems if instead of revnum -1, |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
346 # we have to look in (copyfrom_path, revnum - 1) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
347 entrypath = get_entry_from_path("/" + child, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
348 # print child, self.module, entrypath |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
349 if entrypath: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
350 # Need to filter out directories here... |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
351 kind = svn.ra.check_path(self.ra, entrypath, revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
352 if kind != svn.core.svn_node_dir: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
353 entries.append(self.recode(entrypath)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
354 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
355 # Copies here (must copy all from source) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
356 # Probably not a real problem for us if |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
357 # source does not exist |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
358 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
359 # Can do this with the copy command "hg copy" |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
360 # if ent.copyfrom_path: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
361 # copyfrom_entry = get_entry_from_path(ent.copyfrom_path.decode(self.encoding), |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
362 # module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
363 # copyto_entry = entrypath |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
364 # |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
365 # print "copy directory", copyfrom_entry, 'to', copyto_entry |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
366 # |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
367 # copies.append((copyfrom_entry, copyto_entry)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
368 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
369 if ent.copyfrom_path: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
370 copyfrom_path = ent.copyfrom_path.decode(self.encoding) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
371 copyfrom_entry = get_entry_from_path(copyfrom_path, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
372 if copyfrom_entry: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
373 copyfrom[path] = ent |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
374 self.ui.debug("mark %s came from %s\n" % (path, copyfrom[path])) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
375 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
376 # Good, /probably/ a regular copy. Really should check |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
377 # to see whether the parent revision actually contains |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
378 # the directory in question. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
379 children = self._find_children(self.recode(copyfrom_path), ent.copyfrom_rev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
380 children.sort() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
381 for child in children: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
382 entrypath = get_entry_from_path("/" + child, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
383 if entrypath: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
384 entry = entrypath.decode(self.encoding) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
385 # print "COPY COPY From", copyfrom_entry, entry |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
386 copyto_path = path + entry[len(copyfrom_entry):] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
387 copyto_entry = get_entry_from_path(copyto_path, module=self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
388 # print "COPY", entry, "COPY To", copyto_entry |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
389 copies[self.recode(copyto_entry)] = self.recode(entry) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
390 # copy from quux splort/quuxfile |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
391 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
392 self.modulemap[revnum] = self.module # track backwards in time |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
393 # a list of (filename, id) where id lets us retrieve the file. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
394 # eg in git, id is the object hash. for svn it'll be the |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
395 self.files[rev] = zip(entries, [rev] * len(entries)) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
396 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
397 # Example SVN datetime. Includes microseconds. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
398 # ISO-8601 conformant |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
399 # '2007-01-04T17:35:00.902377Z' |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
400 date = util.parsedate(date[:18] + " UTC", ["%Y-%m-%dT%H:%M:%S"]) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
401 |
4766
95cbb6b74790
convert: activate subversion engine
Brendan Cully <brendan@kublai.com>
parents:
4765
diff
changeset
|
402 log = message and self.recode(message) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
403 author = author and self.recode(author) or '' |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
404 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
405 cset = commit(author=author, |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
406 date=util.datestr(date), |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
407 desc=log, |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
408 parents=[], |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
409 copies=copies, |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
410 branch=branch) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
411 |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
412 if self.child_cset and self.child_rev != rev: |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
413 self.child_cset.parents = [rev] |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
414 self.commits[self.child_rev] = self.child_cset |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
415 self.child_cset = cset |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
416 self.child_rev = rev |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
417 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
418 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
419 discover_changed_paths = True |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
420 strict_node_history = False |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
421 svn.ra.get_log(self.ra, [self.module], from_revnum, to_revnum, |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
422 0, discover_changed_paths, strict_node_history, rcvr) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
423 for args in received: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
424 after_received(*args) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
425 self.last_revnum = to_revnum |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
426 except SubversionException, (_, num): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
427 if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
428 raise NoSuchRevision(branch=self, |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
429 revision="Revision number %d" % to_revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
430 raise |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
431 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
432 def getheads(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
433 # svn-url@rev |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
434 # Not safe if someone committed: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
435 self.heads = [self.head] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
436 # print self.commits.keys() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
437 return self.heads |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
438 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
439 def _getfile(self, file, rev): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
440 io = StringIO() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
441 # TODO: ra.get_file transmits the whole file instead of diffs. |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
442 mode = '' |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
443 try: |
4774
d305852a5ec8
convert: svn: add revnum() to convert rev to revnum
Brendan Cully <brendan@kublai.com>
parents:
4773
diff
changeset
|
444 revnum = self.revnum(rev) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
445 if self.module != self.modulemap[revnum]: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
446 self.module = self.modulemap[revnum] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
447 self.reparent(self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
448 info = svn.ra.get_file(self.ra, file, revnum, io) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
449 if isinstance(info, list): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
450 info = info[-1] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
451 mode = ("svn:executable" in info) and 'x' or '' |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
452 mode = ("svn:special" in info) and 'l' or mode |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
453 except SubversionException, e: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
454 notfound = (svn.core.SVN_ERR_FS_NOT_FOUND, |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
455 svn.core.SVN_ERR_RA_DAV_PATH_NOT_FOUND) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
456 if e.apr_err in notfound: # File not found |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
457 raise IOError() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
458 raise |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
459 data = io.getvalue() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
460 if mode == 'l': |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
461 link_prefix = "link " |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
462 if data.startswith(link_prefix): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
463 data = data[len(link_prefix):] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
464 return data, mode |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
465 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
466 def getfile(self, file, rev): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
467 data, mode = self._getfile(file, rev) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
468 self.modecache[(file, rev)] = mode |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
469 return data |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
470 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
471 def getmode(self, file, rev): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
472 return self.modecache[(file, rev)] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
473 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
474 def getchanges(self, rev): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
475 self.modecache = {} |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
476 files = self.files[rev] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
477 cl = files |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
478 cl.sort() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
479 return cl |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
480 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
481 def getcommit(self, rev): |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
482 if rev not in self.commits: |
4774
d305852a5ec8
convert: svn: add revnum() to convert rev to revnum
Brendan Cully <brendan@kublai.com>
parents:
4773
diff
changeset
|
483 revnum = self.revnum(rev) |
4772
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
484 minrev = revnum - LOG_BATCH_SIZE > 0 and revnum - LOG_BATCH_SIZE or 0 |
69548a9d9796
convert: fetch svn changes on demand (in batches)
Brendan Cully <brendan@kublai.com>
parents:
4771
diff
changeset
|
485 self._fetch_revisions(from_revnum=revnum, to_revnum=minrev) |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
486 return self.commits[rev] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
487 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
488 def gettags(self): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
489 return [] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
490 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
491 def _find_children(self, path, revnum): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
492 path = path.strip("/") |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
493 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
494 def _find_children_fallback(path, revnum): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
495 # SWIG python bindings for getdir are broken up to at least 1.4.3 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
496 if not hasattr(self, 'client_ctx'): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
497 self.client_ctx = svn.client.create_context() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
498 optrev = svn.core.svn_opt_revision_t() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
499 optrev.kind = svn.core.svn_opt_revision_number |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
500 optrev.value.number = revnum |
4770
4526ef8c47b2
convert: svn: fix fallback directory listing code when importing a submodule
Brendan Cully <brendan@kublai.com>
parents:
4769
diff
changeset
|
501 rpath = '/'.join([self.base, path]).strip('/') |
4765
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
502 return ['%s/%s' % (path, x) for x in svn.client.ls(rpath, optrev, True, self.client_ctx).keys()] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
503 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
504 if hasattr(self, '_find_children_fallback'): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
505 return _find_children_fallback(path, revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
506 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
507 self.reparent("/" + path) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
508 pool = Pool() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
509 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
510 children = [] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
511 def find_children_inner(children, path, revnum = revnum): |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
512 if hasattr(svn.ra, 'get_dir2'): # Since SVN 1.4 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
513 fields = 0xffffffff # Binding does not provide SVN_DIRENT_ALL |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
514 getdir = svn.ra.get_dir2(self.ra, path, revnum, fields, pool) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
515 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
516 getdir = svn.ra.get_dir(self.ra, path, revnum, pool) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
517 if type(getdir) == dict: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
518 # python binding for getdir is broken up to at least 1.4.3 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
519 raise CompatibilityException() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
520 dirents = getdir[0] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
521 if type(dirents) == int: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
522 # got here once due to infinite recursion bug |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
523 # pprint.pprint(getdir) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
524 return |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
525 c = dirents.keys() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
526 c.sort() |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
527 for child in c: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
528 dirent = dirents[child] |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
529 if dirent.kind == svn.core.svn_node_dir: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
530 find_children_inner(children, (path + "/" + child).strip("/")) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
531 else: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
532 children.append((path + "/" + child).strip("/")) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
533 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
534 try: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
535 find_children_inner(children, "") |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
536 except CompatibilityException: |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
537 self._find_children_fallback = True |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
538 self.reparent(self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
539 return _find_children_fallback(path, revnum) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
540 |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
541 self.reparent(self.module) |
b6a1f2c46c6c
convert extension: Add SVN converter
Daniel Holth <dholth@fastmail.fm>
parents:
diff
changeset
|
542 return [path + "/" + c for c in children] |