File History vs. Path History
Paul Mensonides
pmenso57 at comcast.net
Sat Jan 19 08:17:31 UTC 2013
Hi all.
Is it possible to extract a history for a particular file as opposed to a
particular path? For example,
hg init repo
cd repo
# 0
touch A
hg add A
hg ci -m "added A"
# 1
hg mv A B
hg ci -m "moved A to B"
# 2
touch A
hg add A
hg ci -m "added (new) A"
If I now say
hg log A
the output refers to revision 0 which seems bizarre to me. The lifetime
of A in the working copy began at revision 2, not revision 0.
Is it possible to extract a history of a particular file instead--i.e. the
first A independently from the second (unrelated) A?
0 1 2
+-------+ +-------+
| A A |--| *R A | +-------+
+-------+ | *A B |--| C B |-->
+-------+ | A A |-->
+-------+
If I instead say
hg log --removed A
the output refers to all three revisions which is not what I want either.
The same thing appears to happen without the actual move.
# 3
touch C
hg add C
hg ci -m "added C"
# 4
hg rm C
hg ci -m "removed C"
# 5
touch C
hg add C
hg ci -m "added (new) C"
The output of
hg log C
refers to revision 3 (similar to above).
0 1 2 3 4 5
+-------+ +-------+
| A A |--| *R A | +-------+ +-------+ +-------+ +-------+
+-------+ | *A B |--| C B |--| C B |--| C B |--| C B |-->
+-------+ | A A |--| C A |--| C A |--| C A |-->
+-------+ | A C |--| R C | | |
+-------+ +-------+ | A C |-->
+-------+
Explicitly, what I actually need (wian) is all changesets which are
descendants of a particular changeset which affect a particular file (with
a --follow variation). E.g.
hg wian -r 0 A
=> changesets 0 and 1
hg wian -r 1 B
=> changeset 1
hg wian -r 2 A
=> changeset 2
hg wian -r 3 C
=> changesets 3 and 4
hg wian -r 5 C
=> changeset 5
Is this possible with the current command set? If not, does the
repository actually contain the information necessary to do this?
Specifically, in the latter, are copies and moves actually tracked or are
they just implied?
Regards,
Paul Mensonides
More information about the Mercurial
mailing list