equal
deleted
inserted
replaced
22 |
22 |
23 from .i18n import _ |
23 from .i18n import _ |
24 from . import ( |
24 from . import ( |
25 cmdutil, |
25 cmdutil, |
26 config, |
26 config, |
|
27 encoding, |
27 error, |
28 error, |
28 exchange, |
29 exchange, |
29 filemerge, |
30 filemerge, |
30 match as matchmod, |
31 match as matchmod, |
31 node, |
32 node, |
1100 cmd.extend(commands) |
1101 cmd.extend(commands) |
1101 if filename is not None: |
1102 if filename is not None: |
1102 path = self.wvfs.reljoin(self._ctx.repo().origroot, |
1103 path = self.wvfs.reljoin(self._ctx.repo().origroot, |
1103 self._path, filename) |
1104 self._path, filename) |
1104 cmd.append(path) |
1105 cmd.append(path) |
1105 env = dict(os.environ) |
1106 env = dict(encoding.environ) |
1106 # Avoid localized output, preserve current locale for everything else. |
1107 # Avoid localized output, preserve current locale for everything else. |
1107 lc_all = env.get('LC_ALL') |
1108 lc_all = env.get('LC_ALL') |
1108 if lc_all: |
1109 if lc_all: |
1109 env['LANG'] = lc_all |
1110 env['LANG'] = lc_all |
1110 del env['LC_ALL'] |
1111 del env['LC_ALL'] |
1396 The methods tries to call the git command. versions prior to 1.6.0 |
1397 The methods tries to call the git command. versions prior to 1.6.0 |
1397 are not supported and very probably fail. |
1398 are not supported and very probably fail. |
1398 """ |
1399 """ |
1399 self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands))) |
1400 self.ui.debug('%s: git %s\n' % (self._relpath, ' '.join(commands))) |
1400 if env is None: |
1401 if env is None: |
1401 env = os.environ.copy() |
1402 env = encoding.environ.copy() |
1402 # disable localization for Git output (issue5176) |
1403 # disable localization for Git output (issue5176) |
1403 env['LC_ALL'] = 'C' |
1404 env['LC_ALL'] = 'C' |
1404 # fix for Git CVE-2015-7545 |
1405 # fix for Git CVE-2015-7545 |
1405 if 'GIT_ALLOW_PROTOCOL' not in env: |
1406 if 'GIT_ALLOW_PROTOCOL' not in env: |
1406 env['GIT_ALLOW_PROTOCOL'] = 'file:git:http:https:ssh' |
1407 env['GIT_ALLOW_PROTOCOL'] = 'file:git:http:https:ssh' |
1631 @annotatesubrepoerror |
1632 @annotatesubrepoerror |
1632 def commit(self, text, user, date): |
1633 def commit(self, text, user, date): |
1633 if self._gitmissing(): |
1634 if self._gitmissing(): |
1634 raise error.Abort(_("subrepo %s is missing") % self._relpath) |
1635 raise error.Abort(_("subrepo %s is missing") % self._relpath) |
1635 cmd = ['commit', '-a', '-m', text] |
1636 cmd = ['commit', '-a', '-m', text] |
1636 env = os.environ.copy() |
1637 env = encoding.environ.copy() |
1637 if user: |
1638 if user: |
1638 cmd += ['--author', user] |
1639 cmd += ['--author', user] |
1639 if date: |
1640 if date: |
1640 # git's date parser silently ignores when seconds < 1e9 |
1641 # git's date parser silently ignores when seconds < 1e9 |
1641 # convert to ISO8601 |
1642 # convert to ISO8601 |