Comments
Patch
@@ -869,13 +869,26 @@
return t
- def system(self, cmd, environ=None, cwd=None, onerr=None, errprefix=None):
+ def system(self, cmd, environ=None, cwd=None, onerr=None, errprefix=None,
+ repo=None):
'''execute shell command with appropriate output stream. command
output will be redirected if fout is not stdout.
+
+ If 'repo' is specified, external command is executed with
+ 'HG_PENDING' environment variable according to current
+ transaction activity.
'''
out = self.fout
if any(s[1] for s in self._bufferstates):
out = self
+
+ if repo:
+ repo.dirstate.write(repo)
+ tr = repo.currenttransaction()
+ if tr and tr.writepending():
+ environ = environ.copy() # to avoid changing specified dict
+ environ['HG_PENDING'] = repo.root
+
return util.system(cmd, environ=environ, cwd=cwd, onerr=onerr,
errprefix=errprefix, out=out)