cmdserver: set current process folder to a repository root after startup

Sergey Antonov sergant_ at mail.ru
Tue Feb 21 20:22:30 UTC 2012


On 20.02.2012 16:36, Idan Kamara wrote:
> On Sun, Feb 19, 2012 at 9:04 PM, Sergey Antonov <sergant_ at mail.ru
> <mailto:sergant_ at mail.ru>> wrote:
>  >
>  > On 17.02.2012 19:39, Matt Mackall wrote:
>  >>
>  >> On Fri, 2012-02-17 at 10:48 +0400, Sergey Antonov wrote:
>  >>>
>  >>> When I run hg in cmdserver mode it treats the paths relative to the
>  >>> process current folder (like standalone hg).
>  >>>
>  >>> So, if I get some path from a changeset description (i.e.
>  >>> Folder/foobar.txt) the cmdserver does not accept it. I need either make
>  >>> it a full path or relative to process current folder.
>  >>
>  >>
>  >> Or add 'path:' to it. From 'hg help patterns':
>  >>
>  >>     To use a plain path name without any pattern matching, start it with
>  >> "path:". These path names must completely match starting at the
>  >> current
>  >>     repository root.
>  >>
>  >
>  > Well, for me this is not an option.
>  >
>  > I'm writing a plugin to an IDE. There are too much existing code that
>  > operates on paths, written in assumption, that they are relative to
>  > repository root.
>  >
>  > For me it is easier to run standalone mercurial once to know a repository
>  > root from a path and then start a cmdserver instance with that path as
>  > working directory, than adapt 'path:' pattern.
>  >
>  > It is not a big deal though. Additional 100-200 ms per project in
>  > solution, if the project is not under known repository roots.
>  >
>  > By the way, do you think that adding a option to a cmdserver to change a
>  > working directory to repository root after startup is a bad idea for some
>  > reason ? Actually, I think cmdserver should do this by default
> without any
>  > options.
>
> It shouldn't do this by default because the cmdserver is simply
> meant to provide faster access to Mercurial's command line interface,
> doing this will be a surprise to those expecting the default handling of
> paths
> on the command line.


Looks like the existing --cwd option is close to what I need, but it has 
effect only on one command. I need a way to permanently change a working 
directory of a running instance of command server.

Maybe add a flag to not restore cwd after command ends ? That way I 
could set it once and do not pass for every command.

Also, there is a known issue on a cmdserver wiki page "server doesn't 
notice changes to hgrc files". Do you know, is there plans to fix it 
anytime soon ?

-- 
Sergey Antonov
sergant_ at mail.ru



More information about the Mercurial-devel mailing list