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

rupert THURNER rupert.thurner at gmail.com
Mon Jun 6 00:24:44 CDT 2011


# HG changeset patch
# User rupert THURNER <rupert.thurner at gmail.com>
# Date 1307337677 -7200
# Node ID 986bc79f5c28b986d0f1177fa2c23bc8ac012c81
# Parent  e597ef52a7c21ffe862339225bd915438f2dddcc
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. Trying a revert after rolling back a merge gives an error message which may confuse. Print a command which should execute without leading to an error message again.

diff -r e597ef52a7c2 -r 986bc79f5c28 mercurial/commands.py
--- a/mercurial/commands.py	Sun Jun 05 22:26:01 2011 +0200
+++ b/mercurial/commands.py	Mon Jun 06 07:21:17 2011 +0200
@@ -4090,40 +4090,29 @@
 
     .. 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 +4124,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 +4965,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