Mercurial > hg
changeset 8434:4a3e7c380834
Merge with crew-stable
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 15 May 2009 16:17:56 +0200 |
parents | 9a398dd53bcc (current diff) eb7be0e752d9 (diff) |
children | 6f56dc1dd8ce |
files | hgext/convert/bzr.py tests/test-convert-bzr tests/test-convert-bzr.out |
diffstat | 3 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/bzr.py Fri May 15 15:21:17 2009 +0200 +++ b/hgext/convert/bzr.py Fri May 15 16:17:56 2009 +0200 @@ -79,12 +79,22 @@ def getfile(self, name, rev): revtree = self.sourcerepo.revision_tree(rev) fileid = revtree.path2id(name) - if fileid is None or revtree.kind(fileid) not in supportedkinds: + kind = None + if fileid is not None: + kind = revtree.kind(fileid) + if kind not in supportedkinds: # the file is not available anymore - was deleted raise IOError(_('%s is not available in %s anymore') % (name, rev)) - sio = revtree.get_file(fileid) - return sio.read() + if kind == 'symlink': + target = revtree.get_symlink_target(fileid) + if target is None: + raise util.Abort(_('%s.%s symlink has no target') + % (name, rev)) + return target + else: + sio = revtree.get_file(fileid) + return sio.read() def getmode(self, name, rev): return self._modecache[(name, rev)]
--- a/tests/test-convert-bzr Fri May 15 15:21:17 2009 +0200 +++ b/tests/test-convert-bzr Fri May 15 16:17:56 2009 +0200 @@ -114,4 +114,8 @@ hg convert source source-hg manifest source-hg 0 manifest source-hg tip -cd .. +cd source-hg +echo % test the symlinks can be recreated +hg up +hg cat syma +cd ../..
--- a/tests/test-convert-bzr.out Fri May 15 15:21:17 2009 +0200 +++ b/tests/test-convert-bzr.out Fri May 15 16:17:56 2009 +0200 @@ -72,3 +72,6 @@ 755 * newprog 644 program 644 @ syma +% test the symlinks can be recreated +5 files updated, 0 files merged, 0 files removed, 0 files unresolved +a \ No newline at end of file