Comments
Patch
@@ -695,10 +695,26 @@
except error.RepoLookupError:
if wc.branch() == "default": # no default branch!
node = repo.lookup("tip") # update to tip
else:
raise util.Abort(_("branch %s not found") % wc.branch())
+
+ # We only check for foreground (successor) changesets if the node
+ # found by the above logic is obsolete
+ if repo[node].obsolete():
+ # Branching is a bit strange to ensure we do the minimal
+ # amount of call to obsolete.background.
+ foreground = obsolete.foreground(repo, [p1.node()])
+ # note: the <node> variable contains a random identifier
+
+ # allow updating to successors
+ if repo[node].node() in foreground:
+ # get the max revision for the given foreground set
+ unfil = [repo.unfiltered()[n].rev() for n in foreground]
+ node = repo[max(unfil)].node()
+ pa = p1
+
overwrite = force and not branchmerge
p2 = repo[node]
if pa is None:
pa = p1.ancestor(p2)
@@ -724,23 +740,23 @@
if wc.sub(s).dirty():
raise util.Abort(_("uncommitted changes in "
"subrepository '%s'") % s)
elif not overwrite:
- if p1 == p2: # no-op update
+ # no-op update
+ if (p1 == p2 and
+ not (foreground and foreground != set([p1.node()]))):
# call the hooks and exit early
repo.hook('preupdate', throw=True, parent1=xp2, parent2='')
repo.hook('update', parent1=xp2, parent2='', error=0)
return 0, 0, 0, 0
if pa not in (p1, p2): # nonlinear
dirty = wc.dirty(missing=True)
if dirty or onode is None:
- # Branching is a bit strange to ensure we do the minimal
- # amount of call to obsolete.background.
- foreground = obsolete.foreground(repo, [p1.node()])
- # note: the <node> variable contains a random identifier
+ if foreground is None:
+ foreground = obsolete.foreground(repo, [p1.node()])
if repo[node].node() in foreground:
pa = p1 # allow updating to successors
elif dirty:
msg = _("uncommitted changes")
if onode is None: