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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 01 Feb 2014 15:49:04 +0100
branch
5_4_x
changeset 3245
48311fa7c52c
parent 3240
7cb4665c9c05
child 3248
38d32752025c

Fixed an issue in Mercurial log dialogs showing a wrong diff for incoming changesets.
(grafted from a7e00607365891fceb2c6e994ff8c7983e2c35ff)

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:20:32 2014 +0100
+++ b/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py	Sat Feb 01 15:49:04 2014 +0100
@@ -582,7 +582,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 = \
@@ -641,6 +644,7 @@
         self.errors.clear()
         self.intercept = False
         
+        preargs = []
         args = []
         args.append(self.commandMode)
         self.vcs.addArguments(args, self.vcs.options['global'])
@@ -682,7 +686,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)
@@ -691,11 +700,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()
@@ -705,6 +721,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:20:32 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:20:32 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
@@ -1911,7 +1911,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