File Status after pull

Peter Hosey boredzo at gmail.com
Mon Jul 13 07:02:27 CDT 2009


On Jul 13, 2009, at 03:59:09, mail at fabiantriefenbach.de wrote:
> "hg log FILE -r x:tip" but I have to know which rev was the tip  
> before.

Even if the tip changes, the new tip may be on a different branch from  
the old tip.

There are two things that are actually useful to look at:

1. The working copy
2. The changesets you received

You'd do #1 whenever you update, not only when you update as part of a  
pull.

To do it manually, use hg diff and pass the before and after parent  
revisions:

	hg diff -r.:tip file1 file2 file3
	hg diff -r.:0a1b2c3d4e5 file1 file2 file3

To do it automatically for every update, you'd use the preupdate hook:

	http://www.selenic.com/mercurial/hgrc.5.html#hooks

That hook receives the revision ID(s) of the new parent(s) in its  
environment. You may want to check whether the second parent is null;  
if it's not, that's a merge. Then, do the hg diff as before.

Note that this won't detect changes from the second new parent (if  
there is one) unless you specifically do a second hg diff to check for  
them.

For #2, use hg incoming with the {files} template keyword:

	hg incoming --template='{files}\n' [repository]

That will tell you what files are affected by the changesets that you  
will receive if you pull right now*. It's not newline-separated, so  
there's a chance of false positives if you grep it (for example, if  
you have folders named “Frameworks Folder”, “Additional  
Frameworks”, and “Folder Actions”, and you grep for the first  
one), but it's the best solution I can find.

*Where by “pull right now” I mean “had pulled instead of  
incominged”. If you pull after incoming, additional changesets may  
land in the remote repository in the brief interval between your  
incoming and your pull.




More information about the Mercurial mailing list