25 except ImportError: |
25 except ImportError: |
26 pass |
26 pass |
27 |
27 |
28 class CompatibilityException(Exception): pass |
28 class CompatibilityException(Exception): pass |
29 |
29 |
30 nbRevisionsPerFetch = 50 |
30 LOG_BATCH_SIZE = 50 |
31 |
31 |
32 class svn_entry(object): |
32 class svn_entry(object): |
33 """Emulate a Subversion path change.""" |
33 """Emulate a Subversion path change.""" |
34 __slots__ = ['path', 'copyfrom_path', 'copyfrom_rev', 'action'] |
34 __slots__ = ['path', 'copyfrom_path', 'copyfrom_rev', 'action'] |
35 def __init__(self, entry): |
35 def __init__(self, entry): |
124 latest = svn.ra.get_latest_revnum(self.ra) |
124 latest = svn.ra.get_latest_revnum(self.ra) |
125 dirent = svn.ra.stat(self.ra, self.module, latest) |
125 dirent = svn.ra.stat(self.ra, self.module, latest) |
126 self.last_changed = dirent.created_rev |
126 self.last_changed = dirent.created_rev |
127 |
127 |
128 self.head = self.rev(self.last_changed) |
128 self.head = self.rev(self.last_changed) |
129 |
|
130 # Should lazily fetch revisions in batches of, say, 1,000...: |
|
131 self._fetch_revisions(from_revnum=self.last_changed, to_revnum=0) |
|
132 |
129 |
133 def rev(self, revnum): |
130 def rev(self, revnum): |
134 return (u"svn:%s%s@%s" % (self.uuid, self.module, revnum)).decode(self.encoding) |
131 return (u"svn:%s%s@%s" % (self.uuid, self.module, revnum)).decode(self.encoding) |
135 |
132 |
136 def get_blacklist(self): |
133 def get_blacklist(self): |
156 svn_url = self.base + module |
153 svn_url = self.base + module |
157 self.ui.debug("reparent to %s\n" % svn_url.encode(self.encoding)) |
154 self.ui.debug("reparent to %s\n" % svn_url.encode(self.encoding)) |
158 svn.ra.reparent(self.ra, svn_url.encode(self.encoding)) |
155 svn.ra.reparent(self.ra, svn_url.encode(self.encoding)) |
159 |
156 |
160 def _fetch_revisions(self, from_revnum = 0, to_revnum = 347, pb=None): |
157 def _fetch_revisions(self, from_revnum = 0, to_revnum = 347, pb=None): |
161 self.parent_cset = None |
158 if not hasattr(self, 'child_rev'): |
162 self.child_cset = None |
159 self.child_rev = from_revnum |
163 |
160 self.child_cset = self.commits.get(self.child_rev) |
|
161 else: |
|
162 self.commits[self.child_rev] = self.child_cset |
|
163 |
164 self.ui.debug('Fetching revisions %d to %d\n' % (from_revnum, to_revnum)) |
164 self.ui.debug('Fetching revisions %d to %d\n' % (from_revnum, to_revnum)) |
165 |
165 |
166 def get_entry_from_path(path, module=self.module): |
166 def get_entry_from_path(path, module=self.module): |
167 # Given the repository url of this wc, say |
167 # Given the repository url of this wc, say |
168 # "http://server/plone/CMFPlone/branches/Plone-2_0-branch" |
168 # "http://server/plone/CMFPlone/branches/Plone-2_0-branch" |
386 |
386 |
387 log = message and self.recode(message) |
387 log = message and self.recode(message) |
388 author = author and self.recode(author) or '' |
388 author = author and self.recode(author) or '' |
389 |
389 |
390 cset = commit(author=author, |
390 cset = commit(author=author, |
391 date=util.datestr(date), |
391 date=util.datestr(date), |
392 desc=log, |
392 desc=log, |
393 parents=[], |
393 parents=[], |
394 copies=copies, |
394 copies=copies, |
395 branch=branch) |
395 branch=branch) |
396 |
396 |
397 if self.child_cset is not None: |
397 if self.child_cset and self.child_rev != rev: |
398 self.child_cset.parents = [rev] |
398 self.child_cset.parents = [rev] |
399 |
399 self.commits[self.child_rev] = self.child_cset |
400 self.child_cset = cset |
400 self.child_cset = cset |
401 |
401 self.child_rev = rev |
402 self.commits[rev] = cset |
|
403 |
402 |
404 try: |
403 try: |
405 discover_changed_paths = True |
404 discover_changed_paths = True |
406 strict_node_history = False |
405 strict_node_history = False |
407 svn.ra.get_log(self.ra, [self.module], from_revnum, to_revnum, |
406 svn.ra.get_log(self.ra, [self.module], from_revnum, to_revnum, |