[PATCH] revert: simplify help message, better error message on reverting a merge

rupert THURNER rupert.thurner at gmail.com
Sat Jun 4 15:04:35 CDT 2011


# HG changeset patch
# User rupert THURNER <rupert.thurner at gmail.com>
# Date 1307217421 -7200
# Node ID f59a8551d77b724ff51857c8a6437e09e10505d7
# Parent  cd31a1cc15217a120cf58a5cd6ebb25c6ca270bf
revert: simplify help message, better error message on reverting a merge

Currently the help message of revert does not fit on a small terminal, but rephrasing a little bit makes it short enough to fit again. As well, trying a revert after rolling back a merge gives an error message which does not output a command which when applied again ends in an error message.

diff -r cd31a1cc1521 -r f59a8551d77b mercurial/commands.py
--- a/mercurial/commands.py	Sat Jun 04 20:01:01 2011 +0900
+++ b/mercurial/commands.py	Sat Jun 04 21:57:01 2011 +0200
@@ -4089,41 +4089,29 @@
     """restore individual files or directories to an earlier state
 
     .. note::
-       This command is most likely not what you are looking for.
-       Revert will partially overwrite content in the working
-       directory without changing the working directory parents. Use
+       Revert does not change the working directory parents. Use
        :hg:`update -r rev` to check out earlier revisions, or
        :hg:`update --clean .` to undo a merge which has added another
        parent.
 
-    With no revision specified, revert the named files or directories
-    to the contents they had in the parent of the working directory.
-    This restores the contents of the affected files to an unmodified
-    state and unschedules adds, removes, copies, and renames. If the
-    working directory has two parents, you must explicitly specify a
-    revision.
-
-    Using the -r/--rev option, revert the given files or directories
-    to their contents as of a specific revision. This can be helpful
-    to "roll back" some or all of an earlier change. See :hg:`help
-    dates` for a list of formats valid for -d/--date.
-
-    Revert modifies the working directory. It does not commit any
-    changes, or change the parent of the working directory. If you
-    revert to a revision other than the parent of the working
-    directory, the reverted files will thus appear modified
-    afterwards.
-
-    If a file has been deleted, it is restored. Files scheduled for
-    addition are just unscheduled and left as they are. If the
-    executable mode of a file was changed, it is reset.
+    Revert modifies the working directory. It restores the contents of the 
+    named files or directories to the contents they had in the parent of the
+    working directory, or the specified revision or date. If the working
+    directory has two parents, you must explicitly specify a revision.
+
+    It unschedules adds, removes, copies, and renames. If a file has been
+    deleted, it is restored. Files scheduled for addition are just unscheduled
+    and left as they are. If the executable mode of a file was changed, it is
+    reset. Modified files are saved with a .orig suffix before reverting. To
+    disable these backups, use --no-backup.
+
+    Revert does not commit any changes, or change the parent of the working
+    directory. If you revert to a revision other than the parent of the working
+    directory, the reverted files will thus appear modified afterwards.
 
     If names are given, all files matching the names are reverted.
     If no arguments are given, no files are reverted.
 
-    Modified files are saved with a .orig suffix before reverting.
-    To disable these backups, use --no-backup.
-
     Returns 0 on success.
     """
 
@@ -4135,7 +4123,7 @@
     parent, p2 = repo.dirstate.parents()
     if not opts.get('rev') and p2 != nullid:
         raise util.Abort(_('uncommitted merge - '
-                           'use "hg update", see "hg help revert"'))
+                           'use "hg update --clean", "hg revert -r"'))
 
     if not pats and not opts.get('all'):
         raise util.Abort(_('no files or directories specified; '
@@ -4976,7 +4964,7 @@
     [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
     ('c', 'check', None,
      _('update across branches if no uncommitted changes')),
-    ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
+    ('d', 'date', '', _('tipmost revision matching date, see "hg help dates"'), _('DATE')),
     ('r', 'rev', '', _('revision'), _('REV'))],
     _('[-c] [-C] [-d DATE] [[-r] REV]'))
 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):


More information about the Mercurial-devel mailing list