[RFC/MERGE] disabling kind markers for 'bzr status'
John Arbash Meinel
john at arbash-meinel.com
Fri May 4 18:00:49 BST 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
James Troup mentioned on IRC that he would like to remove the kind
markers from 'bzr status'. He was talking about using "bzr status" in
pipelines. I'm not sure exactly how, but I would guess he was doing
something like:
bzr status --short | grep "^A" | xargs bzr commit -m "added files"
I ran into 2 problems while trying to help him:
1) bzrlib/delta.py doesn't use 'osutils.kind_marker()' and instead
re-produces the logic locally. (And messes up because it doesn't handle
the new tree references).
This is a simple patch to fix that:
=== modified file 'bzrlib/delta.py'
- --- bzrlib/delta.py 2007-04-16 01:00:20 +0000
+++ bzrlib/delta.py 2007-05-04 16:54:57 +0000
@@ -113,10 +113,7 @@
for item in files:
path, fid, kind = item[:3]
- - if kind == 'directory':
- - path += '/'
- - elif kind == 'symlink':
- - path += '@'
+ path += osutils.kind_marker(kind)
if len(item) == 5 and item[4]:
path += '*'
2) We don't have a flag for disabling them. I wrote a simple plugin as a
workaround:
import bzrlib.osutils
def kind_no_marker(*args, **kwargs):
return ''
# Override kind_marker to never return a symbol
bzrlib.osutils.kind_marker = kind_no_marker
Which if you have the patch from (1) works.
He thought it would be reasonable to disable it with a 'isatty()' check,
I'm not sure if we would want to do that or not.
We could disable it with an ENV var, or we could make it a flag to
'show_tree_status'. The flag would need to be propagated a bit, but not
terribly far.
And then we could have "bzr status --no-kind-markers --short", or
something like that.
What do people think?
John
=:->
PS> I'm considering (1) to be MERGE worthy, I'm not sure about how to
handle disabling the markers.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGO2bBJdeBCYSNAAMRAl6XAKCFUB7CPRI1eN2cCvEIgEXORXePOQCfQ9nE
dbzN1Sluvep0t3NPXXPbhqg=
=IP/T
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list