Mercurial > hg
comparison mcabber/contrib/merge_history.py @ 1117:de14c419b323
Added merge_history.py to contrib
author | Frank Zschockelt <jdev@freakysoft.de> |
---|---|
date | Fri, 05 Jan 2007 17:39:07 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1114:2ba26f6c060f | 1117:de14c419b323 |
---|---|
1 #!/usr/bin/env python | |
2 # This script is provided under the terms of the GNU General Public License, | |
3 # see the file COPYING in the root mcabber source directory. | |
4 # | |
5 # Frank Zschockelt, 05.01.2007 | |
6 | |
7 import sys | |
8 | |
9 if(len(sys.argv) != 3): | |
10 print "usage:",sys.argv[0],"histA histB > histA+B" | |
11 sys.exit(0) | |
12 file=open(sys.argv[1], "r") | |
13 linesA=file.readlines() | |
14 file.close() | |
15 file=open(sys.argv[2], "r") | |
16 linesB=file.readlines() | |
17 file.close() | |
18 | |
19 i=j=0 | |
20 while(i<len(linesA) and j < len(linesB)): | |
21 if(linesA[i][3:20] <= linesB[j][3:20]): | |
22 l=int(linesA[i][22:25]) | |
23 for s in linesA[i:i+l+1]: | |
24 print s, | |
25 if(linesA[i]==linesB[j]): | |
26 j+=l+1 | |
27 i+=l+1 | |
28 else: | |
29 l=int(linesB[j][22:25]) | |
30 for s in linesB[j:j+l+1]: | |
31 print s, | |
32 j+=l+1 | |
33 | |
34 for s in linesA[i:len(linesA)]: | |
35 print s, | |
36 for s in linesB[j:len(linesB)]: | |
37 print s, | |
38 |