[PATCH] require full command name for revert

TK Soh teekaysoh at yahoo.com
Fri May 5 15:13:10 CDT 2006


The revert command can create some potentially unpleasent surprises, so
it'd help to make sure users know what they are doing.

# HG changeset patch
# User TK Soh <teekaysoh at yahoo.com>
# Node ID 00f3f85c04941050b56d1d7083dd6429d22638e0
# Parent  b8b7a79a4d8823acd9a7527a234577cb60873b9a
require full command name for revert

diff -r b8b7a79a4d88 -r 00f3f85c0494 mercurial/commands.py
--- a/mercurial/commands.py	Thu May 04 22:38:14 2006 -0700
+++ b/mercurial/commands.py	Fri May 05 14:58:55 2006 -0500
@@ -3093,6 +3093,7 @@ globalopts = [
     ('h', 'help', None, _('display help and exit')),
 ]
 
+noprefixmatch = ("revert")
 norepo = ("clone init version help debugancestor debugcomplete debugdata"
           " debugindex debugindexdot")
 optionalrepo = ("paths serve debugconfig")
@@ -3139,6 +3140,9 @@ def find(cmd):
         raise AmbiguousCommand(cmd, clist)
 
     if choice:
+        actual = choice.keys()[0]
+        if actual in noprefixmatch.split() and not cmd == actual:
+            raise UnknownCommand(cmd)
         return choice.values()[0]
 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Mercurial mailing list