bzr svn propedit equivalent

Harald Meland harald.meland at usit.uio.no
Mon Mar 5 13:51:06 GMT 2007


[Jari Aalto]

> If there is a call:
>
>     config get variable "$options"
>
> And $options is empty, for whatever reasons, from shell's point of view, the
> commands reads:
>
>     config set variable

No, it doesn't.  It reads:

  config set variable ""

i.e. there are four separate entries in the argv array, the last of
which is an zero-length string.  Had you instead written

  config get variable $options

you'd risk having argv arrays of 3, 4 *or* *more* entries, depending
on the value of $options... but that (i.e. leaving out the quotes)
would be bad scripting practice in and of itself.

> If program has some defaults when *no* *arguments* are given, this gives
> surprising results. Therefore the above will and should print error and
> not assume e.g. "" empty value.

In principle, I disagree -- there might be config variables where the
empty string is a perfectly useful value.

In practice, I don't know which config variables are planned, so it
*might* be useful to somehow define the syntax of the various
variables, and have syntax checks protest if a
non-empty-string-allowing variable is attempted set to the empty
string.

> Similarly for all other ocmmands. Like requiring "--all" to catch the
> missing intentions.

Surely you're not advocating that users should be required to write
e.g. "bzr help --summary" to get the output of the current "bzr help"
command?

>> Forcing me to type the --all seems redundant.
>
> As you mentioned, if you find typing this frequently, you can make
> alias for it. The programs' consistent behavior is more important than
> convenience.

It depends, I guess.  Are you going to design this for "sloppy"
scripters (i.e. assume that perl coders will do

  $val = `bzr config get $foo`;

and hence risk that $val includes the settings for all valid config
variables), or only for "safe" scripters (i.e. assume perl scripters
will instead do something like

  open (CFG, "-|", qw(bzr config get), $foo);
  my $val = join ("\n", <CFG>);
  close (CFG) || die "bzr config get $foo exited with non-zero value: $?";

)

All the above perl code is untested.
-- 
Harald



More information about the bazaar mailing list