Mercurial > hg > mercurial-crew-with-dirclash
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 +++ b/mercurial/commands.py @@ -1531,9 +1531,15 @@ def locate(ui, repo, *pats, **opts): 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)
new file mode 100755 --- /dev/null +++ b/tests/test-locate @@ -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