Mercurial > hgsubversion
changeset 769:cc1d4aa3ba41
configurable substitution for empty commit message (fixes #195)
The value of the default commit message is now configurable by setting
'hgsubversion.defaultmessage'. In addition, the log output is made
consistent with the result of the conversion.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sun, 28 Nov 2010 03:47:04 +0100 |
parents | 13a2137d3c15 |
children | 4dfc41b15d9a |
files | hgsubversion/help/subversion.rst hgsubversion/replay.py hgsubversion/stupid.py hgsubversion/svnmeta.py hgsubversion/util.py hgsubversion/wrappers.py tests/fixtures/empty-log-message.svndump tests/test_fetch_mappings.py |
diffstat | 8 files changed, 111 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/help/subversion.rst +++ b/hgsubversion/help/subversion.rst @@ -205,6 +205,11 @@ settings: If this option set to an empty string, the Subversion authors will be used with no hostname component. + ``hgsubversion.defaultmessage`` + + This option selects what to substitute for an empty log + message. The default is to substitute three dots, or ``...``. + ``hgsubversion.defaultauthors`` Setting this boolean option to false will cause hgsubversion to abort a
--- a/hgsubversion/replay.py +++ b/hgsubversion/replay.py @@ -165,7 +165,7 @@ def convert_rev(ui, meta, svn, r, tbdelt meta.mapbranch(extra) current_ctx = context.memctx(meta.repo, parents, - rev.message or '...', + rev.message or util.default_commit_msg(ui), files.keys(), filectxfn, meta.authors[rev.author],
--- a/hgsubversion/stupid.py +++ b/hgsubversion/stupid.py @@ -653,7 +653,7 @@ def convert_rev(ui, meta, svn, r, tbdelt meta.mapbranch(extra) current_ctx = context.memctx(meta.repo, [parentctx.node(), revlog.nullid], - r.message or util.default_commit_msg, + r.message or util.default_commit_msg(ui), files_touched, filectxfn, meta.authors[r.author],
--- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -633,7 +633,7 @@ class SVNMeta(object): revnum, branch = self.get_source_rev(ctx=parentctx)[:2] ctx = context.memctx(self.repo, (parentctx.node(), node.nullid), - rev.message or '...', + rev.message or util.default_commit_msg(ui), ['.hgtags', ], hgtagsfn, self.authors[rev.author], @@ -720,7 +720,7 @@ class SVNMeta(object): self.mapbranch(extra, True) ctx = context.memctx(self.repo, (node, revlog.nullid), - rev.message or util.default_commit_msg, + rev.message or util.default_commit_msg(ui), [], lambda x, y, z: None, self.authors[rev.author],
--- a/hgsubversion/util.py +++ b/hgsubversion/util.py @@ -149,7 +149,9 @@ def outgoing_revisions(repo, reverse_map if sourcerev.node() != node.nullid: return outgoing_rev_hashes -default_commit_msg = '*** empty log message ***' +def default_commit_msg(ui): + return ui.config('hgsubversion', 'defaultmessage', + '...') def describe_commit(ui, h, b): ui.note(' committed to "%s" as %s\n' % ((b or 'default'), node.short(h)))
--- a/hgsubversion/wrappers.py +++ b/hgsubversion/wrappers.py @@ -305,7 +305,7 @@ def pull(repo, source, heads=[], force=F if r.message: msg = r.message.strip() if not msg: - msg = util.default_commit_msg + msg = util.default_commit_msg(ui) else: msg = [s.strip() for s in msg.splitlines() if s][0] if getattr(ui, 'termwidth', False):
new file mode 100644 --- /dev/null +++ b/tests/fixtures/empty-log-message.svndump @@ -0,0 +1,71 @@ +SVN-fs-dump-format-version: 2 + +UUID: 2abea918-74b5-4124-b744-a1f76c91de90 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2010-11-18T14:30:05.275138Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 100 +Content-length: 100 + +K 7 +svn:log +V 0 + +K 10 +svn:author +V 6 +danchr +K 8 +svn:date +V 27 +2010-11-18T14:30:36.517160Z +PROPS-END + +Node-path: branches +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: tags +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: trunk/A +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 0 +Text-content-md5: d41d8cd98f00b204e9800998ecf8427e +Text-content-sha1: da39a3ee5e6b4b0d3255bfef95601890afd80709 +Content-length: 10 + +PROPS-END + +
--- a/tests/test_fetch_mappings.py +++ b/tests/test_fetch_mappings.py @@ -12,6 +12,7 @@ from mercurial import util as hgutil from hgsubversion import maps from hgsubversion import svncommands +from hgsubversion import util class MapTests(test_util.TestBase): @property @@ -306,5 +307,31 @@ class MapTests(test_util.TestBase): def test_tagren_changed_stupid(self): self.test_tagren_changed(True) + def test_empty_log_message(self, stupid=False): + repo = self._load_fixture_and_fetch('empty-log-message.svndump', + stupid=stupid) + + self.assertEqual(repo['tip'].description(), '...') + + test_util.rmtree(self.wc_path) + + ui = self.ui(stupid) + ui.setconfig('hgsubversion', 'defaultmessage', 'blyf') + commands.clone(ui, test_util.fileurl(self.repo_path), self.wc_path) + + self.assertEqual(self.repo['tip'].description(), 'blyf') + + test_util.rmtree(self.wc_path) + + ui = self.ui(stupid) + ui.setconfig('hgsubversion', 'defaultmessage', '') + commands.clone(ui, test_util.fileurl(self.repo_path), self.wc_path) + + self.assertEqual(self.repo['tip'].description(), '') + + + def test_empty_log_message_stupid(self): + self.test_empty_log_message(True) + def suite(): return unittest.TestLoader().loadTestsFromTestCase(MapTests)