Re: Find revisions associated to a given file

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Find revisions associated to a given file

Giorgos Keramidas
On 2007-07-09 12:32, Mathieu Clabaut <[hidden email]> wrote:

> Ok...
> I certainly can do a bruteforce search like:
>
> hg log --template '{node}\n' myfile | while read ver; do hg cat -r $ver
> myfile > /tmp/hgcat.$$; cmp /tmp/hgcat.$$ myreferencefile && echo "found
> $ver";  done
>
> But I wondered if there was a quicker mean by using indexes and hashes to
> find the file...
> I guess not, and I will stick to the aforementioned script.
>
> Thank you for your advice.

If you know parts of the filename, you can use:

    $ hg log --template '{rev}:{files}\n' | fgrep al-test
    4351:contrib/mercurial-test.sh
    $

Then you can 'filter' the {rev} part with awk(1) and further explore the
changesets you matched in this first step:

    $ hg log --template '{rev}:{files}\n' | fgrep al-test | \
      awk -F: '{print $1}'
    4351
    $

    $ hg log --template '{rev}:{files}\n' | fgrep al-test | \
      awk -F: '{print $1}' | xargs -n1 hg log -r
    changeset:   4351:24e13561536f
    user:        Giorgos Keramidas <[hidden email]>
    date:        Fri Mar 23 02:26:41 2007 +0200
    summary:     contrib: add 'mercurial-test.sh' for automated test suite runs

    $

_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: Find revisions associated to a given file

Mathieu Clabaut
On 7/9/07, Giorgos Keramidas <[hidden email]> wrote:
On 2007-07-09 12:32, Mathieu Clabaut <[hidden email]> wrote:
> Ok...
> I certainly can do a bruteforce search like:
>
> hg log --template '{node}\n' myfile | while read ver; do hg cat -r $ver
> myfile > /tmp/hgcat.$$; cmp /tmp/hgcat.$$ myreferencefile && echo "found
> $ver";  done

If you know parts of the filename, you can use:

Yes, I eventually use the above trick (I did know the filename.... I just had to find the revision(s) where the file exactly match the one in mercurial repo). It was not a so brute search as there was few modifications done to this file in the history.

-mathieu



_______________________________________________
Mercurial mailing list
[hidden email]
http://selenic.com/mailman/listinfo/mercurial