obslog: extra patch indentation code
The code is simple and we need to reuse it.
--- a/hgext3rd/evolve/obshistory.py Tue Jun 20 13:49:40 2017 +0200
+++ b/hgext3rd/evolve/obshistory.py Wed Jun 21 11:11:37 2017 +0200
@@ -141,6 +141,10 @@
return True, succ
+def _indent(content, indent=4):
+ extra = ' ' * indent
+ return "".join(extra + line for line in content.splitlines(True))
+
def getmarkerpatch(repo, node, succ):
# Todo get the ops from the cmd
diffopts = patch.diffallopts(repo.ui, {})
@@ -151,10 +155,7 @@
match=matchfn, stat=False)
buffer = repo.ui.popbuffer()
- # Indent the buffer a little
- splitted = buffer.splitlines(True)
- splitted = [' %s' % line for line in splitted]
- return "".join(splitted)
+ return _indent(buffer)
class missingchangectx(object):
''' a minimal object mimicking changectx for change contexts