# HG changeset patch # User Pierre-Yves David # Date 1345516585 -7200 # Node ID 1f8f8dd75d1890ae16061a3c079e1df317d4600f # Parent 641e0cd43d6dfbe56043fa38dc75ec325be400c5 obsolete: prevent bare hg update to select hidden changeset The issue remain with branch name. diff -r 641e0cd43d6d -r 1f8f8dd75d18 hgext/obsolete.py --- a/hgext/obsolete.py Tue Aug 21 02:50:11 2012 +0200 +++ b/hgext/obsolete.py Tue Aug 21 04:36:25 2012 +0200 @@ -61,6 +61,7 @@ from mercurial import revset from mercurial import scmutil from mercurial import templatekw +from mercurial import merge from mercurial.node import bin, short, nullid # This extension contains the following code @@ -575,6 +576,18 @@ % ctx) return orig(repo, remote, outgoing, *args, **kwargs) +##################################################################### +### Filter extinct changeset from common operation ### +##################################################################### + +@eh.wrapfunction(merge, 'update') +def wrapmergeupdate(orig, repo, node, *args, **kwargs): + """ensure we don't automatically update on hidden changeset""" + if node is None: + # tip of current branch + branch = repo[None].branch() + node = repo.revs('last((.:: and branch(%s)) - hidden())', branch)[0] + return orig(repo, node, *args, **kwargs) ##################################################################### ### Additional Utilities ### diff -r 641e0cd43d6d -r 1f8f8dd75d18 tests/test-obsolete.t --- a/tests/test-obsolete.t Tue Aug 21 02:50:11 2012 +0200 +++ b/tests/test-obsolete.t Tue Aug 21 04:36:25 2012 +0200 @@ -436,6 +436,16 @@ 0 - 1f0dee641bb7 +Check that auto update ignore hidden changeset + $ hg up 0 + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg up + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg id -n + 8 + + $ hg up null -q # to be not based on 9 anymore + check rebase compat $ hg glog -r 'not extinct()' --template='{rev} - {node|short}\n'