[PATCH v3] parsers: add a C function to pack the dirstate

Adrian Buehlmann adrian at cadifra.com
Thu May 24 14:53:22 CDT 2012


On 2012-05-24 18:44, Adrian Buehlmann wrote:
> On 2012-05-23 00:09, Matt Mackall wrote:
>> On Tue, 2012-05-22 at 14:58 -0700, Bryan O'Sullivan wrote:
>>> # HG changeset patch
>>> # User Bryan O'Sullivan <bryano at fb.com>
>>> # Date 1337723862 25200
>>> # Node ID cc012f33398867f690963151f82c24fa1cbac89b
>>> # Parent  91f44cb2512919d7fe7f17f9c6f2030b6ff19b34
>>> parsers: add a C function to pack the dirstate
>>
>> This and the perf patch are queued for default, thanks.
>>
> 
> I'm seeing this in MSYS with 64-bit Python on Windows 7. Haven't analyzed it yet:
> 
> $ python run-tests.py --local
> 
> --- c:\users\adi\hgrepos\hg-main\tests\test-1102.t
> +++ c:\users\adi\hgrepos\hg-main\tests\test-1102.t.err
> @@ -4,13 +4,98 @@
>    $ echo a > a
>    $ hg ci -Am0
>    adding a
> +  ** unknown exception encountered, please report by visiting
> +  ** http://mercurial.selenic.com/wiki/BugTracker
> +  ** Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)]
> +  ** Mercurial Distributed SCM (version 2.2.1+139-85316b3c6a3b)
> +  ** Extensions loaded:
> +  Traceback (most recent call last):
> +    File "c:/users/adi/hgrepos/hg-main/hg", line 38, in <module>
> +      mercurial.dispatch.run()
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 28, in run
> +      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 65, in dispatch
> +      return _runcatch(req)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 88, in _runcatch
> +      return _dispatch(req)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 737, in _dispatch
> +      cmdpats, cmdoptions)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 511, in runcommand
> +      ret = _runcommand(ui, options, cmd, d)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 827, in _runcommand
> +      return checkargs()
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 798, in checkargs
> +      return cmdfunc()
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dispatch.py", line 734, in <lambda>
> +      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\util.py", line 463, in check
> +      return func(*args, **kwargs)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\commands.py", line 1313, in commit
> +      node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\cmdutil.py", line 1294, in commit
> +      scmutil.match(repo[None], pats, opts), opts)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\commands.py", line 1311, in commitfunc
> +      match, editor=e, extra=extra)
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\localrepo.py", line 1216, in commit
> +      wlock.release()
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\lock.py", line 132, in release
> +      self.releasefn()
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\localrepo.py", line 963, in unlock
> +      self.dirstate.write()
> +    File "c:\users\adi\hgrepos\hg-main\mercurial\dirstate.py", line 512, in write
> +      finish(parsers.pack_dirstate(self._map, copymap, self._pl, now))
> +  TypeError: expected an int
> +  [1]

Inserting a print here

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -219,6 +219,7 @@
 	PyObject *o = PyTuple_GET_ITEM(tuple, off);
 	if (!PyInt_Check(o)) {
 		PyErr_SetString(PyExc_TypeError, "expected an int");
+		PyObject_Print(o, stdout, 0);
 		return -1;
 	}
 	*v = (uint32_t)PyInt_AS_LONG(o);

gives

  $ python run-tests.py --local test-1102.t

  --- c:\users\adi\hgrepos\hg-main\tests\test-1102.t
  +++ c:\users\adi\hgrepos\hg-main\tests\test-1102.t.err
  @@ -4,13 +4,98 @@
     $ echo a > a
     $ hg ci -Am0
     adding a
  +  2L** unknown exception encountered, please report by visiting
  +  ** http://mercurial.selenic.com/wiki/BugTracker
  +  ** Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) [MSC v.1500 64 bit (AMD64)]
  +  ** Mercurial Distributed SCM (version 2.2.1+139-85316b3c6a3b+20120524)
  +  ** Extensions loaded:
  +  Traceback (most recent call last):
  +    File "c:/users/adi/hgrepos/hg-main/hg", line 38, in <module>
  +      mercurial.dispatch.run()

Note the "2L". So it looks like we have Python long there...


More information about the Mercurial-devel mailing list