comparison hgext/bookmarks.py @ 7316:9737041646bc

bookmarks: Use dirstate to determine the current node in addchangegroup Using the changectx might result in a lookup error during the strip command. Thefore we use the current dirstate to get the parents of the working directory.
author David Soria Parra <dsp@php.net>
date Wed, 05 Nov 2008 03:53:34 +0100
parents b19c0200c90b
children 4c3e0ad58c5b
comparison
equal deleted inserted replaced
7312:82f80c16fc16 7316:9737041646bc
198 if update: 198 if update:
199 write(repo, marks) 199 write(repo, marks)
200 return node 200 return node
201 201
202 def addchangegroup(self, source, srctype, url, emptyok=False): 202 def addchangegroup(self, source, srctype, url, emptyok=False):
203 try: 203 parents = repo.dirstate.parents()
204 onode = repo.changectx('.').node()
205 except RepoError, inst:
206 pass
207 204
208 result = super(bookmark_repo, self).addchangegroup( 205 result = super(bookmark_repo, self).addchangegroup(
209 source, srctype, url, emptyok) 206 source, srctype, url, emptyok)
210 if result > 1: 207 if result > 1:
211 # We have more heads than before 208 # We have more heads than before
212 return result 209 return result
213 node = repo.changelog.tip() 210 node = repo.changelog.tip()
214 marks = parse(repo) 211 marks = parse(repo)
215 update = False 212 update = False
216 for mark, n in marks.items(): 213 for mark, n in marks.items():
217 if n == onode: 214 if n in parents:
218 marks[mark] = node 215 marks[mark] = node
219 update = True 216 update = True
220 if update: 217 if update:
221 write(repo, marks) 218 write(repo, marks)
222 return result 219 return result