# HG changeset patch # User David Soria Parra # Date 1490209978 18000 # Node ID 78ac8acfc4bd1b32b4ba36fe5b52dcf0cb77d1b3 # Parent 7e3b145f824793ccdb5caf4f13570d4f25ab0164 convert: fix the handling of empty changlist descriptions in P4 Empty changelist descriptions are valid in Perforce. If we encounter one of them we are currently running into an IndexError. In case of empty commit messages set the commit message to **empty changelist description**, which follows Perforce terminology. diff -r 7e3b145f8247 -r 78ac8acfc4bd hgext/convert/p4.py --- a/hgext/convert/p4.py Tue Mar 21 17:50:44 2017 -0700 +++ b/hgext/convert/p4.py Wed Mar 22 14:12:58 2017 -0500 @@ -161,7 +161,12 @@ d = self._fetch_revision(change) c = self._construct_commit(d, parents) - shortdesc = c.desc.splitlines(True)[0].rstrip('\r\n') + descarr = c.desc.splitlines(True) + if len(descarr) > 0: + shortdesc = descarr[0].rstrip('\r\n') + else: + shortdesc = '**empty changelist description**' + t = '%s %s' % (c.rev, repr(shortdesc)[1:-1]) ui.status(util.ellipsis(t, 80) + '\n') diff -r 7e3b145f8247 -r 78ac8acfc4bd tests/test-convert-p4.t --- a/tests/test-convert-p4.t Tue Mar 21 17:50:44 2017 -0700 +++ b/tests/test-convert-p4.t Wed Mar 22 14:12:58 2017 -0500 @@ -141,5 +141,23 @@ rev=1 desc="change a" tags="" files="a" rev=0 desc="initial" tags="" files="a b/c" +empty commit message + $ p4 edit a + //depot/test-mercurial-import/a#3 - opened for edit + $ echo aaaaa >> a + $ p4 submit -d "" + Submitting change 6. + Locking 1 files ... + edit //depot/test-mercurial-import/a#4 + Change 6 submitted. + $ hg convert -s p4 $DEPOTPATH dst + scanning source... + reading p4 views + collecting p4 changelists + 6 **empty changelist description** + sorting... + converting... + 0 + exit trap: stopping the p4 server