Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

commit: fix operation outside of repo root.

* Perform all repo operations via cmdui.Runner
* Always pass --repository to commands
* Remove chdir() hacks
* allow cmdui to build display strings
* Do _not_ use commandStarted signal to increment repo busy count, it is
emitted once for every commandline given to the runner.

Changeset c611afcda895

Parent c05d9a6caeaf

by Steve Borho

Changes to one file · Browse files at c611afcda895 Showing diff from parent c05d9a6caeaf Diff from another changeset...

 
48
49
50
51
52
53
54
 
471
472
473
474
475
476
477
478
479
480
481
 
482
483
484
 
534
535
536
 
 
537
538
539
 
542
543
544
545
 
 
 
546
547
548
 
553
554
555
556
 
 
 
557
558
559
 
567
568
569
570
571
 
 
 
572
573
574
575
576
577
578
579
 
 
580
581
582
583
584
585
586
 
 
 
 
 
587
588
 
589
590
591
592
593
594
595
596
597
598
 
48
49
50
 
51
52
53
 
470
471
472
 
 
 
 
 
 
 
 
473
474
475
476
 
526
527
528
529
530
531
532
533
 
536
537
538
 
539
540
541
542
543
544
 
549
550
551
 
552
553
554
555
556
557
 
565
566
567
 
 
568
569
570
571
572
 
573
574
575
576
577
578
579
580
 
 
 
 
 
 
581
582
583
584
585
586
587
588
589
590
591
592
593
594
 
595
596
597
@@ -48,7 +48,6 @@
    self.repo = repo = self.stwidget.repo   self.runner = cmdui.Runner(_('Commit'), self, logwidget) - self.runner.commandStarted.connect(repo.incrementBusyCount)   self.runner.commandFinished.connect(self.commandFinished)     repo.configChanged.connect(self.configChanged) @@ -471,14 +470,7 @@
  return None     def commit(self): - cwd = os.getcwd() - try: - os.chdir(self.repo.root) - return self._commit(self.repo) - finally: - os.chdir(cwd) - - def _commit(self, repo): + repo = self.repo   msg = self.getMessage()   if not msg:   qtlib.WarningMsgBox(_('Nothing Commited'), @@ -534,6 +526,8 @@
  return   self.addUsernameToHistory(user)   + commandlines = [] +   checkedUnknowns = self.stwidget.getChecked('?I')   if checkedUnknowns:   res = qtlib.CustomPrompt( @@ -542,7 +536,9 @@
  (_('&OK'), _('Cancel')), 0, 1,   checkedUnknowns).run()   if res == 0: - dispatch._dispatch(repo.ui, ['add'] + checkedUnknowns) + cmd = ['add', '--repository', repo.root] + \ + [repo.wjoin(f) for f in checkedUnknowns] + commandlines.append(cmd)   else:   return   checkedMissing = self.stwidget.getChecked('!') @@ -553,7 +549,9 @@
  (_('&OK'), _('Cancel')), 0, 1,   checkedMissing).run()   if res == 0: - dispatch._dispatch(repo.ui, ['remove'] + checkedMissing) + cmd = ['remove', '--repository', repo.root] + \ + [repo.wjoin(f) for f in checkedMissing] + commandlines.append(cmd)   else:   return   try: @@ -567,32 +565,33 @@
  self.showMessage.emit(hglib.tounicode(str(e)))   dcmd = []   - cmdline = ['commit', '--verbose', '--user', user, '--message', msg] - cmdline += dcmd + brcmd + files + cmdline = ['commit', '--repository', repo.root, + '--verbose', '--user', user, '--message', msg] + cmdline += dcmd + brcmd + [repo.wjoin(f) for f in files]   if self.qref:   cmdline[0] = 'qrefresh' -   for fname in self.opts.get('autoinc', '').split(','):   fname = fname.strip()   if fname:   cmdline.extend(['--include', fname])   + commandlines.append(cmdline) +   if self.opts.get('pushafter'): - pushcmd = ['push', self.opts['pushafter']] - display = ' '.join(['hg'] + cmdline + ['&&'] + pushcmd) - self.runner.run(cmdline, pushcmd, display=display) - else: - display = ' '.join(['hg'] + cmdline) - self.runner.run(cmdline, display=display) + cmd = ['push', '--repository', repo.root, self.opts['pushafter']] + commandlines.append(cmd) + + repo.incrementBusyCount() + self.runner.run(*commandlines)     def commandFinished(self, wrapper): + self.repo.decrementBusyCount()   if not wrapper.data:   self.addMessageToHistory()   if not self.qref:   self.msgte.clear()   self.msgte.document().setModified(False)   self.commitComplete.emit() - self.repo.decrementBusyCount()   self.stwidget.refreshWctx()     def keyPressEvent(self, event):