comparison mercurial/subrepo.py @ 32206:09fb3d3b1b3a

py3: abuse r'' to access keys in keyword arguments
author Pulkit Goyal <7895pulkit@gmail.com>
date Wed, 03 May 2017 15:41:28 +0530
parents a77e61b45384
children f4cd4c49e302
comparison
equal deleted inserted replaced
32205:6c0ae9683437 32206:09fb3d3b1b3a
1876 removed.append(f) 1876 removed.append(f)
1877 1877
1878 deleted, unknown, ignored, clean = [], [], [], [] 1878 deleted, unknown, ignored, clean = [], [], [], []
1879 1879
1880 command = ['status', '--porcelain', '-z'] 1880 command = ['status', '--porcelain', '-z']
1881 if opts.get('unknown'): 1881 if opts.get(r'unknown'):
1882 command += ['--untracked-files=all'] 1882 command += ['--untracked-files=all']
1883 if opts.get('ignored'): 1883 if opts.get(r'ignored'):
1884 command += ['--ignored'] 1884 command += ['--ignored']
1885 out = self._gitcommand(command) 1885 out = self._gitcommand(command)
1886 1886
1887 changedfiles = set() 1887 changedfiles = set()
1888 changedfiles.update(modified) 1888 changedfiles.update(modified)
1906 if st == '??': 1906 if st == '??':
1907 unknown.append(filename1) 1907 unknown.append(filename1)
1908 elif st == '!!': 1908 elif st == '!!':
1909 ignored.append(filename1) 1909 ignored.append(filename1)
1910 1910
1911 if opts.get('clean'): 1911 if opts.get(r'clean'):
1912 out = self._gitcommand(['ls-files']) 1912 out = self._gitcommand(['ls-files'])
1913 for f in out.split('\n'): 1913 for f in out.split('\n'):
1914 if not f in changedfiles: 1914 if not f in changedfiles:
1915 clean.append(f) 1915 clean.append(f)
1916 1916
1919 1919
1920 @annotatesubrepoerror 1920 @annotatesubrepoerror
1921 def diff(self, ui, diffopts, node2, match, prefix, **opts): 1921 def diff(self, ui, diffopts, node2, match, prefix, **opts):
1922 node1 = self._state[1] 1922 node1 = self._state[1]
1923 cmd = ['diff', '--no-renames'] 1923 cmd = ['diff', '--no-renames']
1924 if opts['stat']: 1924 if opts[r'stat']:
1925 cmd.append('--stat') 1925 cmd.append('--stat')
1926 else: 1926 else:
1927 # for Git, this also implies '-p' 1927 # for Git, this also implies '-p'
1928 cmd.append('-U%d' % diffopts.context) 1928 cmd.append('-U%d' % diffopts.context)
1929 1929
1962 ui.write(output) 1962 ui.write(output)
1963 1963
1964 @annotatesubrepoerror 1964 @annotatesubrepoerror
1965 def revert(self, substate, *pats, **opts): 1965 def revert(self, substate, *pats, **opts):
1966 self.ui.status(_('reverting subrepo %s\n') % substate[0]) 1966 self.ui.status(_('reverting subrepo %s\n') % substate[0])
1967 if not opts.get('no_backup'): 1967 if not opts.get(r'no_backup'):
1968 status = self.status(None) 1968 status = self.status(None)
1969 names = status.modified 1969 names = status.modified
1970 for name in names: 1970 for name in names:
1971 bakname = scmutil.origpath(self.ui, self._subparent, name) 1971 bakname = scmutil.origpath(self.ui, self._subparent, name)
1972 self.ui.note(_('saving current version of %s as %s\n') % 1972 self.ui.note(_('saving current version of %s as %s\n') %
1973 (name, bakname)) 1973 (name, bakname))
1974 self.wvfs.rename(name, bakname) 1974 self.wvfs.rename(name, bakname)
1975 1975
1976 if not opts.get('dry_run'): 1976 if not opts.get(r'dry_run'):
1977 self.get(substate, overwrite=True) 1977 self.get(substate, overwrite=True)
1978 return [] 1978 return []
1979 1979
1980 def shortid(self, revid): 1980 def shortid(self, revid):
1981 return revid[:7] 1981 return revid[:7]