https://bz.mercurial-scm.org/show_bug.cgi?id=6683
Bug ID: 6683 Summary: Using --follow and --removed together gives wrong results Product: Mercurial Version: default branch Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: jwde...@gmail.com CC: mercurial-devel@mercurial-scm.org Python Version: --- I have a file that has been renamed, then subsequently removed. It currently does not exist in my working directory. I want to see the full history of this file, including the rename and removal. Simple repro case provided at the bottom of this report. So far, the only way I've been able to get the full history is to use multiple commands, including both the new and old names for the file, piecing it all together myself. I'd like to run one command to get the full history. I tried: $ hg log --removed --follow bar.txt But this only shows the history after the rename. It does not show the original history of the file - as though "--follow" is ignored. I feel like this should be a warning, if '--follow' is ignored, or incompatible? I also tried using the original name, rather than the new (and now deleted) one: $ hg log --removed --follow foo.txt However, this only shows the history up until the rename, and not following it. The 'hg help revset' documentation has this to say for 'folow()' - I thought that providing the optional 'startrev' might solve it for me: "follow([file[, startrev]])" ... If file pattern is specified, the histories of files matching given pattern in the revision given by startrev are followed, including copies. But alas, this command also does not work (empty results): hg log --rev "follow('bar.txt', removes('bar.txt'))" Ultimately, I want a single command that I can run that will give me the entire history. Ideally, the input to this command would be the most recent name of the file - otherwise, I would have to remember the old name, which could have been from a long time ago. Perhaps there is some combination of revset functions that can achieve this? I'd be curious to know. Repro: $ hg --version Mercurial Distributed SCM (version 6.1.1+hg12.90e564882f07) $ export HGPLAIN=1 $ hg ini test2 $ cd test2 $ echo "initial data" > foo.txt $ hg add adding foo.txt $ hg ci -m "initial file" $ echo "blabla" >> foo.txt $ hg ci -m "some edit" $ hg mv foo.txt bar.txt $ hg ci -m "moved foo to bar" $ echo "moretext" >> bar.txt $ hg ci -m "edited as bar" $ hg log # shows full history of 4 changesets $ hg rm bar.txt $ hg ci -m "removed bar" $ hg log bar.txt # shows 2 changes: the rename of foo->bar, and the first edit of bar. This is a bit unintuitive to me on its own, but not my main complaint. $ hg log --follow bar.txt abort: cannot follow file not in parent revision: "bar.txt" $ hg log --rev "follow('bar.txt')" # (no output) $ hg log --removed bar.txt # shows 3 changes: rename, edit, removal (of bar.txt) $ hg log --rev "file('bar.txt')" # same 3 changes as above $ hg log --follow --removed bar.txt # same 3 changes (!) This is the bug, IMO. hg log --rev "follow('bar.txt', removes('bar.txt'))" # no results. Seems contrary to the 'hg help revset' documentation. -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel