##// END OF EJS Templates
mqrepo: don't abort if the status file has an unknown node
Alexis S. L. Carvalho -
r5979:b4858eb4 default
parent child Browse files
Show More
@@ -2096,6 +2096,12 b' def reposetup(ui, repo):'
2096 return tagscache
2096 return tagscache
2097
2097
2098 mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied]
2098 mqtags = [(revlog.bin(patch.rev), patch.name) for patch in q.applied]
2099
2100 if mqtags[-1][0] not in self.changelog.nodemap:
2101 self.ui.warn('mq status file refers to unknown node %s\n'
2102 % revlog.short(mqtags[-1][0]))
2103 return tagscache
2104
2099 mqtags.append((mqtags[-1][0], 'qtip'))
2105 mqtags.append((mqtags[-1][0], 'qtip'))
2100 mqtags.append((mqtags[0][0], 'qbase'))
2106 mqtags.append((mqtags[0][0], 'qbase'))
2101 mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent'))
2107 mqtags.append((self.changelog.parents(mqtags[0][0])[0], 'qparent'))
@@ -2112,11 +2118,17 b' def reposetup(ui, repo):'
2112 if not q.applied:
2118 if not q.applied:
2113 return super(mqrepo, self)._branchtags()
2119 return super(mqrepo, self)._branchtags()
2114
2120
2121 cl = self.changelog
2122 qbasenode = revlog.bin(q.applied[0].rev)
2123 if qbasenode not in cl.nodemap:
2124 self.ui.warn('mq status file refers to unknown node %s\n'
2125 % revlog.short(qbasenode))
2126 return super(mqrepo, self)._branchtags()
2127
2115 self.branchcache = {} # avoid recursion in changectx
2128 self.branchcache = {} # avoid recursion in changectx
2116 cl = self.changelog
2117 partial, last, lrev = self._readbranchcache()
2129 partial, last, lrev = self._readbranchcache()
2118
2130
2119 qbase = cl.rev(revlog.bin(q.applied[0].rev))
2131 qbase = cl.rev(qbasenode)
2120 start = lrev + 1
2132 start = lrev + 1
2121 if start < qbase:
2133 if start < qbase:
2122 # update the cache (excluding the patches) and save it
2134 # update the cache (excluding the patches) and save it
@@ -297,6 +297,13 b' hg st'
297 echo % mq tags
297 echo % mq tags
298 hg log --template '{rev} {tags}\n' -r qparent:qtip
298 hg log --template '{rev} {tags}\n' -r qparent:qtip
299
299
300 echo % bad node in status
301 hg qpop
302 hg strip -qn tip
303 hg tip 2>&1 | sed -e 's/unknown node .*/unknown node/'
304 hg branches 2>&1 | sed -e 's/unknown node .*/unknown node/'
305 hg qpop
306
300 cat >>$HGRCPATH <<EOF
307 cat >>$HGRCPATH <<EOF
301 [diff]
308 [diff]
302 git = True
309 git = True
@@ -281,6 +281,18 b' Errors during apply, please fix and refr'
281 0 qparent
281 0 qparent
282 1 qbase foo
282 1 qbase foo
283 2 qtip bar tip
283 2 qtip bar tip
284 % bad node in status
285 Now at: foo
286 changeset: 0:cb9a9f314b8b
287 mq status file refers to unknown node
288 tag: tip
289 user: test
290 date: Thu Jan 01 00:00:00 1970 +0000
291 summary: a
292
293 mq status file refers to unknown node
294 default 0:cb9a9f314b8b
295 abort: working directory revision is not qtip
284 new file
296 new file
285
297
286 diff --git a/new b/new
298 diff --git a/new b/new
General Comments 0
You need to be logged in to leave comments. Login now