Show More
@@ -49,6 +49,26 b' def showhelp():' | |||||
49 | for first, second in out_opts: |
|
49 | for first, second in out_opts: | |
50 | sys.stdout.write(' %-*s %s\n' % (opts_len, first, second)) |
|
50 | sys.stdout.write(' %-*s %s\n' % (opts_len, first, second)) | |
51 |
|
51 | |||
|
52 | class filebackedctx(object): | |||
|
53 | """simplemerge requires context-like objects""" | |||
|
54 | def __init__(self, path): | |||
|
55 | self._path = path | |||
|
56 | ||||
|
57 | def decodeddata(self): | |||
|
58 | with open(self._path, "rb") as f: | |||
|
59 | return f.read() | |||
|
60 | ||||
|
61 | def flags(self): | |||
|
62 | return '' | |||
|
63 | ||||
|
64 | def path(self): | |||
|
65 | return self._path | |||
|
66 | ||||
|
67 | def write(self, data, flags): | |||
|
68 | assert not flags | |||
|
69 | with open(self._path, "w") as f: | |||
|
70 | f.write(data) | |||
|
71 | ||||
52 | try: |
|
72 | try: | |
53 | for fp in (sys.stdin, sys.stdout, sys.stderr): |
|
73 | for fp in (sys.stdin, sys.stdout, sys.stderr): | |
54 | util.setbinary(fp) |
|
74 | util.setbinary(fp) | |
@@ -63,7 +83,16 b' try:' | |||||
63 | sys.exit(0) |
|
83 | sys.exit(0) | |
64 | if len(args) != 3: |
|
84 | if len(args) != 3: | |
65 | raise ParseError(_('wrong number of arguments')) |
|
85 | raise ParseError(_('wrong number of arguments')) | |
66 | sys.exit(simplemerge.simplemerge(uimod.ui.load(), *args, **opts)) |
|
86 | local, base, other = args | |
|
87 | sys.exit(simplemerge.simplemerge(uimod.ui.load(), | |||
|
88 | local, | |||
|
89 | base, | |||
|
90 | other, | |||
|
91 | filebackedctx(local), | |||
|
92 | filebackedctx(base), | |||
|
93 | filebackedctx(other), | |||
|
94 | filtereddata=True, | |||
|
95 | **opts)) | |||
67 | except ParseError as e: |
|
96 | except ParseError as e: | |
68 | sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) |
|
97 | sys.stdout.write("%s: %s\n" % (sys.argv[0], e)) | |
69 | showhelp() |
|
98 | showhelp() |
General Comments 0
You need to be logged in to leave comments.
Login now