problems with grep -r and rename

Henryk Gerlach hgerlach at gmx.de
Fri Aug 10 09:53:28 CDT 2007


Hi List,

I have a small issue with grep, and I'm not sure whether I use grep correctly.
I thought you could use grep like
hg grep -r 1 somepattern

but then there seems to be a problem if a file was renamed:

===================Snip==========
hg version
#Mercurial Distributed SCM (version 0.9.4)
#
#Copyright (C) 2005-2007 Matt Mackall <mpm at selenic.com> and others
#This is free software; see the source for copying conditions. There is NO
#warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

hg init test
cd test
cat >A << END
AAAAA
END
hg addremove
# adding A
hg commit -m init

hg rename A B
hg commit -m renamed

hg grep AAAA
#A:0:AAAAA
#B:1:AAAAA

hg grep -r 1 AAAA
#** unknown exception encountered, details follow
#** report bug details to http://www.selenic.com/mercurial/bts
#** or mercurial at selenic.com
#** Mercurial Distributed SCM (version 0.9.4)
#Traceback (most recent call last):
#  File "/usr/local/bin/hg", line 11, in ?
#    mercurial.commands.run()
#  File "/usr/local//lib/python2.4/site-packages/mercurial/commands.py", line 3110, in run
#    sys.exit(dispatch(sys.argv[1:], argv0=sys.argv[0]))
#  File "/usr/local//lib/python2.4/site-packages/mercurial/commands.py", line 3107, in dispatch
#    return cmdutil.runcatch(u, args, argv0=argv0)
#  File "/usr/local//lib/python2.4/site-packages/mercurial/cmdutil.py", line 37, in runcatch
#    return dispatch(ui, args, argv0=argv0)
#  File "/usr/local//lib/python2.4/site-packages/mercurial/cmdutil.py", line 364, in dispatch
#    ret = runcommand(ui, options, cmd, d)
#  File "/usr/local//lib/python2.4/site-packages/mercurial/cmdutil.py", line 417, in runcommand
#    return checkargs()
#  File "/usr/local//lib/python2.4/site-packages/mercurial/cmdutil.py", line 373, in checkargs
#    return cmdfunc()
#  File "/usr/local//lib/python2.4/site-packages/mercurial/cmdutil.py", line 356, in <lambda>
#    d = lambda: func(ui, repo, *args, **cmdoptions)
#  File "/usr/local//lib/python2.4/site-packages/mercurial/commands.py", line 1221, in grep
#    if fn not in copies.get(prev[fn], {}):
#KeyError: 'A'
#
===========Snap==============

Any ideas?

Cheers,

   Henryk
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


More information about the Mercurial mailing list