# HG changeset patch
# Date 1368460404 -7200
# Branch stable
# Node ID b320ff3d10d18c66ff918cdd5f9fe75eea02d26d
# Parent b30e0080d313e3a7fec6095dd9a5418108d05200
sync: add new mode in postpull: update or rebase (closes #2551)
diff --git a/tortoisehg/hgqt/settings.py b/tortoisehg/hgqt/settings.py
--- a/tortoisehg/hgqt/settings.py
+++ b/tortoisehg/hgqt/settings.py
@@ -678,10 +678,11 @@
'standard tags inserted by the Mercurial Queues Extension. '
'Default: None (leave blank)')),
_fi(_('After Pull Operation'), 'tortoisehg.postpull', (genDefaultCombo,
- ['none', 'update', 'fetch', 'rebase']),
+ ['none', 'update', 'fetch', 'rebase', 'updateOrRebase']),
_('Operation which is performed directly after a successful pull. '
'update equates to pull --update, fetch equates to the fetch '
- 'extension, rebase equates to pull --rebase. Default: none')),
+ 'extension, rebase equates to pull --rebase, '
+ 'updateOrRebase equates to pull -u --rebase. Default: none')),
_fi(_('Default Push'), 'tortoisehg.defaultpush', (genDefaultCombo,
['all', 'branch', 'revision']),
_('Select the revisions that will be pushed by default, '
diff --git a/tortoisehg/hgqt/sync.py b/tortoisehg/hgqt/sync.py
--- a/tortoisehg/hgqt/sync.py
+++ b/tortoisehg/hgqt/sync.py
@@ -747,7 +747,7 @@
% (link, ret))
self.pullCompleted.emit()
# handle file conflicts during rebase
- if self.opts.get('rebase'):
+ if self.opts.get('rebase') or self.opts.get('updateOrRebase'):
if os.path.exists(self.repo.join('rebasestate')):
dlg = rebase.RebaseDialog(self.repo, self)
dlg.finished.connect(dlg.deleteLater)
@@ -771,6 +771,8 @@
cmdline += ['--rebase', '--config', uimerge]
elif self.cachedpp == 'update':
cmdline += ['--update', '--config', uimerge]
+ elif self.cachedpp == 'updateOrRebase':
+ cmdline += ['--update', '--rebase', '--config', uimerge]
elif self.cachedpp == 'fetch':
cmdline[2] = 'fetch'
elif self.opts.get('mq'):
@@ -1026,13 +1028,15 @@
layout.addWidget(self.fetch)
else:
self.fetch = None
- if 'rebase' in repo.extensions() or repo.postpull == 'rebase':
+ if 'rebase' in repo.extensions() or repo.postpull == 'rebase' or repo.postpull == 'updateOrRebase':
if 'rebase' in repo.extensions():
btntxt = _('Rebase - rebase local commits above pulled changes')
else:
btntxt = _('Rebase - use rebase extension (rebase is not active!)')
self.rebase = QRadioButton(btntxt)
layout.addWidget(self.rebase)
+ self.updateOrRebase = QRadioButton(_('UpdateOrRebase - pull, then try to update or rebase'))
+ layout.addWidget(self.updateOrRebase)
self.none.setChecked(True)
if repo.postpull == 'update':
@@ -1041,6 +1045,8 @@
self.fetch.setChecked(True)
elif repo.postpull == 'rebase':
self.rebase.setChecked(True)
+ elif repo.postpull == 'updateOrRebase':
+ self.updateOrRebase.setChecked(True)
self.autoresolve_chk = QCheckBox(_('Automatically resolve merge conflicts '
'where possible'))
@@ -1074,8 +1080,10 @@
return 'update'
elif (self.fetch and self.fetch.isChecked()):
return 'fetch'
+ elif (self.rebase and self.rebase.isChecked()):
+ return 'rebase'
else:
- return 'rebase'
+ return 'updateOrRebase'
def accept(self):
path = self.repo.join('hgrc')
diff --git a/tortoisehg/hgqt/thgrepo.py b/tortoisehg/hgqt/thgrepo.py
--- a/tortoisehg/hgqt/thgrepo.py
+++ b/tortoisehg/hgqt/thgrepo.py
@@ -372,7 +372,7 @@
@propertycache
def postpull(self):
pp = self.ui.config('tortoisehg', 'postpull')
- if pp in ('rebase', 'update', 'fetch'):
+ if pp in ('rebase', 'update', 'fetch', 'updateOrRebase'):
return pp
return 'none'