Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 11451:51021f4c80b5 stable
resolve: do not crash on empty mergestate
I managed to get an empty .hg/merge/state file by interrupting a merge
by pressing Control-C. This lead to this error:
TypeError: a2b_hex() argument 1 must be string or read-only buffer,
not None
since localnode is assigned None before the iteration over lines in
the mergestate begins.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Sun, 27 Jun 2010 23:12:05 +0200 |
parents | 6f1d1ed3e19a |
children | 9b0406b23be0 |
line wrap: on
line diff
--- a/mercurial/merge.py Wed Jun 23 16:54:12 2010 -1000 +++ b/mercurial/merge.py Sun Jun 27 23:12:05 2010 +0200 @@ -23,15 +23,13 @@ def _read(self): self._state = {} try: - localnode = None f = self._repo.opener("merge/state") for i, l in enumerate(f): if i == 0: - localnode = l[:-1] + self._local = bin(l[:-1]) else: bits = l[:-1].split("\0") self._state[bits[0]] = bits[1:] - self._local = bin(localnode) except IOError, err: if err.errno != errno.ENOENT: raise