[MERGE] [#306424] Add trailing slash to directories in `bzr ls` output

John Arbash Meinel john at arbash-meinel.com
Tue Dec 9 15:33:10 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gordon P. Hemsley wrote:
> https://bugs.launchpad.net/bzr/+bug/306424
> https://code.launchpad.net/~gphemsley/bzr/bug-306424-ls-trailing-slash
> 
> This slightly changes the behavior of `bzr ls` to include trailing
> slashes for all directories in all outputs. This was previously only
> available using the verbose option, which also included file versioning
> information. These small changes were made by making the pre-existing
> code used with the verbose option apply to all options. The NEWS file
> has been updated to reflect this change, as have the unittests.
> 
> I also fixed a small typo in the HACKING.txt file, unrelated to this bug.
> 
> -- 
> Gordon P. Hemsley
> gphemsley at gmail.com <mailto:gphemsley at gmail.com>
> http://www.uvm.edu/~ghemsley/http://gpfactory.wyrihaximus.net/
> http://cmsforme.sourceforge.net/http://www.yoursasha.com/

So the one part that concerns me a lot is with "--null".

As the --null flag is really meant for automated processing. Such as:

bzr ls --null | xargs -0 ...

And while adding a trailing '/' is generally harmless, adding @ and *
break that situation.

I see 2 options

1) Have an explicit flag for decoration (such as ls -F), possibly
- --decorate, possibly something else. We could even default it to on as
long as --no-decorate was available.

However, it means that any time you want "bzr ls --null" you now also
want "bzr ls --null --no-decorate".

2) Have --null automatically disable the decoration. Or possibly have it
just change the default of "--no-decorate". You would do that in code with:

def run(..., decorate=None):

  if decorate is None:
    if null:
      decorate = False
    else:
      decorate = True

I'm not super happy when one option changes another options default, but
I really don't see a case where people would want "bzr ls --null
- --decorate".

3) I'm a bit concerned about changing the default output of "bzr ls"
because it is (was?) meant primarily as a helper for people who were
trying to script with bzr (hence why it has a flag like --null to
produce unambiguous separation.) And changing the output tends to break
automated scripts.


I'm going to be a bit strong and vote
BB:resubmit

I think there is something people would like here, but I feel like it
shouldn't be the default behavior. People *can* do:

bzr alias ls="ls --decorated"

If they want it to be the default behavior.

It would be *sufficient* for me to just not decorate "bzr ls --null",
though I am still concerned about the other cases.

John
=:->


PS> The specific code I'm concerned about is:
                     elif null:
- -                        self.outf.write(fp + '\0')
+                        self.outf.write(outstring + '\0')
                         if show_ids:
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkk+j7YACgkQJdeBCYSNAAO1WgCg0L/PUpCAOVFqSh7Ako84HoCF
Ne4AoNn6ow40iJpW1ZlwaV1MAn2AaAPo
=0aYC
-----END PGP SIGNATURE-----



More information about the bazaar mailing list