| 
				
			 | 
			
			
				@@ -471,7 +471,7 @@ class DiffMarkup(object): 
			 | 
		
	
		
			
			| 
				471
			 | 
			
				471
			 | 
			
			
				                 yield line 
			 | 
		
	
		
			
			| 
				472
			 | 
			
				472
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				473
			 | 
			
				473
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				474
			 | 
			
				
			 | 
			
			
				-def markup_to_pager(stream): 
			 | 
		
	
		
			
			| 
				
			 | 
			
				474
			 | 
			
			
				+def markup_to_pager(stream, opts): 
			 | 
		
	
		
			
			| 
				475
			 | 
			
				475
			 | 
			
			
				     markup = DiffMarkup(stream) 
			 | 
		
	
		
			
			| 
				476
			 | 
			
				476
			 | 
			
			
				     color_diff = markup.markup(side_by_side=opts.side_by_side, 
			 | 
		
	
		
			
			| 
				477
			 | 
			
				477
			 | 
			
			
				             width=opts.width) 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -510,7 +510,7 @@ def decode(line): 
			 | 
		
	
		
			
			| 
				510
			 | 
			
				510
			 | 
			
			
				         return line 
			 | 
		
	
		
			
			| 
				511
			 | 
			
				511
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				512
			 | 
			
				512
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				513
			 | 
			
				
			 | 
			
			
				-if __name__ == '__main__': 
			 | 
		
	
		
			
			| 
				
			 | 
			
				513
			 | 
			
			
				+def main(): 
			 | 
		
	
		
			
			| 
				514
			 | 
			
				514
			 | 
			
			
				     import optparse 
			 | 
		
	
		
			
			| 
				515
			 | 
			
				515
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				516
			 | 
			
				516
			 | 
			
			
				     supported_vcs = [check[0] for check, _ in REVISION_CONTROL] 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -541,7 +541,7 @@ if __name__ == '__main__': 
			 | 
		
	
		
			
			| 
				541
			 | 
			
				541
			 | 
			
			
				             sys.stderr.write(('*** Not in a supported workspace, supported ' 
			 | 
		
	
		
			
			| 
				542
			 | 
			
				542
			 | 
			
			
				                               'are: %s\n\n') % ', '.join(supported_vcs)) 
			 | 
		
	
		
			
			| 
				543
			 | 
			
				543
			 | 
			
			
				             parser.print_help() 
			 | 
		
	
		
			
			| 
				544
			 | 
			
				
			 | 
			
			
				-            sys.exit(1) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				544
			 | 
			
			
				+            return 1 
			 | 
		
	
		
			
			| 
				545
			 | 
			
				545
			 | 
			
			
				     else: 
			 | 
		
	
		
			
			| 
				546
			 | 
			
				546
			 | 
			
			
				         diff_hdl = sys.stdin 
			 | 
		
	
		
			
			| 
				547
			 | 
			
				547
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -550,14 +550,14 @@ if __name__ == '__main__': 
			 | 
		
	
		
			
			| 
				550
			 | 
			
				550
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				551
			 | 
			
				551
			 | 
			
			
				     # Don't let empty diff pass thru 
			 | 
		
	
		
			
			| 
				552
			 | 
			
				552
			 | 
			
			
				     if not stream: 
			 | 
		
	
		
			
			| 
				553
			 | 
			
				
			 | 
			
			
				-        sys.exit(0) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				553
			 | 
			
			
				+        return 0 
			 | 
		
	
		
			
			| 
				554
			 | 
			
				554
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				555
			 | 
			
				555
			 | 
			
			
				     if diff_hdl is not sys.stdin: 
			 | 
		
	
		
			
			| 
				556
			 | 
			
				556
			 | 
			
			
				         diff_hdl.close() 
			 | 
		
	
		
			
			| 
				557
			 | 
			
				557
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				558
			 | 
			
				558
			 | 
			
			
				     if sys.stdout.isatty(): 
			 | 
		
	
		
			
			| 
				559
			 | 
			
				559
			 | 
			
			
				         try: 
			 | 
		
	
		
			
			| 
				560
			 | 
			
				
			 | 
			
			
				-            markup_to_pager(stream) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				560
			 | 
			
			
				+            markup_to_pager(stream, opts) 
			 | 
		
	
		
			
			| 
				561
			 | 
			
				561
			 | 
			
			
				         except IOError: 
			 | 
		
	
		
			
			| 
				562
			 | 
			
				562
			 | 
			
			
				             e = sys.exc_info()[1] 
			 | 
		
	
		
			
			| 
				563
			 | 
			
				563
			 | 
			
			
				             if e.errno == errno.EPIPE: 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -566,6 +566,8 @@ if __name__ == '__main__': 
			 | 
		
	
		
			
			| 
				566
			 | 
			
				566
			 | 
			
			
				         # pipe out stream untouched to make sure it is still a patch 
			 | 
		
	
		
			
			| 
				567
			 | 
			
				567
			 | 
			
			
				         sys.stdout.write(''.join(stream)) 
			 | 
		
	
		
			
			| 
				568
			 | 
			
				568
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				569
			 | 
			
				
			 | 
			
			
				-    sys.exit(0) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				569
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				570
			 | 
			
			
				+if __name__ == '__main__': 
			 | 
		
	
		
			
			| 
				
			 | 
			
				571
			 | 
			
			
				+    sys.exit(main()) 
			 | 
		
	
		
			
			| 
				570
			 | 
			
				572
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				571
			 | 
			
				573
			 | 
			
			
				 # vim:set et sts=4 sw=4 tw=80: 
			 |