eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffGenerator.py

branch
maintenance
changeset 8142
43248bafe9b2
parent 8043
0acf98cd089a
parent 8108
a42ae6be4cc3
child 8273
698ae46f40a4
--- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffGenerator.py	Mon Feb 01 10:38:43 2021 +0100
+++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgDiffGenerator.py	Tue Mar 02 17:12:08 2021 +0100
@@ -52,7 +52,7 @@
         if version == "WORKING":
             return None
         else:
-            return str(version)
+            return str(version).strip()
     
     def start(self, fn, versions=None, bundle=None, qdiff=False):
         """
@@ -91,13 +91,19 @@
                     rev2 = self.__getVersionArg(versions[1])
                 
                 if rev1 is not None or rev2 is not None:
-                    args.append('-r')
-                    if rev1 is not None and rev2 is not None:
-                        args.append('{0}:{1}'.format(rev1, rev2))
-                    elif rev2 is None:
-                        args.append(rev1)
-                    elif rev1 is None:
-                        args.append(':{0}'.format(rev2))
+                    if self.vcs.version >= (5, 7, 0):
+                        if rev1 is not None:
+                            args += ["--from", rev1]
+                        if rev2 is not None:
+                            args += ["--to", rev2]
+                    else:
+                        args.append('-r')
+                        if rev1 is not None and rev2 is not None:
+                            args.append('{0}:{1}'.format(rev1, rev2))
+                        elif rev2 is None:
+                            args.append(rev1)
+                        elif rev1 is None:
+                            args.append(':{0}'.format(rev2))
         
         if fn:
             if isinstance(fn, list):

eric ide

mercurial