Best way to check if file is under Bazaar's control from a script

Ben Finney bignose+hates-spam at benfinney.id.au
Sun Sep 7 12:44:11 BST 2008


Andrew Bennetts <andrew at canonical.com> writes:

> Nicholas Allen wrote:
> > I think it would be nice if there was a command is-versioned and
> > this would exit with code 0 if not versioned and 1 if versioned.

Presumably any non-zero exit status will do. The only thing needed for
a command to work with 'if' in a shell program is that it exit with 0
for success and non-zero for failure.

> There's this:
> 
>     bzr file-id blah > /dev/null 2>&1
> 
> That will exit with 0 if versioned or 3 if not versioned.

This also works with:

    bzr inventory FILENAME > /dev/null 2>&1

I agree that a command simpler than either of these would be good.
Perhaps 'bzr file-inventory' could grow a '--quiet' option to (similar
to 'grep --quiet') suppress output and error, leaving the exit status
alone to indicate success or failure.

-- 
 \        “If I melt dry ice, can I swim without getting wet?” —Steven |
  `\                                                            Wright |
_o__)                                                                  |
Ben Finney




More information about the bazaar mailing list