[Pkg-bazaar-commits] ./bzr/unstable r164: new 'renames' command
mbp at sourcefrog.net
mbp at sourcefrog.net
Fri Apr 10 07:51:16 UTC 2009
------------------------------------------------------------
revno: 164
committer: mbp at sourcefrog.net
timestamp: Mon 2005-04-04 23:10:26 +1000
message:
new 'renames' command
modified:
NEWS
bzrlib/commands.py
bzrlib/tests.py
bzrlib/tree.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2005-04-04 10:35:13 +0000
+++ b/NEWS 2005-04-04 13:10:26 +0000
@@ -15,6 +15,8 @@
through the command at the moment, but the inventory support is
there.)
+ * New "renames" command lists files renamed since base revision.
+
PORTABILITY:
* Workaround for difflib bug in Python 2.3 that causes an
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-04-04 09:50:24 +0000
+++ b/bzrlib/commands.py 2005-04-04 13:10:26 +0000
@@ -203,6 +203,26 @@
+def cmd_renames(dir='.'):
+ """Show list of renamed files.
+
+usage: bzr renames [BRANCH]
+
+TODO: Option to show renames between two historical versions.
+
+TODO: Only show renames under dir, rather than in the whole branch.
+"""
+ b = Branch(dir)
+ old_inv = b.basis_tree().inventory
+ new_inv = b.read_working_inventory()
+
+ renames = list(bzrlib.tree.find_renames(old_inv, new_inv))
+ renames.sort()
+ for old_name, new_name in renames:
+ print "%s => %s" % (old_name, new_name)
+
+
+
def cmd_info():
"""info: Show statistical information for this branch
@@ -708,6 +728,7 @@
'mv': ['source$', 'dest'],
'relpath': ['filename'],
'remove': ['file+'],
+ 'renames': ['dir?'],
'root': ['filename?'],
'status': [],
}
=== modified file 'bzrlib/tests.py'
--- a/bzrlib/tests.py 2005-04-01 08:22:11 +0000
+++ b/bzrlib/tests.py 2005-04-04 13:10:26 +0000
@@ -211,6 +211,8 @@
foo => subdir/foo
>>> b.show_status()
R foo => subdir/foo
+ >>> bzrlib.commands.cmd_renames(b.base)
+ foo => subdir/foo
>>> b.commit("move foo to subdir")
>>> isfile(b.abspath('foo'))
False
=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py 2005-04-01 04:38:28 +0000
+++ b/bzrlib/tree.py 2005-04-04 13:10:26 +0000
@@ -432,3 +432,12 @@
+def find_renames(old_inv, new_inv):
+ for file_id in old_inv:
+ if file_id not in new_inv:
+ continue
+ old_name = old_inv.id2path(file_id)
+ new_name = new_inv.id2path(file_id)
+ if old_name != new_name:
+ yield (old_name, new_name)
+
More information about the Pkg-bazaar-commits
mailing list