# HG changeset patch
# User Steve Losh <steve@stevelosh.com>
# Date 1286568600 14400
#      Fri Oct 08 16:10:00 2010 -0400
# Node ID 301d7626e0ff3eab32507c34da8c0f8112ed271f
# Parent  6c98107f787e44b45b02532b010d5d884f1cfafe
alias: back up and restore commands.norepo before checking for shell aliases

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -434,6 +434,7 @@
 
 def _checkshellalias(ui, args):
     cwd = os.getcwd()
+    norepo = commands.norepo
     options = {}
     args = fancyopts.fancyopts(args, commands.globalopts, options)
 
@@ -453,6 +454,7 @@
     try:
         aliases, entry = cmdutil.findcmd(cmd, cmdtable, lui.config("ui", "strict"))
     except error.UnknownCommand:
+        commands.norepo = norepo
         os.chdir(cwd)
         return
 
@@ -463,6 +465,7 @@
         d = lambda: fn(ui, *args[1:])
         return lambda: runcommand(lui, None, cmd, args[:1], ui, options, d, [], {})
 
+    commands.norepo = norepo
     os.chdir(cwd)
 
 _loaded = set()