[PATCH 06 of 11] hgk: preserve working directory

Matt Mackall mpm at selenic.com
Mon Jun 25 09:58:30 CDT 2007


On Mon, Jun 25, 2007 at 02:50:43PM +0200, Markus F.X.J. Oberhumer wrote:
> # HG changeset patch
> # User Markus F.X.J. Oberhumer <markus at oberhumer.com>
> # Date 1182775580 -7200
> # Node ID 627752dddfa1b3d83363f9153b463034c3041ea5
> # Parent  b8ae71e5e6bb46709df839d7e5f73d03902cea18
> hgk: preserve working directory.
> 
> diff --git a/hgext/hgk.py b/hgext/hgk.py
> --- a/hgext/hgk.py
> +++ b/hgext/hgk.py
> @@ -268,11 +268,15 @@ def revlist(ui, repo, *revs, **opts):
>  
>  def view(ui, repo, *etc, **opts):
>      "start interactive history viewer"
> -    os.chdir(repo.root)
> -    optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
> -    cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))
> -    ui.debug("running %s\n" % cmd)
> -    util.system(cmd)
> +    cwd = os.getcwd()
> +    try:
> +        os.chdir(repo.root)
> +        optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
> +        cmd = ui.config("hgk", "path", "hgk") + " %s %s" % (optstr, " ".join(etc))
> +        ui.debug("running %s\n" % cmd)
> +        util.system(cmd)
> +    finally:
> +        os.chdir(cwd)

Don't see much point to this?

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial-devel mailing list