Mercurial > evolve
changeset 2638:9290f985868c
obslog: extra patch indentation code
The code is simple and we need to reuse it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 21 Jun 2017 11:11:37 +0200 |
parents | 49f2741c4dd7 |
children | a5d8062f55ba |
files | hgext3rd/evolve/obshistory.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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