Mercurial > hg-stable
changeset 1622:5e9168401a68
fix locate broken since 63799b01985c
- fix the keyword arguments for walk in commands.locate
- implement 'hg locate -r <rev>'
- add a test for 'hg locate'
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 16 Jan 2006 15:51:09 +0100 |
parents | ee16f06174bd |
children | eef8ff46567a |
files | mercurial/commands.py tests/test-locate tests/test-locate.out |
diffstat | 3 files changed, 41 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jan 12 21:55:19 2006 +0100 +++ b/mercurial/commands.py Mon Jan 16 15:51:09 2006 +0100 @@ -1531,9 +1531,15 @@ that contain white space as multiple filenames. """ end = opts['print0'] and '\0' or '\n' + rev = opts['rev'] + if rev: + node = repo.lookup(rev) + else: + node = None - for src, abs, rel, exact in walk(repo, pats, opts, '(?:.*/|)'): - if repo.dirstate.state(abs) == '?': + for src, abs, rel, exact in walk(repo, pats, opts, node=node, + head='(?:.*/|)'): + if not node and repo.dirstate.state(abs) == '?': continue if opts['fullpath']: ui.write(os.path.join(repo.root, abs), end)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-locate Mon Jan 16 15:51:09 2006 +0100 @@ -0,0 +1,20 @@ +#!/bin/sh +# +mkdir t +cd t +hg init +echo 0 > a +echo 0 > b +hg ci -A -m m -d "0 0" +touch nottracked +hg locate a +hg locate NONEXISTENT +hg locate +hg rm a +hg ci -m m -d "0 0" +hg locate a +hg locate NONEXISTENT +hg locate +hg locate -r 0 a +hg locate -r 0 NONEXISTENT +hg locate -r 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-locate.out Mon Jan 16 15:51:09 2006 +0100 @@ -0,0 +1,13 @@ +adding a +adding b +a +NONEXISTENT: No such file or directory +a +b +a: No such file or directory +NONEXISTENT: No such file or directory +b +a +NONEXISTENT: No such file in rev 9e1684505872 +a +b