Bug 4282 - Converting from Perforce fails with KeyError: 'desc'
Summary: Converting from Perforce fails with KeyError: 'desc'
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: convert (show other bugs)
Version: 3.0.1
Hardware: PC Windows
: normal bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-16 12:33 UTC by Chris
Modified: 2014-07-19 14:17 UTC (History)
2 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2014-06-16 12:33 UTC
I'm trying to convert several Perforce workspaces to Mercurial. Some have been OK, but some are failing with the following:

H:\src\hg>hg convert -s p4 //myRepo/... myRepo
initializing destination myRepo repository
reading p4 views
collecting p4 changelists
** unknown exception encountered, please report by visiting
** http://mercurial.selenic.com/wiki/BugTracker
** Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)]
** Mercurial Distributed SCM (version 3.0.1)
** Extensions loaded: convert
Traceback (most recent call last):
  File "hg", line 38, in <module>
  File "mercurial\dispatch.pyc", line 28, in run
  File "mercurial\dispatch.pyc", line 69, in dispatch
  File "mercurial\dispatch.pyc", line 138, in _runcatch
  File "mercurial\dispatch.pyc", line 819, in _dispatch
  File "mercurial\dispatch.pyc", line 599, in runcommand
  File "mercurial\dispatch.pyc", line 910, in _runcommand
  File "mercurial\dispatch.pyc", line 881, in checkargs
  File "mercurial\dispatch.pyc", line 816, in <lambda>
  File "mercurial\util.pyc", line 518, in check
  File "hgext\convert\__init__.pyc", line 283, in convert
  File "hgext\convert\convcmd.pyc", line 502, in convert
  File "hgext\convert\convcmd.pyc", line 56, in convertsource
  File "hgext\convert\p4.pyc", line 52, in __init__
  File "hgext\convert\p4.pyc", line 111, in _parse
KeyError: 'desc'
Comment 1 Matt Mackall 2014-06-16 13:04 UTC
You have a commit with no description. I recommend this patch flogging the appropriate committer.

diff -r c00822e0b8ea hgext/convert/p4.py
--- a/hgext/convert/p4.py	Sat Jun 14 11:56:20 2014 -0500
+++ b/hgext/convert/p4.py	Mon Jun 16 11:59:12 2014 -0500
@@ -108,7 +108,7 @@
             cmd = "p4 -G describe -s %s" % change
             stdout = util.popen(cmd, mode='rb')
             d = marshal.load(stdout)
-            desc = self.recode(d["desc"])
+            desc = self.recode(d.get("desc", ""))
             shortdesc = desc.split("\n", 1)[0]
             t = '%s %s' % (d["change"], repr(shortdesc)[1:-1])
             ui.status(util.ellipsis(t, 80) + '\n')
Comment 2 Chris 2014-06-18 11:24 UTC
(In reply to comment #1)

Thanks Matt. It turns out the problem is due to a corrupt P4 database:

> p4 -G describe -s 1
{scodeserrorsdatasIOperation 'user-describe' failed.
Revision table out of sync with index!
Comment 3 HG Bot 2014-06-18 22:00 UTC
Fixed by http://selenic.com/repo/hg/rev/c27a37678508
Matt Mackall <mpm@selenic.com>
p4: accept changesets with no description (issue4282)

(please test the fix)