Bläddra i källkod

Add support for Mercurial

Steven Myint 11 år sedan
förälder
incheckning
bf7b7e16fa
1 ändrade filer med 7 tillägg och 2 borttagningar
  1. 7
    2
      src/cdiff.py

+ 7
- 2
src/cdiff.py Visa fil

@@ -474,8 +474,11 @@ def markup_to_pager(stream):
474 474
 
475 475
 def check_command_status(arguments):
476 476
     """Return True if command returns 0."""
477
-    return subprocess.call(
478
-        arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
477
+    try:
478
+        return subprocess.call(
479
+            arguments, stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
480
+    except OSError:
481
+        return False
479 482
 
480 483
 
481 484
 def revision_control_diff(path):
@@ -484,6 +487,8 @@ def revision_control_diff(path):
484 487
         return subprocess.Popen(['git', 'diff'], stdout=subprocess.PIPE).stdout
485 488
     elif check_command_status(['svn', 'info']):
486 489
         return subprocess.Popen(['svn', 'diff'], stdout=subprocess.PIPE).stdout
490
+    elif check_command_status(['hg', 'summary']):
491
+        return subprocess.Popen(['hg', 'diff'], stdout=subprocess.PIPE).stdout
487 492
 
488 493
 
489 494
 def decode(line):