diff options
Diffstat (limited to 'python-patch-allow-for-externalizing-hunk-again.patch')
-rw-r--r-- | python-patch-allow-for-externalizing-hunk-again.patch | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/python-patch-allow-for-externalizing-hunk-again.patch b/python-patch-allow-for-externalizing-hunk-again.patch new file mode 100644 index 0000000..a1ccec1 --- /dev/null +++ b/python-patch-allow-for-externalizing-hunk-again.patch @@ -0,0 +1,41 @@ +Index: patch.py +=================================================================== +--- patch.py (revision 203) ++++ patch.py (working copy) +@@ -166,17 +166,27 @@ + self.desc='' + self.text=[] + +-# def apply(self, estream): +-# """ write hunk data into enumerable stream +-# return strings one by one until hunk is +-# over +-# +-# enumerable stream are tuples (lineno, line) +-# where lineno starts with 0 +-# """ +-# pass ++ def apply(self, estream): ++ """ write hunk data into enumerable stream ++ return strings one by one until hunk is ++ over + ++ enumerable stream are tuples (lineno, line) ++ where lineno starts with 0 ++ """ ++ if type(estream) is not type([]): ++ return estream ++ header = "@@ -{0},{1} +{2},{3} @@{4}".format(self.startsrc, self.linessrc, ++ self.starttgt, self.linestgt, ++ self.desc) ++ estream.append((0, header + '\n')) ++ estream.extend(enumerate(self.text, 1)) ++ return estream + ++ def __str__(self): ++ return ''.join([line for _, line in self.apply([])]) ++ ++ + class Patch(object): + """ Patch for a single file """ + def __init__(self): |