Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.0.1, 1.0.2, and 1.0.3

stable history: Unifying the push logic

The push logic from "Push outgoing changes" and
"Push to Here", were different, the force push option and
some dialogs were been used only in the first operation,
now the two are sharing the same logic

Changeset 3b79ca50bed6

Parent fd10e47d36b9

by Diego de Oliveira

Changes to one file · Browse files at 3b79ca50bed6 Showing diff from parent fd10e47d36b9 Diff from another changeset...

 
1933
1934
1935
1936
1937
 
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
 
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
 
 
 
2518
2519
2520
2521
2522
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2523
 
2524
2525
2526
 
 
2527
2528
2529
 
1933
1934
1935
 
 
1936
1937
 
 
 
 
1938
1939
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1940
1941
1942
 
2479
2480
2481
 
 
 
 
 
 
 
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
@@ -1933,39 +1933,10 @@
  self.show_dialog(dlg)     def push_clicked(self, toolbutton): - original_path = hglib.fromutf(self.pathentry.get_text()).strip() - remote_path = hglib.validate_synch_path(original_path, self.repo) + remote_path = self.validate_path()   if not remote_path: - gdialog.Prompt(_('No remote path specified'), - _('Please enter or select a remote path'), - self).run() - self.pathentry.grab_focus()   return   - confirm_push = False - if not hg.islocal(remote_path): - 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)?') % original_path - buttontext = _('Forced &Push') - else: - title = _('Confirm Push to remote Repository') - text = _('Push to remote repository\n%s\n?') % original_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)?') % original_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 -   cmdline = ['hg', 'push'] + self.get_proxy_args()   if self.forcepush:   cmdline += ['--force'] @@ -2508,22 +2479,55 @@
  statopts)   dialog.display()   - def push_to(self, menuitem): - remote_path = hglib.fromutf(self.pathentry.get_text()).strip() - for alias, path in self.repo.ui.configitems('paths'): - if remote_path == alias: - remote_path = path - elif remote_path == url.hidepassword(path): - remote_path = path + def validate_path(self): + original_path = hglib.fromutf(self.pathentry.get_text()).strip() + remote_path = hglib.validate_synch_path(original_path, self.repo)   if not remote_path:   gdialog.Prompt(_('No remote path specified'),   _('Please enter or select a remote path'),   self).run()   self.pathentry.grab_focus() + return None + else: + confirm_push = False + if not hg.islocal(remote_path): + 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)?') % original_path + buttontext = _('Forced &Push') + else: + title = _('Confirm Push to remote Repository') + text = _('Push to remote repository\n%s\n?') % original_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)?') % original_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 None + else: + return remote_path + else: + return remote_path + + def push_to(self, menuitem): + remote_path = self.validate_path() + if not remote_path:   return +   node = self.repo[self.currevid].node()   rev = str(self.currevid)   cmdline = ['hg', 'push', '--rev', rev, remote_path] + if self.forcepush: + cmdline += ['--force']     def callback(return_code, *args):   if return_code == 0: