hg revert somefile tip does the right thing but returns error

Uwe Brauer oub at mat.ucm.es
Thu Nov 12 16:24:21 UTC 2020


Hi

I sometimes have unwanted changes in one file, but correct changes in
others. I could run 
hg ci -i
but I prefer to clean up the mess as soon as possible

hg up -C 

Is out of question.

Please look at the following example
hg init
echo "First" > test.org
hg add test.org
hg commit  -m "First"
echo "Second" >> test.org
hg commit  -m "Second"
echo "Third" >> test.org
hg commit  -m "Third"
echo "Forth" >> test.org
hg commit  -m "Forth"
echo "New file" > test2.org
hg add test2.org
hg commit  -m "New file"
echo "Fifth" >> test.org
echo "Unwanted Change" >> test2.org

Now I can rid of the unwanted changes in test2.org
by 

 hg revert test2.org -r 4

And that is ok, but also 

 hg revert test2.org tip

That works but returns the strange error message

tip: no such file in rev cb8ba17ef4d5

It should have been 

hg revert test2.org -r tip

So tip was interpreted as a file not as a revision 
(hg up tip interprets tip as a revision) 

So the syntax is not very coherent

 hg up tip

Vs


 hg revert some file -r tip

Any comments?

Regards

Uwe Brauer 



More information about the Mercurial mailing list