tags:

views:

30

answers:

2

I know about hgtk log command but it is working for directory not for a file.

If I execute something like this

hgtk log -R D:\bmutilities\big_repo\chrome\content\br_editor.js

It throws an error saying---directory not found

But if run hgtk command in D:\bmutilities\big_repo\chrome\content\ directory

hgtk log -R br_editor.js

it works fine...

Suggestions please ????

A: 

UPDATE

I understand your question better now. You mean that you cannot view the history of a file from the command line if you are not in a folder under the .hg root folder.

That appears to be a design decision by mercurial.

I just make sure I cd to a folder inside the repo before I do hgtk log on a specific file.

John Weldon
so should I do something like this ..hgExe = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);hgExe.initWithPath("C:\\windows\\system32\\cmd.exe");process = Components.classes["@mozilla.org/process/util;1"]. createInstance(Components.interfaces.nsIProcess);blocking = true;process.init(hgExe)args = ["D:"];process.run(blocking,args,args.length);args = ["CD", "D:\\my_repo\\"];process.run(blocking,args,args.length);args = ["hgtk","log",fileName];process.run(blocking,args,args.length);
Nitesh
@Nitesh; yes... but that's hard to read; I would just say: 'In your script, first change directory to the repo root, and then do the hgtk log' :)
John Weldon
sorry about that...I am executing process.run() again and again with different arguments assuming it will keep track of previous process...am I making any sense ?process.run(true,["cd","d:\myrepo\"],2];process.run(true,["hgtk","log","myfile.txt"],3);Now is it clear what I mean ?
Nitesh
+1  A: 

You use the --repository or -R option to specify the path to the repository. After that, the filenames are relative to that directory. In this sense, hgtk -R works like hg --cwd meaning that it actually changes the current working directory.

Mercurial also has a --repository (-R) command like switch, but this does not change the current working directory of the process.

Martin Geisler