##// END OF EJS Templates
resolve: do not crash on empty mergestate...
Martin Geisler -
r11451:51021f4c stable
parent child Browse files
Show More
@@ -23,15 +23,13 b' class mergestate(object):'
23 def _read(self):
23 def _read(self):
24 self._state = {}
24 self._state = {}
25 try:
25 try:
26 localnode = None
27 f = self._repo.opener("merge/state")
26 f = self._repo.opener("merge/state")
28 for i, l in enumerate(f):
27 for i, l in enumerate(f):
29 if i == 0:
28 if i == 0:
30 localnode = l[:-1]
29 self._local = bin(l[:-1])
31 else:
30 else:
32 bits = l[:-1].split("\0")
31 bits = l[:-1].split("\0")
33 self._state[bits[0]] = bits[1:]
32 self._state[bits[0]] = bits[1:]
34 self._local = bin(localnode)
35 except IOError, err:
33 except IOError, err:
36 if err.errno != errno.ENOENT:
34 if err.errno != errno.ENOENT:
37 raise
35 raise
@@ -25,3 +25,9 b" hg commit -m 'resolved'"
25
25
26 echo % resolve -l, should be empty
26 echo % resolve -l, should be empty
27 hg resolve -l
27 hg resolve -l
28
29 # test crashed merge with empty mergestate
30 mkdir .hg/merge
31 touch .hg/merge/state
32 echo % resolve -l, should be empty
33 hg resolve -l
@@ -6,3 +6,4 b' created new head'
6 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
6 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
7 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
7 use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
8 % resolve -l, should be empty
8 % resolve -l, should be empty
9 % resolve -l, should be empty
General Comments 0
You need to be logged in to leave comments. Login now