##// END OF EJS Templates
commit: don't change phases for preexisting commits...
Dan Villiom Podlaski Christiansen -
r46349:f803c584 stable draft
parent child Browse files
Show More
@@ -3095,7 +3095,15 b' def commitstatus(repo, node, branch, bhe'
3095 ctx = repo[node]
3095 ctx = repo[node]
3096 parents = ctx.parents()
3096 parents = ctx.parents()
3097
3097
3098 if (
3098 if repo.changelog.tip() != node:
3099 # this check is two-fold: 1. avoid reporting something like
3100 # "committed new head" when recommitting old changesets, and
3101 # 2., issue a helpful warning for most instances -- excepting
3102 # when recommitting tip
3103 repo.ui.warn(
3104 _("warning: commit didn't add anything to the repository!\n"),
3105 )
3106 elif (
3099 not opts.get(b'amend')
3107 not opts.get(b'amend')
3100 and bheads
3108 and bheads
3101 and node not in bheads
3109 and node not in bheads
@@ -79,6 +79,9 b' def commitctx(repo, ctx, error=False, or'
79 if repo.changelog._copiesstorage == b'extra':
79 if repo.changelog._copiesstorage == b'extra':
80 extra = _extra_with_copies(repo, extra, files)
80 extra = _extra_with_copies(repo, extra, files)
81
81
82 # save the tip to check whether we actually committed anything
83 tip = repo.changelog.tip()
84
82 # update changelog
85 # update changelog
83 repo.ui.note(_(b"committing changelog\n"))
86 repo.ui.note(_(b"committing changelog\n"))
84 repo.changelog.delayupdate(tr)
87 repo.changelog.delayupdate(tr)
@@ -99,7 +102,7 b' def commitctx(repo, ctx, error=False, or'
99 )
102 )
100 # set the new commit is proper phase
103 # set the new commit is proper phase
101 targetphase = subrepoutil.newcommitphase(repo.ui, ctx)
104 targetphase = subrepoutil.newcommitphase(repo.ui, ctx)
102 if targetphase:
105 if targetphase and (tip != repo.changelog.tip() or repo[n].hidden()):
103 # retract boundary do not alter parent changeset.
106 # retract boundary do not alter parent changeset.
104 # if a parent have higher the resulting phase will
107 # if a parent have higher the resulting phase will
105 # be compliant anyway
108 # be compliant anyway
@@ -999,3 +999,52 b' Commit is hidden as expected'
999 date: Thu Jan 01 00:00:00 1970 +0000
999 date: Thu Jan 01 00:00:00 1970 +0000
1000 summary: A
1000 summary: A
1001
1001
1002
1003 $ cd ..
1004
1005 Recommitting an exact match of a public commit shouldn't change it to
1006 draft:
1007
1008 $ cd initialrepo
1009 $ hg phase -r 2
1010 2: public
1011 $ hg up -C 1
1012 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
1013 $ mkcommit C
1014 warning: commit didn't add anything to the repository!
1015 $ hg phase -r 2
1016 2: public
1017
1018 Same, but for secret:
1019
1020 $ hg up 7
1021 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1022 $ mkcommit F -s
1023 test-debug-phase: new rev 8: x -> 2
1024 test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret
1025 $ hg up 7
1026 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1027 $ mkcommit F
1028 $ hg phase -r tip
1029 8: secret
1030
1031 But what about obsoleted changesets?
1032
1033 $ hg up 4
1034 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1035 $ mkcommit H
1036 test-debug-phase: new rev 5: x -> 2
1037 warning: commit didn't add anything to the repository!
1038 test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret
1039 $ hg phase -r 5
1040 5: secret
1041 $ hg par
1042 changeset: 5:a030c6be5127
1043 user: test
1044 date: Thu Jan 01 00:00:00 1970 +0000
1045 obsolete: pruned
1046 summary: H
1047
1048 $ hg up tip
1049 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
1050 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now