Can't recover removed file, what am I doing wrong?

Chris Green cl at isbd.net
Thu Mar 5 13:06:50 UTC 2020


On Thu, Mar 05, 2020 at 01:58:28PM +0100, Marcus wrote:
> On 05/03/2020 12.30, Chris Green wrote:
> > I thought I'd got the commands right but I can't get it to work:-
> > 
> >      chris$ hg log -r "removes(bin/hscan)"
> >      changeset:   308:3f97156f9387
> >      user:        chris <chris at isbd.co.uk>
> >      date:        Mon Jan 27 21:43:11 2020 +0000
> >      summary:     Removed because 'arp -a' is better, new script is called lan.
> >      chris$ hg revert -r 308 bin/hscan
> >      bin/hscan: no such file in rev 3f97156f9387
> >      chris$ hg revert -r 308:3f97156f9387 bin/hscan
> >      bin/hscan: no such file in rev 3f97156f9387
> > 
> > So what is the correct command to get my file back?
> 
> Shouldn't you revert to the commit *before* the file was removed, i.e. ‘-r
> 308^’?
> 
Brilliant! Yes, thank you.  "hg revert -r 308^ bin/hscan" got my file
back.  It was only to look at how I had done something in the past but
very handy nevertheless.

-- 
Chris Green



More information about the Mercurial mailing list