[Answer]-HG – Find current running revision of a code file

1👍

If the file has been modified then it’s likely it isn’t any prior version, but a hand edit. (Bad) People live edit files on servers all the time, whereas Mercurial (and git) won’t let you check out a single version of a single file w/o really intending to do so.

If you’re sure it’s really a prior version you could do:

for rev in $(seq $(hg id -n -r tip) 0) ; do
    echo CHECKING REVISION $rev
    hg diff -r $rev THEFILENAME
done

and look for the one with no output

0👍

You can use hg id -i to see the currently checked out revision on your server, and hg status to check if the file has been modified relative to that revision.

👤yole

Leave a comment