Mercurial > hgsubversion
comparison svnwrap/svn_swig_wrapper.py @ 87:b033d74be76b
fetch_command: in stupid non-diffy mode, take changed paths in account
Former code was checkouting all branch files for every converted
revision when diffs were not available in stupid mode. Now, only
changed items are requested.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 14 Nov 2008 16:18:24 -0600 |
parents | 6c9b7cf1c5aa |
children | edeec6829d80 |
comparison
equal
deleted
inserted
replaced
86:6ecdbd22eb1d | 87:b033d74be76b |
---|---|
84 for p in paths: | 84 for p in paths: |
85 self.paths[p[len(strip_path):]] = paths[p] | 85 self.paths[p[len(strip_path):]] = paths[p] |
86 | 86 |
87 def __str__(self): | 87 def __str__(self): |
88 return 'r%d by %s' % (self.revnum, self.author) | 88 return 'r%d by %s' % (self.revnum, self.author) |
89 | |
90 _svntypes = { | |
91 core.svn_node_dir: 'd', | |
92 core.svn_node_file: 'f', | |
93 } | |
89 | 94 |
90 class SubversionRepo(object): | 95 class SubversionRepo(object): |
91 """Wrapper for a Subversion repository. | 96 """Wrapper for a Subversion repository. |
92 | 97 |
93 This uses the SWIG Python bindings, and will only work on svn >= 1.4. | 98 This uses the SWIG Python bindings, and will only work on svn >= 1.4. |
450 """ | 455 """ |
451 dirpath = dirpath.strip('/') | 456 dirpath = dirpath.strip('/') |
452 pool = core.Pool() | 457 pool = core.Pool() |
453 rpath = '/'.join([self.svn_url, dirpath]).strip('/') | 458 rpath = '/'.join([self.svn_url, dirpath]).strip('/') |
454 rev = optrev(revision) | 459 rev = optrev(revision) |
455 types = { | |
456 core.svn_node_dir: 'd', | |
457 core.svn_node_file: 'f', | |
458 } | |
459 try: | 460 try: |
460 entries = client.ls(rpath, rev, True, self.client_context, pool) | 461 entries = client.ls(rpath, rev, True, self.client_context, pool) |
461 except core.SubversionException, e: | 462 except core.SubversionException, e: |
462 if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: | 463 if e.apr_err == core.SVN_ERR_FS_NOT_FOUND: |
463 raise IOError('%s cannot be found at r%d' % (dirpath, revision)) | 464 raise IOError('%s cannot be found at r%d' % (dirpath, revision)) |
464 raise | 465 raise |
465 for path, e in entries.iteritems(): | 466 for path, e in entries.iteritems(): |
466 kind = types.get(e.kind) | 467 kind = _svntypes.get(e.kind) |
467 yield path, kind | 468 yield path, kind |
469 | |
470 def checkpath(self, path, revision): | |
471 """Return the entry type at the given revision, 'f', 'd' or None | |
472 if the entry does not exist. | |
473 """ | |
474 kind = ra.check_path(self.ra, path.strip('/'), revision) | |
475 return _svntypes.get(kind) | |
468 | 476 |
469 class SubversionRepoCanNotReplay(Exception): | 477 class SubversionRepoCanNotReplay(Exception): |
470 """Exception raised when the svn server is too old to have replay. | 478 """Exception raised when the svn server is too old to have replay. |
471 """ | 479 """ |