filenames with "-" and ":"
Jens Alfke
jens at mooseyard.com
Sat Sep 1 23:40:18 CDT 2007
I haven't actually run into this, but there can be problems using 'hg'
subcommands on files with certain types of names.
* A filename starting with "-" will be interpreted as a command-line
flag.
* A filename with a ":" in it may be misinterpreted as a pattern (as
per 7.4 of the red-bean book). For example, if there were a file
called "glob:foo", naming it on an hg command line would cause the
command to actually apply to a file "foo".
A workaround is to put "./" before the filename, resulting in an
equivalent path that doesn't have a prefix that triggers these special
interpretations.
Granted, these aren't the kinds of filenames you'd be likely to see in
source code; but revision control does get used for other types of
projects. (As an example, a directory of archived email might contain
a lot of files with names starting "re:".) And as I'm working on a GUI
front-end to Mercurial, which generates 'hg' commands, I realized I
had to pay attention to such edge cases. I'm posting this here because
I know other people are working on similar utilities.
It might also be worth pointing this out in the manual. Or even adding
a special command-line flag like a plain '-' that disables special
interpretation of all following arguments.
--Jens
More information about the Mercurial
mailing list