Reputation: 3669
I notice a mistake in file original.txt
. How can I then find all files copy.txt
that have ever been created via hg copy original.txt copy.txt
?
I looked at Mercurial revset. The only time "copies" are mentioned there is:
"follow([file[, startrev]])"
An alias for"::."
(ancestors of the working directory's first parent). Iffile
pattern is specified, the histories of files matching given pattern in the revision given bystartrev
are followed, including copies.
So apparently using something like hg log -r "follow('copy.txt')"
I could find that it was copied from original.txt
, but not the inverse (where original.txt
was copied to).
How can I find the copied files?
Upvotes: 1
Views: 107
Reputation: 97282
Dirty way
(may give FP without corrections on mergesets when signal-string merged to new file)
If you have unique data (across all files in repo) in original.txt
you can grep repo for this string like hg grep -ldq "ID"
More natural way
Because renaming file for changeset is "delete old file, add new", you can
removes(original.txt)
use special template -T"{file_copies}\n"
for log
hg log -r "removes(original.txt)" -T"{file_copies}\n" original.txt
revset can be reused as parametrized revsetalias (for any file), log with revset+template can be also converted to alias
Addition
For less-noise output for "just copy" changesets modified revset can be used (TBT!, I'm too lazy)
-r "! modifies(original.txt)"
Upvotes: 2