[PATCH RFC] revert: improve warning part of help text

Adrian Buehlmann adrian at cadifra.com
Mon Jun 6 04:54:09 CDT 2011


On 2011-06-06 11:32, Adrian Buehlmann wrote:
> And the culmination of "foot shooting" is probably specifying '-r'
> together with '--all', iff REV is not a parent:
> 
>   $ hg par -q
>   4:8765e19eea07
> 
>   $ hg revert --all -r 2
>   reverting foo
>   reverting x.txt
> 
> which truly has the potential to make the newbies believe they got what
> they intended.
> 
> Perhaps we should ponder implementing something like
> 
>   $ hg revert --all -r 2
>   abort: revision 2 is not a parent revision!
>   (use update to sync with that revision or use revert -f to force)
> 
>   (The expert user nods here and reaches for the -f switch. Newbie
>   calls his favorite local Mercurial expert and ask him what the
>   heck is wrong.)
> 
>   $ hg revert -f --all -r 2
>   reverting foo
>   reverting x.txt

Another thought worth pondering is: Is 'revert' really the right command
name to do such a thing?

Perhaps we should consider a replace command:

  $ hg par -q
  4:8765e19eea07

  $ hg revert --all -r 2
  abort: revision 2 is not a parent revision!
  (use update to sync with that revision or use replace)

  $ hg replace --all -r 2
  replacing foo
  replacing x.txt

  $ hg help -q replace
  hg replace [OPTION]... -r REV [NAME]...

  replace individual files or directories with a specific revision

I mean, if I want to revert a single file to its content in the parent
revision, then 'hg revert' is most definitely the command I was looking
for, right? But what I am not looking for is replace it with a random
revision.




More information about the Mercurial-devel mailing list