[Pkg-bazaar-commits] ./bzr/unstable r404: - bzr status now optionally takes filenames to check
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 07:52:12 UTC 2009
------------------------------------------------------------
revno: 404
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-05-09 13:11:21 +1000
message:
- bzr status now optionally takes filenames to check
modified:
NEWS
TODO
bzrlib/branch.py
bzrlib/commands.py
testbzr
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2005-05-09 01:21:05 +0000
+++ b/NEWS 2005-05-09 03:11:21 +0000
@@ -25,6 +25,9 @@
* New option ``bzr commit --file`` to take a message from a file,
suggested by LarstiQ.
+ * New syntax ``bzr status [FILE...]`` contributed by Bartosz Oler.
+
+
TESTING:
* Converted black-box test suites from Bourne shell into Python;
=== modified file 'TODO'
--- a/TODO 2005-05-09 03:02:23 +0000
+++ b/TODO 2005-05-09 03:11:21 +0000
@@ -63,8 +63,6 @@
* Separate read and write version checks?
-* ``bzr status FILE...``
-
* Check all commands have decent help.
* ``bzr inventory -r REV`` and perhaps unify this with ``bzr ls``,
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2005-05-08 23:19:40 +0000
+++ b/bzrlib/branch.py 2005-05-09 03:11:21 +0000
@@ -906,7 +906,7 @@
- def show_status(self, show_all=False):
+ def show_status(self, show_all=False, file_list=None):
"""Display single-line status for non-ignored working files.
The list is show sorted in order by file name.
@@ -922,8 +922,6 @@
>>> os.unlink(b.abspath('foo'))
>>> b.show_status()
D foo
-
- TODO: Get state for single files.
"""
self._need_readlock()
@@ -939,7 +937,12 @@
old = self.basis_tree()
new = self.working_tree()
- for fs, fid, oldname, newname, kind in diff_trees(old, new):
+ items = diff_trees(old, new)
+ # We want to filter out only if any file was provided in the file_list.
+ if isinstance(file_list, list) and len(file_list):
+ items = [item for item in items if item[3] in file_list]
+
+ for fs, fid, oldname, newname, kind in items:
if fs == 'R':
show_status(fs, kind,
oldname + ' => ' + newname)
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2005-05-08 03:33:57 +0000
+++ b/bzrlib/commands.py 2005-05-09 03:11:21 +0000
@@ -119,13 +119,14 @@
The name is that in the current revision unless it is deleted or
missing, in which case the old name is shown.
"""
+ takes_args = ['file*']
takes_options = ['all']
aliases = ['st', 'stat']
- def run(self, all=False):
+ def run(self, all=False, file_list=None):
#import bzrlib.status
#bzrlib.status.tree_status(Branch('.'))
- Branch('.').show_status(show_all=all)
+ Branch('.').show_status(show_all=all, file_list=file_list)
class cmd_cat_revision(Command):
=== modified file 'testbzr'
--- a/testbzr 2005-05-09 01:21:05 +0000
+++ b/testbzr 2005-05-09 03:11:21 +0000
@@ -180,6 +180,22 @@
out = backtick("bzr status --all")
assert out == "? test.txt\n"
+ out = backtick("bzr status test.txt --all")
+ assert out == "? test.txt\n"
+
+ f = file('test2.txt', 'wt')
+ f.write('goodbye cruel world...\n')
+ f.close()
+
+ out = backtick("bzr status test.txt")
+ assert out == "? test.txt\n"
+
+ out = backtick("bzr status")
+ assert out == "? test.txt\n" \
+ + "? test2.txt\n"
+
+ os.unlink('test2.txt')
+
progress("command aliases")
out = backtick("bzr st --all")
assert out == "? test.txt\n"
More information about the Pkg-bazaar-commits
mailing list