##// END OF EJS Templates
bookmarks: extract valid destination logic in a dedicated function...
Pierre-Yves David -
r17550:fc530080 default
parent child Browse files
Show More
@@ -209,7 +209,7 b' def updatefromremote(ui, repo, remote, p'
209 209 cl = repo[nl]
210 210 if cl.rev() >= cr.rev():
211 211 continue
212 if cr in cl.descendants():
212 if validdest(repo, cl, cr):
213 213 repo._bookmarks[k] = cr.node()
214 214 changed = True
215 215 ui.status(_("updating bookmark %s\n") % k)
@@ -252,3 +252,7 b' def diff(ui, repo, remote):'
252 252 ui.status(_("no changed bookmarks found\n"))
253 253 return 1
254 254 return 0
255
256 def validdest(repo, old, new):
257 """Is the new bookmark destination a valid update from the old one"""
258 return new in old.descendants()
@@ -7,7 +7,7 b''
7 7
8 8 from node import nullid, short
9 9 from i18n import _
10 import util, setdiscovery, treediscovery, phases, obsolete
10 import util, setdiscovery, treediscovery, phases, obsolete, bookmarks
11 11
12 12 def findcommonincoming(repo, remote, heads=None, force=False):
13 13 """Return a tuple (common, anyincoming, heads) used to identify the common
@@ -255,7 +255,7 b' def checkheads(repo, remote, outgoing, r'
255 255 rnode = remotebookmarks.get(bm)
256 256 if rnode and rnode in repo:
257 257 lctx, rctx = repo[bm], repo[rnode]
258 if rctx == lctx.ancestor(rctx):
258 if bookmarks.validdest(repo, rctx, lctx):
259 259 bookmarkedheads.add(lctx.node())
260 260
261 261 # 3. Check for new heads.
@@ -1992,7 +1992,7 b' class localrepository(object):'
1992 1992 if nr in self:
1993 1993 cr = self[nr]
1994 1994 cl = self[nl]
1995 if cl in cr.descendants():
1995 if bookmarks.validdest(self, cr, cl):
1996 1996 r = remote.pushkey('bookmarks', k, nr, nl)
1997 1997 if r:
1998 1998 self.ui.status(_("updating bookmark %s\n") % k)
General Comments 0
You need to be logged in to leave comments. Login now