Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.

Sat, 01 Feb 2014 15:49:04 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 01 Feb 2014 15:49:04 +0100
changeset 3242
a7e006073658
parent 3238
fa28dab59a9e
child 3243
bbaa32bb9e63

Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.

Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsMercurial/hg.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Fri Jan 31 12:12:56 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Feb 01 15:49:04 2014 +0100
@@ -601,7 +601,10 @@
         itm.setData(0, self.__messageRole, message)
         itm.setData(0, self.__changesRole, changedPaths)
         itm.setData(0, self.__edgesRole, edges)
-        itm.setData(0, self.__parentsRole, parents)
+        if parents == [-1]:
+            itm.setData(0, self.__parentsRole, [])
+        else:
+            itm.setData(0, self.__parentsRole, parents)
         
         if self.logTree.topLevelItemCount() > 1:
             topedges = \
@@ -660,6 +663,7 @@
         self.errors.clear()
         self.intercept = False
         
+        preargs = []
         args = []
         args.append(self.commandMode)
         self.vcs.addArguments(args, self.vcs.options['global'])
@@ -701,7 +705,12 @@
                 project = e5App().getObject("Project")
                 self.vcs.bundleFile = os.path.join(
                     project.getProjectManagementDir(), "hg-bundle.hg")
-                args.append('--bundle')
+                if os.path.exists(self.vcs.bundleFile):
+                    os.remove(self.vcs.bundleFile)
+                preargs = args[:]
+                preargs.append("--quiet")
+                preargs.append('--bundle')
+                preargs.append(self.vcs.bundleFile)
                 args.append(self.vcs.bundleFile)
         if not self.projectMode:
             args.append(self.filename)
@@ -710,11 +719,18 @@
             self.inputGroup.setEnabled(False)
             self.inputGroup.hide()
             
-            out, err = self.__hgClient.runcommand(args)
-            self.buf = out.splitlines(True)
+            if preargs:
+                out, err = self.__hgClient.runcommand(preargs)
+            else:
+                err = ""
             if err:
                 self.__showError(err)
-            self.__processBuffer()
+            else:
+                out, err = self.__hgClient.runcommand(args)
+                self.buf = out.splitlines(True)
+                if err:
+                    self.__showError(err)
+                self.__processBuffer()
             self.__finish()
         else:
             self.process.kill()
@@ -724,6 +740,14 @@
             self.inputGroup.setEnabled(True)
             self.inputGroup.show()
             
+            if preargs:
+                process = QProcess()
+                process.setWorkingDirectory(self.repodir)
+                process.start('hg', args)
+                procStarted = process.waitForStarted(5000)
+                if procStarted:
+                    process.waitForFinished(30000)
+            
             self.process.start('hg', args)
             procStarted = self.process.waitForStarted(5000)
             if not procStarted:
--- a/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py	Fri Jan 31 12:12:56 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogDialog.py	Sat Feb 01 15:49:04 2014 +0100
@@ -124,6 +124,7 @@
         self.activateWindow()
         self.raise_()
         
+        preargs = []
         args = []
         args.append(self.mode)
         self.vcs.addArguments(args, self.vcs.options['global'])
@@ -154,7 +155,12 @@
                 project = e5App().getObject("Project")
                 self.vcs.bundleFile = os.path.join(
                     project.getProjectManagementDir(), "hg-bundle.hg")
-                args.append('--bundle')
+                if os.path.exists(self.vcs.bundleFile):
+                    os.remove(self.vcs.bundleFile)
+                preargs = args[:]
+                preargs.append("--quiet")
+                preargs.append('--bundle')
+                preargs.append(self.vcs.bundleFile)
                 args.append(self.vcs.bundleFile)
         if revisions:
             for rev in revisions:
@@ -167,22 +173,35 @@
             self.inputGroup.setEnabled(False)
             self.inputGroup.hide()
             
-            out, err = self.__hgClient.runcommand(args)
-            
+            if preargs:
+                out, err = self.__hgClient.runcommand(preargs)
+            else:
+                err = ""
             if err:
                 self.__showError(err)
-            if out and self.isVisible():
-                for line in out.splitlines(True):
-                    self.__processOutputLine(line)
-                    if self.__hgClient.wasCanceled():
-                        break
-            
+            else:
+                out, err = self.__hgClient.runcommand(args)
+                if err:
+                    self.__showError(err)
+                if out and self.isVisible():
+                    for line in out.splitlines(True):
+                        self.__processOutputLine(line)
+                        if self.__hgClient.wasCanceled():
+                            break
             self.__finish()
         else:
             self.process.kill()
             
             self.process.setWorkingDirectory(self.repodir)
             
+            if preargs:
+                process = QProcess()
+                process.setWorkingDirectory(self.repodir)
+                process.start('hg', args)
+                procStarted = process.waitForStarted(5000)
+                if procStarted:
+                    process.waitForFinished(30000)
+            
             self.process.start('hg', args)
             procStarted = self.process.waitForStarted(5000)
             if not procStarted:
--- a/Plugins/VcsPlugins/vcsMercurial/hg.py	Fri Jan 31 12:12:56 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/hg.py	Sat Feb 01 15:49:04 2014 +0100
@@ -52,18 +52,18 @@
         """
         VersionControl.__init__(self, parent, name)
         self.defaultOptions = {
-            'global':   [''],
-            'commit':   [''],
+            'global': [''],
+            'commit': [''],
             'checkout': [''],
-            'update':   [''],
-            'add':      [''],
-            'remove':   [''],
-            'diff':     [''],
-            'log':      [''],
-            'history':  [''],
-            'status':   [''],
-            'tag':      [''],
-            'export':   ['']
+            'update': [''],
+            'add': [''],
+            'remove': [''],
+            'diff': [''],
+            'log': [''],
+            'history': [''],
+            'status': [''],
+            'tag': [''],
+            'export': ['']
         }
         
         self.__plugin = plugin
@@ -1940,7 +1940,8 @@
         if res:
             dia.exec_()
             res = dia.hasAddOrDelete()
-        if command == "unbundle":
+        if self.bundleFile and \
+           os.path.exists(self.bundleFile):
             os.remove(self.bundleFile)
             self.bundleFile = None
         self.checkVCSStatus()

eric ide

mercurial