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

history: use CmdRunner for incoming/outgoing operations

Changeset e816730f92da

Parent 82af965e84c0

by Yuki KODAMA

Changes to one file · Browse files at e816730f92da Showing diff from parent 82af965e84c0 Diff from another changeset...

 
137
138
139
 
140
141
142
 
1282
1283
1284
1285
1286
 
1287
1288
1289
 
1291
1292
1293
1294
1295
1296
1297
1298
1299
 
 
 
 
 
 
 
 
 
 
 
1300
1301
1302
 
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1436
1437
1438
 
137
138
139
140
141
142
143
 
1283
1284
1285
 
 
1286
1287
1288
1289
 
1291
1292
1293
 
 
 
 
 
 
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
 
1420
1421
1422
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
@@ -137,6 +137,7 @@
  self.revrange = None   self.forcepush = False   self.bundle_autoreject = False + self.runner = hgcmd.CmdRunner()   os.chdir(self.repo.root)     # Load extension support for commands which need it @@ -1282,8 +1283,7 @@
    bfile = path   path = hglib.validate_synch_path(path, self.repo) - - +   for badchar in (':', '*', '\\', '?', '#'):   bfile = bfile.replace(badchar, '')   bfile = bfile.replace('/', '_') @@ -1291,12 +1291,17 @@
  cmdline = ['hg', 'incoming', '--bundle', bfile]   cmdline += self.get_proxy_args()   cmdline += [path] - dlg = hgcmd.CmdDialog(cmdline, text='hg incoming') - dlg.show_all() - dlg.run() - dlg.hide() - if dlg.return_code() == 0 and os.path.isfile(bfile): - self.set_bundlefile(bfile) + + def callback(return_code, *args): + self.stbar.end() + if return_code == 0 and os.path.isfile(bfile): + self.set_bundlefile(bfile) + if self.runner.execute(cmdline, callback): + self.stbar.begin(_('Checking incoming changesets...')) + else: + gdialog.Prompt(_('Cannot run now'), + _('Please try again after running ' + 'operation is completed'), self).run()     def set_bundlefile(self, bfile, **kwopts):   self.origurl = self.urlcombo.get_active() @@ -1415,24 +1420,26 @@
  cmd += self.get_proxy_args()   cmd += [hglib.validate_synch_path(path, self.repo)]   - dlg = hgcmd.CmdDialog(cmd, text='hg outgoing') - dlg.show_all() - dlg.run() - dlg.hide() - if dlg.return_code() == 0: - outgoing = [] - buf = dlg.textbuffer - begin, end = buf.get_bounds() - for line in buf.get_text(begin, end).splitlines()[:-1]: - try: - node = self.repo[line].node() - outgoing.append(node) - except: - pass - self.outgoing = outgoing - self.reload_log() - text = _('%d outgoing changesets') % len(outgoing) - self.stbar.set_idle_text(text) + def callback(return_code, msg, *args): + self.stbar.end() + if return_code == 0: + outgoing = [] + for line in msg.splitlines()[:-1]: + try: + node = self.repo[line].node() + outgoing.append(node) + except: + pass + self.outgoing = outgoing + self.reload_log() + text = _('%d outgoing changesets') % len(outgoing) + self.stbar.set_idle_text(text) + if self.runner.execute(cmd, callback): + self.stbar.begin(_('Checking outgoing changesets...')) + else: + gdialog.Prompt(_('Cannot run now'), + _('Please try again after running ' + 'operation is completed'), self).run()     def email_clicked(self, toolbutton):   path = hglib.fromutf(self.pathentry.get_text()).strip()