changeset 7477:1e8d7339f350

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Sat, 06 Dec 2008 20:17:45 +0100
parents b2cbced7bb50 (diff) 6644c111f9e9 (current diff)
children ecfb683675ed
files
diffstat 8 files changed, 65 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/zsh_completion	Sat Dec 06 20:10:31 2008 +0100
+++ b/contrib/zsh_completion	Sat Dec 06 20:17:45 2008 +0100
@@ -4,14 +4,13 @@
 # it into your zsh function path (/usr/share/zsh/site-functions for
 # instance)
 #
-# Copyright (C) 2005 Steve Borho
+# Copyright (C) 2005-6 Steve Borho
 # Copyright (C) 2006-8 Brendan Cully <brendan@kublai.com>
 #
 # This is free software; you can redistribute it and/or modify it under
 # the terms of the GNU General Public License as published by the Free
 # Software Foundation; either version 2 of the License, or (at your
 # option) any later version.
-#
 
 emulate -LR zsh
 setopt extendedglob
@@ -117,28 +116,54 @@
 _hg_get_commands() {
   typeset -ga _hg_cmd_list
   typeset -gA _hg_alias_list
-  local hline cmd cmdalias
-  _call_program help hg --verbose help | while read -A hline
+  local hline cmd cmdalias helpstate
+  local helpmode=$1
+
+  _call_program help hg --verbose help $helpmode 2>/dev/null | while read -A hline
   do
-    cmd="$hline[1]"
-    case $cmd in
-      *:)
-        cmd=${cmd%:}
-        _hg_cmd_list+=($cmd)
-      ;;
-      *,)
-        cmd=${cmd%,}
-        _hg_cmd_list+=($cmd)
-        integer i=2
-        while (( i <= $#hline ))
-        do
-          cmdalias=${hline[$i]%(:|,)}
-          _hg_cmd_list+=($cmdalias)
-          _hg_alias_list+=($cmdalias $cmd)
-          (( i++ ))
-        done
-      ;;
-    esac
+    if [ "$hline" = "list of commands:" ]
+    then
+      helpstate="commands"
+      continue
+    elif [ "$hline" = "enabled extensions:" ]
+    then
+      helpstate="extensions"
+      continue
+    elif [ "$hline" = "additional help topics:" ]
+    then
+      helpstate="topics"
+      continue
+    fi
+
+    if [ "$helpstate" = commands ]
+    then
+      cmd="$hline[1]"
+      case $cmd in
+        *:)
+          cmd=${cmd%:}
+          _hg_cmd_list+=($cmd)
+        ;;
+        *,)
+          cmd=${cmd%,}
+          _hg_cmd_list+=($cmd)
+          integer i=2
+          while (( i <= $#hline ))
+          do
+            cmdalias=${hline[$i]%(:|,)}
+            _hg_cmd_list+=($cmdalias)
+            _hg_alias_list+=($cmdalias $cmd)
+            (( i++ ))
+          done
+        ;;
+      esac
+    elif [ -z "$helpmode" -a "$helpstate" = extensions ]
+    then
+      cmd="$hline[1]"
+      if [ -n "$cmd" ]
+      then
+        _hg_get_commands $cmd
+      fi
+    fi
   done
 }
 
--- a/hgext/convert/cvs.py	Sat Dec 06 20:10:31 2008 +0100
+++ b/hgext/convert/cvs.py	Sat Dec 06 20:17:45 2008 +0100
@@ -144,11 +144,11 @@
                             if branch == "HEAD":
                                 branch = ""
                             if branch:
-                                latest = None
+                                latest = 0
                                 # the last changeset that contains a base
                                 # file is our parent
                                 for r in oldrevs:
-                                    latest = max(filerevids.get(r, None), latest)
+                                    latest = max(filerevids.get(r, 0), latest)
                                 if latest:
                                     p = [latest]
 
--- a/mercurial/changelog.py	Sat Dec 06 20:10:31 2008 +0100
+++ b/mercurial/changelog.py	Sat Dec 06 20:17:45 2008 +0100
@@ -179,7 +179,7 @@
 
         user = user.strip()
         if "\n" in user:
-            raise RevlogError(_("username %s contains a newline") % `user`)
+            raise RevlogError(_("username %s contains a newline") % repr(user))
         user, desc = util.fromlocal(user), util.fromlocal(desc)
 
         if date:
--- a/mercurial/dispatch.py	Sat Dec 06 20:10:31 2008 +0100
+++ b/mercurial/dispatch.py	Sat Dec 06 20:17:45 2008 +0100
@@ -90,7 +90,7 @@
             else:
                 raise
     except socket.error, inst:
-        ui.warn(_("abort: %s\n") % inst[-1])
+        ui.warn(_("abort: %s\n") % inst.args[-1])
     except IOError, inst:
         if hasattr(inst, "code"):
             ui.warn(_("abort: %s\n") % inst)
@@ -100,7 +100,7 @@
             except: # it might be anything, for example a string
                 reason = inst.reason
             ui.warn(_("abort: error: %s\n") % reason)
-        elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
+        elif hasattr(inst, "args") and inst.args[0] == errno.EPIPE:
             if ui.debugflag:
                 ui.warn(_("broken pipe\n"))
         elif getattr(inst, "strerror", None):
@@ -116,13 +116,13 @@
         else:
             ui.warn(_("abort: %s\n") % inst.strerror)
     except util.UnexpectedOutput, inst:
-        ui.warn(_("abort: %s") % inst[0])
-        if not isinstance(inst[1], basestring):
-            ui.warn(" %r\n" % (inst[1],))
-        elif not inst[1]:
+        ui.warn(_("abort: %s") % inst.args[0])
+        if not isinstance(inst.args[1], basestring):
+            ui.warn(" %r\n" % (inst.args[1],))
+        elif not inst.args[1]:
             ui.warn(_(" empty string\n"))
         else:
-            ui.warn("\n%r\n" % util.ellipsis(inst[1]))
+            ui.warn("\n%r\n" % util.ellipsis(inst.args[1]))
     except ImportError, inst:
         m = str(inst).split()[-1]
         ui.warn(_("abort: could not import module %s!\n") % m)
--- a/mercurial/ui.py	Sat Dec 06 20:10:31 2008 +0100
+++ b/mercurial/ui.py	Sat Dec 06 20:17:45 2008 +0100
@@ -350,7 +350,7 @@
         if not user:
             raise util.Abort(_("Please specify a username."))
         if "\n" in user:
-            raise util.Abort(_("username %s contains a newline\n") % `user`)
+            raise util.Abort(_("username %s contains a newline\n") % repr(user))
         return user
 
     def shortuser(self, user):
--- a/mercurial/util.py	Sat Dec 06 20:10:31 2008 +0100
+++ b/mercurial/util.py	Sat Dec 06 20:17:45 2008 +0100
@@ -705,7 +705,7 @@
         if cwd is not None and oldcwd != cwd:
             os.chdir(oldcwd)
 
-class SignatureError:
+class SignatureError(Exception):
     pass
 
 def checksignature(func):
--- a/mercurial/util_win32.py	Sat Dec 06 20:10:31 2008 +0100
+++ b/mercurial/util_win32.py	Sat Dec 06 20:17:45 2008 +0100
@@ -19,7 +19,7 @@
 import util
 from win32com.shell import shell,shellcon
 
-class WinError:
+class WinError(Exception):
     winerror_map = {
         winerror.ERROR_ACCESS_DENIED: errno.EACCES,
         winerror.ERROR_ACCOUNT_DISABLED: errno.EACCES,
--- a/tests/test-bdiff	Sat Dec 06 20:10:31 2008 +0100
+++ b/tests/test-bdiff	Sat Dec 06 20:17:45 2008 +0100
@@ -9,13 +9,13 @@
     if d:
         c = mpatch.patches(a, [d])
     if c != b:
-        print "***", `a`, `b`
+        print "***", repr(a), repr(b)
         print "bad:"
-        print `c`[:200]
-        print `d`
+        print repr(c)[:200]
+        print repr(d)
 
 def test(a, b):
-    print "***", `a`, `b`
+    print "***", repr(a), repr(b)
     test1(a, b)
     test1(b, a)