# HG changeset patch # User Benoit Boissinot # Date 1137423069 -3600 # Node ID 5e9168401a68053e98eba621a13084be33291b56 # Parent ee16f06174bd5fa0f17c99dccdc8b3f5f9476ee3 fix locate broken since 63799b01985c - fix the keyword arguments for walk in commands.locate - implement 'hg locate -r ' - add a test for 'hg locate' diff -r ee16f06174bd -r 5e9168401a68 mercurial/commands.py --- 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) diff -r ee16f06174bd -r 5e9168401a68 tests/test-locate --- /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 diff -r ee16f06174bd -r 5e9168401a68 tests/test-locate.out --- /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