Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

Merge with stable

Changeset 1408d349ac7e

Parents 0865a2485b59

Parents 53ca55f9aa39

by Adrian Buehlmann

Changes to 6 files · Browse files at 1408d349ac7e Showing diff from parent 0865a2485b59 53ca55f9aa39 Diff from another changeset...

 
617
618
619
 
620
621
622
623
624
 
625
626
627
 
617
618
619
620
621
622
623
624
625
626
627
628
629
@@ -617,11 +617,13 @@
  self.commitButtonEnable.emit(False)   self.runner.run(*commandlines)   self.stopAction.setEnabled(True) + self.progress.emit(*cmdui.startProgress(_('Commit'), ''))     def stop(self):   self.runner.cancel()     def commandFinished(self, ret): + self.progress.emit(*cmdui.stopProgress(_('Commit')))   self.stopAction.setEnabled(False)   self.commitButtonEnable.emit(True)   self.repo.decrementBusyCount()
 
782
783
784
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
786
787
788
789
 
 
 
 
790
791
792
793
794
 
 
795
796
797
 
799
800
801
802
 
803
804
805
 
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
 
 
 
 
802
803
804
805
806
807
808
 
 
809
810
811
812
813
 
815
816
817
 
818
819
820
821
@@ -782,16 +782,32 @@
    # Capture drop events, try to import into current patch queue   + def detectPatches(self, paths): + filepaths = [] + for p in paths: + if not os.path.isfile(p): + continue + try: + pf = open(p, 'rb') + filename, message, user, date, branch, node, p1, p2 = \ + patch.extract(self.repo.ui, pf) + if filename: + filepaths.append(p) + os.unlink(filename) + except Exception, e: + pass + return filepaths +   def dragEnterEvent(self, event): - event.acceptProposedAction() - - def dragMoveEvent(self, event): - event.acceptProposedAction() + paths = [unicode(u.toLocalFile()) for u in event.mimeData().urls()] + if self.detectPatches(paths): + event.setDropAction(Qt.CopyAction) + event.accept()     def dropEvent(self, event):   paths = [unicode(u.toLocalFile()) for u in event.mimeData().urls()] - filepaths = [p for p in paths if os.path.isfile(p)] - if filepaths: + patches = self.detectPatches(paths) + if patches:   event.setDropAction(Qt.CopyAction)   event.accept()   else: @@ -799,7 +815,7 @@
  return   dlg = thgimport.ImportDialog(self.repo, self, mq=True)   dlg.finished.connect(dlg.deleteLater) - dlg.setfilepaths(filepaths) + dlg.setfilepaths(patches)   dlg.exec_()     # End drop events
 
9
10
11
12
 
13
14
15
 
435
436
437
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
438
439
440
 
441
442
443
444
445
446
447
448
449
450
 
 
 
 
 
 
451
452
453
 
9
10
11
 
12
13
14
15
 
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
 
456
457
458
459
460
461
 
 
 
 
 
462
463
464
465
466
467
468
469
470
@@ -9,7 +9,7 @@
 import binascii  import os   -from mercurial import util, revset, error +from mercurial import util, revset, error, patch    from tortoisehg.util import shlib, hglib   @@ -435,19 +435,36 @@
  self.generateMultipleSelectionMenu()   self.generateBundleMenu()   + def detectPatches(self, paths): + filepaths = [] + for p in paths: + if not os.path.isfile(p): + continue + try: + pf = open(p, 'rb') + filename, message, user, date, branch, node, p1, p2 = \ + patch.extract(self.repo.ui, pf) + if filename: + filepaths.append(p) + os.unlink(filename) + except Exception, e: + pass + return filepaths +   def dragEnterEvent(self, event):   paths = [unicode(u.toLocalFile()) for u in event.mimeData().urls()] - if util.any(os.path.isfile(p) for p in paths): + if self.detectPatches(paths):   event.setDropAction(Qt.CopyAction)   event.accept()     def dropEvent(self, event):   paths = [unicode(u.toLocalFile()) for u in event.mimeData().urls()] - filepaths = [p for p in paths if os.path.isfile(p)] - if filepaths: - self.thgimport(filepaths) - event.setDropAction(Qt.CopyAction) - event.accept() + patches = self.detectPatches(paths) + if not patches: + return + event.setDropAction(Qt.CopyAction) + event.accept() + self.thgimport(patches)     ## Begin Workbench event forwards  
 
575
576
577
578
579
580
581
 
 
 
 
 
 
 
 
582
583
584
 
575
576
577
 
 
 
 
578
579
580
581
582
583
584
585
586
587
588
@@ -575,10 +575,14 @@
 _pctxcache = {}  def genPatchContext(repo, patchpath, rev=None):   global _pctxcache - if os.path.exists(patchpath) and patchpath in _pctxcache: - cachedctx = _pctxcache[patchpath] - if cachedctx._mtime == os.path.getmtime(patchpath): - return cachedctx + try: + if os.path.exists(patchpath) and patchpath in _pctxcache: + cachedctx = _pctxcache[patchpath] + if cachedctx._mtime == os.path.getmtime(patchpath) and \ + cachedctx._fsize == os.path.getsize(patchpath): + return cachedctx + except EnvironmentError: + pass   # create a new context object   ctx = patchctx(patchpath, repo, rev=rev)   _pctxcache[patchpath] = ctx
 
392
393
394
395
 
396
397
398
 
603
604
605
606
607
608
609
610
611
612
 
392
393
394
 
395
396
397
398
 
603
604
605
 
 
 
 
606
607
608
@@ -392,7 +392,7 @@
  for u in d.urls():   root = self.find_root(u)   if root: - self.openRepo(root) + self.showRepo(root)   accept = True   if accept:   event.setDropAction(Qt.LinkAction) @@ -603,10 +603,6 @@
  for rw in self._findrepowidget(root):   rw.goto(rev)   - def reloadRepository(self, root): - for rw in self._findrepowidget(root): - rw.reload() -   def _findrepowidget(self, root):   """Iterates RepoWidget for the specified root"""   tw = self.repoTabsWidget
 
41
42
43
 
44
45
46
 
 
47
48
49
50
51
52
 
41
42
43
44
45
46
47
48
49
50
51
 
52
53
54
@@ -41,12 +41,14 @@
  self._node = node.nullid   self._identity = node.nullid   self._mtime = None + self._fsize = 0   self._parseerror = None     try: + self._mtime = os.path.getmtime(patchpath) + self._fsize = os.path.getsize(patchpath)   ph = mq.patchheader(self._path)   self._ph = ph - self._mtime = os.path.getmtime(patchpath)   hash = util.sha1(self._path)   hash.update(str(self._mtime))   self._identity = hash.digest()