# HG changeset patch # User Pierre-Yves David # Date 1498036297 -7200 # Node ID 9290f985868cc173cb262c9e14b0703566f7964a # Parent 49f2741c4dd7cd9df53e9667bafddda91eb0af2e obslog: extra patch indentation code The code is simple and we need to reuse it. diff -r 49f2741c4dd7 -r 9290f985868c hgext3rd/evolve/obshistory.py --- 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