[Pkg-bazaar-commits] ./bzr/unstable r392: - fix relpath and add tests

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:43:40 UTC 2009


------------------------------------------------------------
revno: 392
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-05-06 13:45:17 +1000
message:
  - fix relpath and add tests
modified:
  bzrlib/commands.py
  testbzr
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-05-06 02:49:04 +0000
+++ b/bzrlib/commands.py	2005-05-06 03:45:17 +0000
@@ -176,10 +176,10 @@
 
 class cmd_relpath(Command):
     """Show path of a file relative to root"""
-    takes_args = ('filename')
+    takes_args = ['filename']
     
-    def run(self):
-        print Branch(self.args['filename']).relpath(filename)
+    def run(self, filename):
+        print Branch(filename).relpath(filename)
 
 
 

=== modified file 'testbzr'
--- a/testbzr	2005-05-06 02:49:04 +0000
+++ b/testbzr	2005-05-06 03:45:17 +0000
@@ -203,6 +203,7 @@
     runcmd("bzr add sub1")
     runcmd("bzr rename sub1 sub2")
     runcmd("bzr move hello.txt sub2")
+    assert backtick("bzr relpath sub2/hello.txt") == "sub2/hello.txt\n"
 
     assert exists("sub2")
     assert exists("sub2/hello.txt")
@@ -225,8 +226,11 @@
     cd('sub1/sub2')
     runcmd('bzr move ../hello.txt .')
     assert exists('./hello.txt')
+    assert backtick('bzr relpath hello.txt') == 'sub1/sub2/hello.txt\n'
+    assert backtick('bzr relpath ../../sub1/sub2/hello.txt') == 'sub1/sub2/hello.txt\n'
     runcmd(['bzr', 'commit', '-m', 'move to parent directory'])
     cd('..')
+    assert backtick('bzr relpath sub2/hello.txt') == 'sub1/sub2/hello.txt\n'
 
     runcmd('bzr move sub2/hello.txt .')
     assert exists('hello.txt')



More information about the Pkg-bazaar-commits mailing list