# HG changeset patch # User Boris Feld # Date 2017-07-06 12:55:12 # Node ID 57980af73cfa3ac1e3f178f51c288229ccc7699f # Parent 54af8de9bd096840a9a7d8f22fdabb69703925a7 effectflag: detect when branch changed Store in effect flag when the branch changed between the predecessor and its successors. It can happens with "hg branch" + "hg commit --amend", "hg branch" + "hg amend" or "histedit". Differential Revision: https://phab.mercurial-scm.org/D538 diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -311,6 +311,7 @@ EFFECTFLAGFIELD = "ef1" DESCCHANGED = 1 << 0 # action changed the description USERCHANGED = 1 << 4 # the user changed DATECHANGED = 1 << 5 # the date changed +BRANCHCHANGED = 1 << 6 # the branch changed def geteffectflag(relation): """ From an obs-marker relation, compute what changed between the @@ -333,6 +334,10 @@ def geteffectflag(relation): if changectx.date() != source.date(): effects |= DATECHANGED + # Check if branch has changed + if changectx.branch() != source.branch(): + effects |= BRANCHCHANGED + return effects def getobsoleted(repo, tr): diff --git a/tests/test-obsmarkers-effectflag.t b/tests/test-obsmarkers-effectflag.t --- a/tests/test-obsmarkers-effectflag.t +++ b/tests/test-obsmarkers-effectflag.t @@ -65,7 +65,7 @@ amend touching the branch only check result $ hg debugobsolete --rev . - bd3db8264ceebf1966319f5df3be7aac6acd1a8e 14a01456e0574f0e0a0b15b2345486a6364a8d79 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'amend', 'user': 'test'} + bd3db8264ceebf1966319f5df3be7aac6acd1a8e 14a01456e0574f0e0a0b15b2345486a6364a8d79 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '64', 'operation': 'amend', 'user': 'test'} $ hg up default 0 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -106,7 +106,7 @@ amend with multiple effect (desc and met check result $ hg debugobsolete --rev . - fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '49', 'operation': 'amend', 'user': 'test'} + fad47e5bd78e6aa4db1b5a0a1751bc12563655ff a94e0fd5f1c81d969381a76eb0d37ce499a44fae 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '113', 'operation': 'amend', 'user': 'test'} rebase not touching the diff ----------------------------