Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

stable history: add push confirmation dialog

If the push is to a non-local repo or forced, ask for confirmation
by user before pushing, since this may publish changesets.

Changeset 1dab5d2926ad

Parent c39ac49f885e

by Adrian Buehlmann

Changes to 2 files · Browse files at 1dab5d2926ad Showing diff from parent c39ac49f885e Diff from another changeset...

 
30
31
32
33
 
34
35
 
36
37
38
 
30
31
32
 
33
34
 
35
36
37
38
@@ -30,9 +30,9 @@
     class Prompt(SimpleMessage): - def __init__(self, title, message, parent): + def __init__(self, title, message, parent, type=gtk.MESSAGE_INFO):   SimpleMessage.__init__(self, parent, gtk.DIALOG_MODAL, - gtk.MESSAGE_INFO, gtk.BUTTONS_CLOSE) + type, gtk.BUTTONS_CLOSE)   self.set_title(hglib.toutf(title))   self.set_markup('<b>' + hglib.toutf(message) + '</b>')   mod = gtklib.get_thg_modifier()
 
1390
1391
1392
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1393
1394
1395
 
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
@@ -1390,6 +1390,38 @@
  self).run()   self.pathentry.grab_focus()   return + + confirm_push = False + try: + dest_repo = hg.repository(self.ui, path=remote_path) + if not dest_repo.local(): + if self.forcepush: + title = _('Confirm Forced Push to Remote Repository') + text = _('Forced push to remote repository\n%s\n' + '(creating new heads in remote if needed)?') % remote_path + buttontext = _('Forced &Push') + else: + title = _('Confirm Push to remote Repository') + text = _('Push to remote repository\n%s\n?') % remote_path + buttontext = _('&Push') + confirm_push = True + elif self.forcepush: + title = _('Confirm Forced Push') + text = _('Forced push to repository\n%s\n' + '(creating new heads if needed)?') % remote_path + buttontext = _('Forced &Push') + confirm_push = True + if confirm_push: + dlg = gdialog.CustomPrompt(title, text, + None, (buttontext, _('&Cancel')), default=1, esc=1) + if dlg.run() != 0: + return + except hglib.RepoError, e: + dlg = gdialog.Prompt(_('Invalid Remote Repository'), str(e), self, + type=gtk.MESSAGE_ERROR) + dlg.run() + return +   cmdline = ['hg', 'push'] + self.get_proxy_args()   if self.forcepush:   cmdline += ['--force']