Mercurial > hgsubversion
comparison hgsubversion/svnwrap/svn_swig_wrapper.py @ 499:1fd3cfa47c5e
Support for single-directory clones.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 16 Oct 2009 23:33:41 -0400 |
parents | b71507d7becc |
children | 925ff8c5989c |
comparison
equal
deleted
inserted
replaced
498:990e07054f29 | 499:1fd3cfa47c5e |
---|---|
343 | 343 |
344 Args: | 344 Args: |
345 dir: the directory to list, no leading slash | 345 dir: the directory to list, no leading slash |
346 rev: the revision at which to list the directory, defaults to HEAD | 346 rev: the revision at which to list the directory, defaults to HEAD |
347 """ | 347 """ |
348 if dir[-1] == '/': | 348 # TODO this should just not accept leading slashes like the docstring says |
349 if dir and dir[-1] == '/': | |
349 dir = dir[:-1] | 350 dir = dir[:-1] |
350 if revision is None: | 351 if revision is None: |
351 revision = self.HEAD | 352 revision = self.HEAD |
352 r = ra.get_dir2(self.ra, dir, revision, core.SVN_DIRENT_KIND, self.pool) | 353 r = ra.get_dir2(self.ra, dir, revision, core.SVN_DIRENT_KIND, self.pool) |
353 folders, props, junk = r | 354 folders, props, junk = r |
553 "link " prefix is dropped from symlink content. Mode is 'x' if | 554 "link " prefix is dropped from symlink content. Mode is 'x' if |
554 file is executable, 'l' if a symlink, the empty string | 555 file is executable, 'l' if a symlink, the empty string |
555 otherwise. If the file does not exist at this revision, raise | 556 otherwise. If the file does not exist at this revision, raise |
556 IOError. | 557 IOError. |
557 """ | 558 """ |
559 assert not path.startswith('/') | |
558 mode = '' | 560 mode = '' |
559 try: | 561 try: |
560 out = cStringIO.StringIO() | 562 out = cStringIO.StringIO() |
561 info = ra.get_file(self.ra, path, revision, out) | 563 info = ra.get_file(self.ra, path, revision, out) |
562 data = out.getvalue() | 564 data = out.getvalue() |
631 return _svntypes.get(kind) | 633 return _svntypes.get(kind) |
632 | 634 |
633 def path2url(self, path): | 635 def path2url(self, path): |
634 """Build svn URL for path, URL-escaping path. | 636 """Build svn URL for path, URL-escaping path. |
635 """ | 637 """ |
636 assert path[0] != '/' | 638 if not path or path == '.': |
639 return self.svn_url | |
640 assert path[0] != '/', path | |
637 return '/'.join((self.svn_url, | 641 return '/'.join((self.svn_url, |
638 urllib.quote(path).rstrip('/'), | 642 urllib.quote(path).rstrip('/'), |
639 )) | 643 )) |