summaryrefslogtreecommitdiffstats
path: root/python-patch-allow-for-externalizing-hunk-again.patch
diff options
context:
space:
mode:
authorJan Pokorný <jpokorny@redhat.com>2013-10-08 22:38:45 +0200
committerJan Pokorný <jpokorny@redhat.com>2013-10-08 22:38:45 +0200
commit639f864f003adf3fa3a8a94cab42d5813f85b476 (patch)
tree5e5cf760a04cef32a54cf0ccba7122873a24c974 /python-patch-allow-for-externalizing-hunk-again.patch
downloadpatch-fix-offsets-639f864f003adf3fa3a8a94cab42d5813f85b476.tar.gz
patch-fix-offsets-639f864f003adf3fa3a8a94cab42d5813f85b476.tar.xz
patch-fix-offsets-639f864f003adf3fa3a8a94cab42d5813f85b476.zip
Initial commit
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'python-patch-allow-for-externalizing-hunk-again.patch')
-rw-r--r--python-patch-allow-for-externalizing-hunk-again.patch41
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):