##// END OF EJS Templates
subrepo: use environment variable instead of git commit's --date...
Eric Eisner -
r13095:49c7e875 default
parent child Browse files
Show More
@@ -613,14 +613,14 b' class gitsubrepo(object):'
613 self._path = ctx._repo.wjoin(path)
613 self._path = ctx._repo.wjoin(path)
614 self._ui = ctx._repo.ui
614 self._ui = ctx._repo.ui
615
615
616 def _gitcommand(self, commands, stream=False):
616 def _gitcommand(self, commands, env=None, stream=False):
617 return self._gitdir(commands, stream=stream)[0]
617 return self._gitdir(commands, env=env, stream=stream)[0]
618
618
619 def _gitdir(self, commands, stream=False):
619 def _gitdir(self, commands, env=None, stream=False):
620 commands = ['--no-pager'] + commands
620 commands = ['--no-pager'] + commands
621 return self._gitnodir(commands, stream=stream, cwd=self._path)
621 return self._gitnodir(commands, env=env, stream=stream, cwd=self._path)
622
622
623 def _gitnodir(self, commands, stream=False, cwd=None):
623 def _gitnodir(self, commands, env=None, stream=False, cwd=None):
624 """Calls the git command
624 """Calls the git command
625
625
626 The methods tries to call the git command. versions previor to 1.6.0
626 The methods tries to call the git command. versions previor to 1.6.0
@@ -631,7 +631,7 b' class gitsubrepo(object):'
631 cmd = util.quotecommand(' '.join(cmd))
631 cmd = util.quotecommand(' '.join(cmd))
632
632
633 # print git's stderr, which is mostly progress and useful info
633 # print git's stderr, which is mostly progress and useful info
634 p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=cwd,
634 p = subprocess.Popen(cmd, shell=True, bufsize=-1, cwd=cwd, env=env,
635 close_fds=util.closefds,
635 close_fds=util.closefds,
636 stdout=subprocess.PIPE)
636 stdout=subprocess.PIPE)
637 if stream:
637 if stream:
@@ -789,13 +789,15 b' class gitsubrepo(object):'
789
789
790 def commit(self, text, user, date):
790 def commit(self, text, user, date):
791 cmd = ['commit', '-a', '-m', text]
791 cmd = ['commit', '-a', '-m', text]
792 env = os.environ.copy()
792 if user:
793 if user:
793 cmd += ['--author', user]
794 cmd += ['--author', user]
794 if date:
795 if date:
795 # git's date parser silently ignores when seconds < 1e9
796 # git's date parser silently ignores when seconds < 1e9
796 # convert to ISO8601
797 # convert to ISO8601
797 cmd += ['--date', util.datestr(date, '%Y-%m-%dT%H:%M:%S %1%2')]
798 env['GIT_AUTHOR_DATE'] = util.datestr(date,
798 self._gitcommand(cmd)
799 '%Y-%m-%dT%H:%M:%S %1%2')
800 self._gitcommand(cmd, env=env)
799 # make sure commit works otherwise HEAD might not exist under certain
801 # make sure commit works otherwise HEAD might not exist under certain
800 # circumstances
802 # circumstances
801 return self._gitstate()
803 return self._gitstate()
General Comments 0
You need to be logged in to leave comments. Login now