comparison hgext/mq.py @ 26943:263edb591b72

mq: let the user choose where .orig files are kept This patch uses cmdutil.origpath to let the user decide where .orig files are kept when backup files are created.
author Christian Delahousse <cdelahousse@fb.com>
date Tue, 10 Nov 2015 14:52:54 -0800
parents 0a7610758c42
children 05d8db5d2116
comparison
equal deleted inserted replaced
26942:d55d22840592 26943:263edb591b72
695 # backup local changes in --force case 695 # backup local changes in --force case
696 for f in sorted(files): 696 for f in sorted(files):
697 absf = repo.wjoin(f) 697 absf = repo.wjoin(f)
698 if os.path.lexists(absf): 698 if os.path.lexists(absf):
699 self.ui.note(_('saving current version of %s as %s\n') % 699 self.ui.note(_('saving current version of %s as %s\n') %
700 (f, f + '.orig')) 700 (f, cmdutil.origpath(self.ui, repo, f)))
701
702 absorig = cmdutil.origpath(self.ui, repo, absf)
701 if copy: 703 if copy:
702 util.copyfile(absf, absf + '.orig') 704 util.copyfile(absf, absorig)
703 else: 705 else:
704 util.rename(absf, absf + '.orig') 706 util.rename(absf, absorig)
705 707
706 def printdiff(self, repo, diffopts, node1, node2=None, files=None, 708 def printdiff(self, repo, diffopts, node1, node2=None, files=None,
707 fp=None, changes=None, opts={}): 709 fp=None, changes=None, opts={}):
708 stat = opts.get('stat') 710 stat = opts.get('stat')
709 m = scmutil.match(repo[node1], files, opts) 711 m = scmutil.match(repo[node1], files, opts)