[PATCH 2 of 2] locate: honor ui.slash (issue1621)

Matt Mackall mpm at selenic.com
Fri Oct 12 15:05:47 CDT 2012


On Mon, 2012-08-20 at 21:51 +0200, Patrick Mezard wrote:
> # HG changeset patch
> # User Patrick Mezard <patrick at mezard.eu>
> # Date 1345491285 -7200
> # Node ID 15d9d61f6957390a0afcc4761cd657b2f174ab26
> # Parent  461b362c4778512578087e422ce3cdb4bc5ea3f7
> locate: honor ui.slash (issue1621)

What's the status here?

> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3945,13 +3945,15 @@
>      ret = 1
>      m = scmutil.match(repo[rev], pats, opts, default='relglob')
>      m.bad = lambda x, y: False
> +    normpath = ui.normslashfn()
>      for abs in repo[rev].walk(m):
>          if not rev and abs not in repo.dirstate:
>              continue
>          if opts.get('fullpath'):
> -            ui.write(repo.wjoin(abs), end)
> +            path = repo.wjoin(abs)
>          else:
> -            ui.write(((pats and m.rel(abs)) or abs), end)
> +            path = ((pats and m.rel(abs)) or abs)
> +        ui.write(normpath(path), end)
>          ret = 0
>  
>      return ret
> diff --git a/tests/test-locate.t b/tests/test-locate.t
> --- a/tests/test-locate.t
> +++ b/tests/test-locate.t
> @@ -23,6 +23,8 @@
>  
>    $ hg locate a
>    a
> +  $ hg locate --fullpath a
> +  $TESTTMP/repo/a
>  
>    $ hg locate NONEXISTENT
>    [1]
> @@ -88,34 +90,49 @@
>    $ rm -r t
>  
>    $ hg locate 't/**'
> -  t/b (glob)
> -  t/e.h (glob)
> -  t/x (glob)
> +  t/b
> +  t/e.h
> +  t/x
>  
>    $ mkdir otherdir
>    $ cd otherdir
>  
>    $ hg locate b
> -  ../b (glob)
> -  ../t/b (glob)
> +  ../b
> +  ../t/b
>    $ hg locate '*.h'
> -  ../t.h (glob)
> -  ../t/e.h (glob)
> +  ../t.h
> +  ../t/e.h
>    $ hg locate path:t/x
> -  ../t/x (glob)
> +  ../t/x
>    $ hg locate 're:.*\.h$'
> -  ../t.h (glob)
> -  ../t/e.h (glob)
> +  ../t.h
> +  ../t/e.h
>    $ hg locate -r 0 b
> -  ../b (glob)
> -  ../t/b (glob)
> +  ../b
> +  ../t/b
>    $ hg locate -r 0 '*.h'
> -  ../t.h (glob)
> -  ../t/e.h (glob)
> +  ../t.h
> +  ../t/e.h
>    $ hg locate -r 0 path:t/x
> -  ../t/x (glob)
> +  ../t/x
>    $ hg locate -r 0 're:.*\.h$'
> -  ../t.h (glob)
> -  ../t/e.h (glob)
> +  ../t.h
> +  ../t/e.h
> +
> +run-tests.py forces ui.slash=True
> +
> +#if windows
> +  $ hg --config ui.slash=false locate b
> +  ..\b
> +  ..\t\b
> +  $ cd ..
> +  $ hg --config ui.slash=false locate b
> +  b
> +  t\b
> +  $ hg --config ui.slash=false locate --fullpath b
> +  $TESTTMP\repo\b
> +  $TESTTMP\repo\t/b
> +#endif
>  
>    $ cd ../..
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list