subrepo: show git command with --debug
authorEric Eisner <ede@mit.edu>
Thu, 09 Dec 2010 16:52:14 -0500
changeset 13110 cad35f06c031
parent 13109 53341289eaf8
child 13111 560b8001f765
subrepo: show git command with --debug Also removing the clutter of --no-pager, since none of these commands use the pager.
mercurial/subrepo.py
--- a/mercurial/subrepo.py	Thu Dec 09 16:52:14 2010 -0500
+++ b/mercurial/subrepo.py	Thu Dec 09 16:52:14 2010 -0500
@@ -614,7 +614,6 @@
         return self._gitdir(commands, env=env, stream=stream)[0]
 
     def _gitdir(self, commands, env=None, stream=False):
-        commands = ['--no-pager'] + commands
         return self._gitnodir(commands, env=env, stream=stream, cwd=self._path)
 
     def _gitnodir(self, commands, env=None, stream=False, cwd=None):
@@ -623,6 +622,7 @@
         The methods tries to call the git command. versions previor to 1.6.0
         are not supported and very probably fail.
         """
+        self._ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands)))
         # print git's stderr, which is mostly progress and useful info
         p = subprocess.Popen(['git'] + commands, bufsize=-1, cwd=cwd, env=env,
                              close_fds=util.closefds,
@@ -636,15 +636,12 @@
 
         if p.returncode != 0 and p.returncode != 1:
             # there are certain error codes that are ok
-            command = None
-            for arg in commands:
-                if not arg.startswith('-'):
-                    command = arg
-                    break
+            command = commands[0]
             if command == 'cat-file':
                 return retdata, p.returncode
             # for all others, abort
-            raise util.Abort('git %s error %d' % (command, p.returncode))
+            raise util.Abort('git %s error %d in %s' %
+                             (command, p.returncode, self._relpath))
 
         return retdata, p.returncode