# HG changeset patch # User Matt Mackall # Date 2009-05-18 22:36:24 # Node ID fb9b83df45f38501c020ea9278cf82a8eb67a014 # Parent a5182c39766a5c89ed915ac9f547b2f81049a077 commit: move description trimming into changelog diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -209,6 +209,10 @@ class changelog(revlog.revlog): if "\n" in user: raise error.RevlogError(_("username %s contains a newline") % repr(user)) + + # strip trailing whitespace and leading and trailing empty lines + desc = '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') + user, desc = encoding.fromlocal(user), encoding.fromlocal(desc) if date: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -884,15 +884,10 @@ class localrepository(repo.repository): mn = self.manifest.add(m1, trp, linkrev, p1.manifestnode(), p2.manifestnode(), (new, drop)) - text = ctx.description() - lines = [line.rstrip() for line in text.rstrip().splitlines()] - while lines and not lines[0]: - del lines[0] - text = '\n'.join(lines) - + # update changelog self.changelog.delayupdate() - n = self.changelog.add(mn, changed + removed, text, trp, - p1.node(), p2.node(), + n = self.changelog.add(mn, changed + removed, ctx.description(), + trp, p1.node(), p2.node(), user, ctx.date(), ctx.extra().copy()) p = lambda: self.changelog.writepending() and self.root or "" self.hook('pretxncommit', throw=True, node=hex(n), parent1=xp1,