mark
mark

Reputation: 62746

How to get the log of all the mercurial changesets affecting files in a certain folder from a certain changeset up?

I have $HG_NODE referencing the changeset from which I wish to start:

[vcs@Quake /tmp/test/advanced]$ hg log -r $HG_NODE: --template '{node|short}:{files}\n'
c5eefea063fd:1.txt backup.cmd notes.txt
370f9ef91471:1.txt backup.cmd notes.txt
5eac12f79df6:advanced/Program.cs advanced/a advanced/b advanced/notes.txt lab6/scratch2/Fiobonacci.sln lab6/scratch2/Program.cs lab6/scratch2/xxx lab6/scratch2/yyy
4be96f43f327:advanced/1.txt
c724950dd2a6:advanced/Fiobonacci.csproj advanced/aaa.kuku

Now, I also have a directory, which is of a particular interest to me. So, I wish to get all the changesets from the starting one affecting the files in this directory.

First, I tried to check if I can get it for a specific file:

[vcs@Quake /tmp/test/advanced]$ hg log -r "$HG_NODE: and file('path:advanced/1.txt')" --template '{node|short}\n'
4be96f43f327

Then, for all the files in that directory. But I seem to be missing something:

[vcs@Quake /tmp/test/advanced]$ hg log -r "$HG_NODE: and file('path:advanced/**')" --template '{node|short}\n'
[vcs@Quake /tmp/test/advanced]$ hg log -r "$HG_NODE: and file('set:advanced/**')" --template '{node|short}\n'
abort: fileset expression with no context
[vcs@Quake /tmp/test/advanced]$ hg log -r "$HG_NODE: and file('glob:advanced/**')" --template '{node|short}\n'
[vcs@Quake /tmp/test/advanced]$ hg log -r "$HG_NODE: and file('advanced/**')" --template '{node|short}\n'
[vcs@Quake /tmp/test/advanced]$ hg log -r "$HG_NODE: and file('re:^advanced/.*')" --template '{node|short}\n'
5eac12f79df6
4be96f43f327
c724950dd2a6

Only the re: prefix works for me, but this is something that should work with glob: as well.

How can I make it work with glob: and ** ?

Upvotes: 1

Views: 982

Answers (1)

icabod
icabod

Reputation: 7074

After a little playing, I think it's because you are already in the advanced directory. Try one of the following options (assuming this is the case):

1) Specify only that you want to match the files in this directory:

$ hg log -r "$HG_NODE: and file('glob:**')" --template '{node|short}\n'
5eac12f79df6
4be96f43f327
c724950dd2a6

2) Go to the parent directory:

$ cd ..
$ hg log -r "$HG_NODE: and file('glob:advanced/**')" --template '{node|short}\n'
5eac12f79df6
4be96f43f327
c724950dd2a6

3) Use the path option, but don't specify the /**:

$ hg log -r "$HG_NODE: and file('path:advanced')" --template '{node|short}\n'
5eac12f79df6
4be96f43f327
c724950dd2a6

These options all seem to work in my small test repo.

Upvotes: 1

Related Questions