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