# HG changeset patch # User Eric Eisner # Date 1291688247 18000 # Node ID 49c7e875482dc5fb1cea6c9e2fdb3180588a972f # Parent a1dd7bd26a2b4fce269f8ea4efdf9365e6e18e2f subrepo: use environment variable instead of git commit's --date Older git versions do not have a --date flag. diff -r a1dd7bd26a2b -r 49c7e875482d mercurial/subrepo.py --- a/mercurial/subrepo.py Mon Dec 06 21:17:27 2010 -0500 +++ b/mercurial/subrepo.py Mon Dec 06 21:17:27 2010 -0500 @@ -613,14 +613,14 @@ self._path = ctx._repo.wjoin(path) self._ui = ctx._repo.ui - def _gitcommand(self, commands, stream=False): - return self._gitdir(commands, stream=stream)[0] + def _gitcommand(self, commands, env=None, stream=False): + return self._gitdir(commands, env=env, stream=stream)[0] - def _gitdir(self, commands, stream=False): + def _gitdir(self, commands, env=None, stream=False): commands = ['--no-pager'] + commands - return self._gitnodir(commands, stream=stream, cwd=self._path) + return self._gitnodir(commands, env=env, stream=stream, cwd=self._path) - def _gitnodir(self, commands, stream=False, cwd=None): + def _gitnodir(self, commands, env=None, stream=False, cwd=None): """Calls the git command The methods tries to call the git command. versions previor to 1.6.0 @@ -631,7 +631,7 @@ cmd = util.quotecommand(' '.join(cmd)) # print git's stderr, which is mostly progress and useful info - p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=cwd, + p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=cwd, env=env, close_fds=util.closefds, stdout=subprocess.PIPE) if stream: @@ -789,13 +789,15 @@ def commit(self, text, user, date): cmd = ['commit', '-a', '-m', text] + env = os.environ.copy() if user: cmd += ['--author', user] if date: # git's date parser silently ignores when seconds < 1e9 # convert to ISO8601 - cmd += ['--date', util.datestr(date, '%Y-%m-%dT%H:%M:%S %1%2')] - self._gitcommand(cmd) + env['GIT_AUTHOR_DATE'] = util.datestr(date, + '%Y-%m-%dT%H:%M:%S %1%2') + self._gitcommand(cmd, env=env) # make sure commit works otherwise HEAD might not exist under certain # circumstances return self._gitstate()