Mercurial > hg
comparison hgext/convert/subversion.py @ 6210:942287cb1f57
Removed trailing spaces from everything except test output
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 07 Mar 2008 00:24:36 +0100 |
parents | 963000ed8cac |
children | 0f76c7dc8484 |
comparison
equal
deleted
inserted
replaced
6209:4e8cd15240bf | 6210:942287cb1f57 |
---|---|
200 try: | 200 try: |
201 self.startrev = int(self.startrev) | 201 self.startrev = int(self.startrev) |
202 if self.startrev < 0: | 202 if self.startrev < 0: |
203 self.startrev = 0 | 203 self.startrev = 0 |
204 except ValueError: | 204 except ValueError: |
205 raise util.Abort(_('svn: start revision %s is not an integer') | 205 raise util.Abort(_('svn: start revision %s is not an integer') |
206 % self.startrev) | 206 % self.startrev) |
207 | 207 |
208 try: | 208 try: |
209 self.get_blacklist() | 209 self.get_blacklist() |
210 except IOError, e: | 210 except IOError, e: |
213 self.head = self.latest(self.module, latest) | 213 self.head = self.latest(self.module, latest) |
214 if not self.head: | 214 if not self.head: |
215 raise util.Abort(_('no revision found in module %s') % | 215 raise util.Abort(_('no revision found in module %s') % |
216 self.module.encode(self.encoding)) | 216 self.module.encode(self.encoding)) |
217 self.last_changed = self.revnum(self.head) | 217 self.last_changed = self.revnum(self.head) |
218 | 218 |
219 self._changescache = None | 219 self._changescache = None |
220 | 220 |
221 if os.path.exists(os.path.join(url, '.svn/entries')): | 221 if os.path.exists(os.path.join(url, '.svn/entries')): |
222 self.wc = url | 222 self.wc = url |
223 else: | 223 else: |
286 brevid = self.latest(module, self.last_changed) | 286 brevid = self.latest(module, self.last_changed) |
287 if not brevid: | 287 if not brevid: |
288 self.ui.note(_('ignoring empty branch %s\n') % | 288 self.ui.note(_('ignoring empty branch %s\n') % |
289 branch.encode(self.encoding)) | 289 branch.encode(self.encoding)) |
290 continue | 290 continue |
291 self.ui.note('found branch %s at %d\n' % | 291 self.ui.note('found branch %s at %d\n' % |
292 (branch, self.revnum(brevid))) | 292 (branch, self.revnum(brevid))) |
293 self.heads.append(brevid) | 293 self.heads.append(brevid) |
294 | 294 |
295 if self.startrev and self.heads: | 295 if self.startrev and self.heads: |
296 if len(self.heads) > 1: | 296 if len(self.heads) > 1: |
297 raise util.Abort(_('svn: start revision is not supported with ' | 297 raise util.Abort(_('svn: start revision is not supported with ' |
298 'with more than one branch')) | 298 'with more than one branch')) |
299 revnum = self.revnum(self.heads[0]) | 299 revnum = self.revnum(self.heads[0]) |
300 if revnum < self.startrev: | 300 if revnum < self.startrev: |
301 raise util.Abort(_('svn: no revision found after start revision %d') | 301 raise util.Abort(_('svn: no revision found after start revision %d') |
302 % self.startrev) | 302 % self.startrev) |
303 | 303 |
304 return self.heads | 304 return self.heads |
305 | 305 |
306 def getfile(self, file, rev): | 306 def getfile(self, file, rev): |
320 if parents: | 320 if parents: |
321 files, copies = self.expandpaths(rev, paths, parents) | 321 files, copies = self.expandpaths(rev, paths, parents) |
322 else: | 322 else: |
323 # Perform a full checkout on roots | 323 # Perform a full checkout on roots |
324 uuid, module, revnum = self.revsplit(rev) | 324 uuid, module, revnum = self.revsplit(rev) |
325 entries = svn.client.ls(self.base + module, optrev(revnum), | 325 entries = svn.client.ls(self.base + module, optrev(revnum), |
326 True, self.ctx) | 326 True, self.ctx) |
327 files = [n for n,e in entries.iteritems() | 327 files = [n for n,e in entries.iteritems() |
328 if e.kind == svn.core.svn_node_file] | 328 if e.kind == svn.core.svn_node_file] |
329 copies = {} | 329 copies = {} |
330 | 330 |
331 files.sort() | 331 files.sort() |
332 files = zip(files, [rev] * len(files)) | 332 files = zip(files, [rev] * len(files)) |
362 | 362 |
363 def gettags(self): | 363 def gettags(self): |
364 tags = {} | 364 tags = {} |
365 if self.tags is None: | 365 if self.tags is None: |
366 return tags | 366 return tags |
367 | 367 |
368 start = self.revnum(self.head) | 368 start = self.revnum(self.head) |
369 try: | 369 try: |
370 for entry in get_log(self.url, [self.tags], self.startrev, start): | 370 for entry in get_log(self.url, [self.tags], self.startrev, start): |
371 orig_paths, revnum, author, date, message = entry | 371 orig_paths, revnum, author, date, message = entry |
372 for path in orig_paths: | 372 for path in orig_paths: |
440 | 440 |
441 for p in paths: | 441 for p in paths: |
442 if not path.startswith(p) or not paths[p].copyfrom_path: | 442 if not path.startswith(p) or not paths[p].copyfrom_path: |
443 continue | 443 continue |
444 newpath = paths[p].copyfrom_path + path[len(p):] | 444 newpath = paths[p].copyfrom_path + path[len(p):] |
445 self.ui.debug("branch renamed from %s to %s at %d\n" % | 445 self.ui.debug("branch renamed from %s to %s at %d\n" % |
446 (path, newpath, revnum)) | 446 (path, newpath, revnum)) |
447 path = newpath | 447 path = newpath |
448 break | 448 break |
449 finally: | 449 finally: |
450 stream.close() | 450 stream.close() |
564 # We can avoid the reparent calls if the module has not changed | 564 # We can avoid the reparent calls if the module has not changed |
565 # but it probably does not worth the pain. | 565 # but it probably does not worth the pain. |
566 self.reparent('') | 566 self.reparent('') |
567 fromkind = svn.ra.check_path(self.ra, entrypath.strip('/'), fromrev) | 567 fromkind = svn.ra.check_path(self.ra, entrypath.strip('/'), fromrev) |
568 self.reparent(self.module) | 568 self.reparent(self.module) |
569 | 569 |
570 if fromkind == svn.core.svn_node_file: # a deleted file | 570 if fromkind == svn.core.svn_node_file: # a deleted file |
571 entries.append(self.recode(entry)) | 571 entries.append(self.recode(entry)) |
572 elif fromkind == svn.core.svn_node_dir: | 572 elif fromkind == svn.core.svn_node_dir: |
573 # print "Deleted/moved non-file:", revnum, path, ent | 573 # print "Deleted/moved non-file:", revnum, path, ent |
574 # children = self._find_children(path, revnum - 1) | 574 # children = self._find_children(path, revnum - 1) |
675 if from_revnum < to_revnum: | 675 if from_revnum < to_revnum: |
676 from_revnum, to_revnum = to_revnum, from_revnum | 676 from_revnum, to_revnum = to_revnum, from_revnum |
677 | 677 |
678 self.child_cset = None | 678 self.child_cset = None |
679 def parselogentry(orig_paths, revnum, author, date, message): | 679 def parselogentry(orig_paths, revnum, author, date, message): |
680 """Return the parsed commit object or None, and True if | 680 """Return the parsed commit object or None, and True if |
681 the revision is a branch root. | 681 the revision is a branch root. |
682 """ | 682 """ |
683 self.ui.debug("parsing revision %d (%d changes)\n" % | 683 self.ui.debug("parsing revision %d (%d changes)\n" % |
684 (revnum, len(orig_paths))) | 684 (revnum, len(orig_paths))) |
685 | 685 |
762 paths, revnum, author, date, message = entry | 762 paths, revnum, author, date, message = entry |
763 if revnum < self.startrev: | 763 if revnum < self.startrev: |
764 lastonbranch = True | 764 lastonbranch = True |
765 break | 765 break |
766 if self.is_blacklisted(revnum): | 766 if self.is_blacklisted(revnum): |
767 self.ui.note('skipping blacklisted revision %d\n' | 767 self.ui.note('skipping blacklisted revision %d\n' |
768 % revnum) | 768 % revnum) |
769 continue | 769 continue |
770 if paths is None: | 770 if paths is None: |
771 self.ui.debug('revision %d has no entries\n' % revnum) | 771 self.ui.debug('revision %d has no entries\n' % revnum) |
772 continue | 772 continue |
773 cset, lastonbranch = parselogentry(paths, revnum, author, | 773 cset, lastonbranch = parselogentry(paths, revnum, author, |
774 date, message) | 774 date, message) |
775 if cset: | 775 if cset: |
776 firstcset = cset | 776 firstcset = cset |
777 if lastonbranch: | 777 if lastonbranch: |
778 break | 778 break |