# HG changeset patch
# User Arun Kulshreshtha <kulsh...@fb.com>
# Date 1474324457 25200
#      Mon Sep 19 15:34:17 2016 -0700
# Node ID 0bb030bb1ce94c5514b671a3900ba207ebb19269
# Parent  69499ec91691f952a8a28092c361a0e3daccc429
dispatch: change indentation level in _dispatch()

Add an if True: placeholder for a profiling context manager that
will be added in the next commit, for the purpose of reducing size
of the diff due to trivial indentation changes.

This change should be a no-op.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -844,60 +844,63 @@
     elif not cmd:
         return commands.help_(ui, 'shortlist')
 
-    repo = None
-    cmdpats = args[:]
-    if not _cmdattr(ui, cmd, func, 'norepo'):
-        # use the repo from the request only if we don't have -R
-        if not rpath and not cwd:
-            repo = req.repo
+    if True:
+        repo = None
+        cmdpats = args[:]
+        if not _cmdattr(ui, cmd, func, 'norepo'):
+            # use the repo from the request only if we don't have -R
+            if not rpath and not cwd:
+                repo = req.repo
 
-        if repo:
-            # set the descriptors of the repo ui to those of ui
-            repo.ui.fin = ui.fin
-            repo.ui.fout = ui.fout
-            repo.ui.ferr = ui.ferr
-        else:
-            try:
-                repo = hg.repository(ui, path=path)
-                if not repo.local():
-                    raise error.Abort(_("repository '%s' is not local") % path)
-                repo.ui.setconfig("bundle", "mainreporoot", repo.root, 'repo')
-            except error.RequirementError:
-                raise
-            except error.RepoError:
-                if rpath and rpath[-1]: # invalid -R path
+            if repo:
+                # set the descriptors of the repo ui to those of ui
+                repo.ui.fin = ui.fin
+                repo.ui.fout = ui.fout
+                repo.ui.ferr = ui.ferr
+            else:
+                try:
+                    repo = hg.repository(ui, path=path)
+                    if not repo.local():
+                        raise error.Abort(_("repository '%s' is not local")
+                                            % path)
+                    repo.ui.setconfig("bundle", "mainreporoot", repo.root,
+                                      'repo')
+                except error.RequirementError:
                     raise
-                if not _cmdattr(ui, cmd, func, 'optionalrepo'):
-                    if (_cmdattr(ui, cmd, func, 'inferrepo') and
-                        args and not path):
-                        # try to infer -R from command args
-                        repos = map(cmdutil.findrepo, args)
-                        guess = repos[0]
-                        if guess and repos.count(guess) == len(repos):
-                            req.args = ['--repository', guess] + fullargs
-                            return _dispatch(req)
-                    if not path:
-                        raise error.RepoError(_("no repository found in '%s'"
-                                                " (.hg not found)")
-                                              % os.getcwd())
-                    raise
-        if repo:
-            ui = repo.ui
-            if options['hidden']:
-                repo = repo.unfiltered()
-        args.insert(0, repo)
-    elif rpath:
-        ui.warn(_("warning: --repository ignored\n"))
+                except error.RepoError:
+                    if rpath and rpath[-1]: # invalid -R path
+                        raise
+                    if not _cmdattr(ui, cmd, func, 'optionalrepo'):
+                        if (_cmdattr(ui, cmd, func, 'inferrepo') and
+                            args and not path):
+                            # try to infer -R from command args
+                            repos = map(cmdutil.findrepo, args)
+                            guess = repos[0]
+                            if guess and repos.count(guess) == len(repos):
+                                req.args = ['--repository', guess] + fullargs
+                                return _dispatch(req)
+                        if not path:
+                            raise error.RepoError(_("no repository found in"
+                                                    " '%s' (.hg not found)")
+                                                  % os.getcwd())
+                        raise
+            if repo:
+                ui = repo.ui
+                if options['hidden']:
+                    repo = repo.unfiltered()
+            args.insert(0, repo)
+        elif rpath:
+            ui.warn(_("warning: --repository ignored\n"))
 
-    msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
-    ui.log("command", '%s\n', msg)
-    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
-    try:
-        return runcommand(lui, repo, cmd, fullargs, ui, options, d,
-                          cmdpats, cmdoptions)
-    finally:
-        if repo and repo != req.repo:
-            repo.close()
+        msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
+        ui.log("command", '%s\n', msg)
+        d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
+        try:
+            return runcommand(lui, repo, cmd, fullargs, ui, options, d,
+                              cmdpats, cmdoptions)
+        finally:
+            if repo and repo != req.repo:
+                repo.close()
 
 def _runcommand(ui, options, cmd, cmdfunc):
     """Run a command function, possibly with profiling enabled."""
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to