Show More
@@ -3113,13 +3113,18 b' def buildcommittext(repo, ctx, subs, ext' | |||||
3113 | return b"\n".join(edittext) |
|
3113 | return b"\n".join(edittext) | |
3114 |
|
3114 | |||
3115 |
|
3115 | |||
3116 | def commitstatus(repo, node, branch, bheads=None, opts=None): |
|
3116 | def commitstatus(repo, node, branch, bheads=None, tip=None, opts=None): | |
3117 | if opts is None: |
|
3117 | if opts is None: | |
3118 | opts = {} |
|
3118 | opts = {} | |
3119 | ctx = repo[node] |
|
3119 | ctx = repo[node] | |
3120 | parents = ctx.parents() |
|
3120 | parents = ctx.parents() | |
3121 |
|
3121 | |||
3122 | if ( |
|
3122 | if tip is not None and repo.changelog.tip() == tip: | |
|
3123 | # avoid reporting something like "committed new head" when | |||
|
3124 | # recommitting old changesets, and issue a helpful warning | |||
|
3125 | # for most instances | |||
|
3126 | repo.ui.warn(_("warning: commit already existed in the repository!\n")) | |||
|
3127 | elif ( | |||
3123 | not opts.get(b'amend') |
|
3128 | not opts.get(b'amend') | |
3124 | and bheads |
|
3129 | and bheads | |
3125 | and node not in bheads |
|
3130 | and node not in bheads |
@@ -851,11 +851,14 b' def _dobackout(ui, repo, node=None, rev=' | |||||
851 | message, opts.get(b'user'), opts.get(b'date'), match, editor=e |
|
851 | message, opts.get(b'user'), opts.get(b'date'), match, editor=e | |
852 | ) |
|
852 | ) | |
853 |
|
853 | |||
|
854 | # save to detect changes | |||
|
855 | tip = repo.changelog.tip() | |||
|
856 | ||||
854 | newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) |
|
857 | newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) | |
855 | if not newnode: |
|
858 | if not newnode: | |
856 | ui.status(_(b"nothing changed\n")) |
|
859 | ui.status(_(b"nothing changed\n")) | |
857 | return 1 |
|
860 | return 1 | |
858 | cmdutil.commitstatus(repo, newnode, branch, bheads) |
|
861 | cmdutil.commitstatus(repo, newnode, branch, bheads, tip) | |
859 |
|
862 | |||
860 | def nice(node): |
|
863 | def nice(node): | |
861 | return b'%d:%s' % (repo.changelog.rev(node), short(node)) |
|
864 | return b'%d:%s' % (repo.changelog.rev(node), short(node)) | |
@@ -2024,6 +2027,7 b' def _docommit(ui, repo, *pats, **opts):' | |||||
2024 |
|
2027 | |||
2025 | branch = repo[None].branch() |
|
2028 | branch = repo[None].branch() | |
2026 | bheads = repo.branchheads(branch) |
|
2029 | bheads = repo.branchheads(branch) | |
|
2030 | tip = repo.changelog.tip() | |||
2027 |
|
2031 | |||
2028 | extra = {} |
|
2032 | extra = {} | |
2029 | if opts.get(b'close_branch') or opts.get(b'force_close_branch'): |
|
2033 | if opts.get(b'close_branch') or opts.get(b'force_close_branch'): | |
@@ -2113,7 +2117,7 b' def _docommit(ui, repo, *pats, **opts):' | |||||
2113 | ui.status(_(b"nothing changed\n")) |
|
2117 | ui.status(_(b"nothing changed\n")) | |
2114 | return 1 |
|
2118 | return 1 | |
2115 |
|
2119 | |||
2116 | cmdutil.commitstatus(repo, node, branch, bheads, opts) |
|
2120 | cmdutil.commitstatus(repo, node, branch, bheads, tip, opts) | |
2117 |
|
2121 | |||
2118 | if not ui.quiet and ui.configbool(b'commands', b'commit.post-status'): |
|
2122 | if not ui.quiet and ui.configbool(b'commands', b'commit.post-status'): | |
2119 | status( |
|
2123 | status( |
@@ -819,5 +819,5 b' Ensure that backout out the same changes' | |||||
819 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
819 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
820 | $ hg backout 2 |
|
820 | $ hg backout 2 | |
821 | removing 3 |
|
821 | removing 3 | |
822 | created new head |
|
822 | warning: commit already existed in the repository! | |
823 | changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f |
|
823 | changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f |
@@ -1868,6 +1868,7 b' Verify naming of temporary files and tha' | |||||
1868 | $ hg update -q -C 1 |
|
1868 | $ hg update -q -C 1 | |
1869 | $ hg mv f f.txt |
|
1869 | $ hg mv f f.txt | |
1870 | $ hg ci -qm "f.txt" |
|
1870 | $ hg ci -qm "f.txt" | |
|
1871 | warning: commit already existed in the repository! | |||
1871 | $ hg update -q -C 2 |
|
1872 | $ hg update -q -C 2 | |
1872 | $ hg merge -y -r tip --tool echo \ |
|
1873 | $ hg merge -y -r tip --tool echo \ | |
1873 | > --config merge-tools.echo.args='$base $local $other $output' \ |
|
1874 | > --config merge-tools.echo.args='$base $local $other $output' \ |
@@ -1010,7 +1010,7 b' draft:' | |||||
1010 | $ hg up -C 1 |
|
1010 | $ hg up -C 1 | |
1011 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
1011 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
1012 | $ mkcommit C |
|
1012 | $ mkcommit C | |
1013 | created new head |
|
1013 | warning: commit already existed in the repository! | |
1014 | $ hg phase -r 2 |
|
1014 | $ hg phase -r 2 | |
1015 | 2: public |
|
1015 | 2: public | |
1016 |
|
1016 | |||
@@ -1027,6 +1027,7 b' Same, but for secret:' | |||||
1027 | 7: draft |
|
1027 | 7: draft | |
1028 | $ mkcommit F |
|
1028 | $ mkcommit F | |
1029 | test-debug-phase: new rev 8: x -> 2 |
|
1029 | test-debug-phase: new rev 8: x -> 2 | |
|
1030 | warning: commit already existed in the repository! | |||
1030 | test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret |
|
1031 | test-hook-close-phase: de414268ec5ce2330c590b942fbb5ff0b0ca1a0a: -> secret | |
1031 | $ hg phase -r tip |
|
1032 | $ hg phase -r tip | |
1032 | 8: secret |
|
1033 | 8: secret | |
@@ -1037,7 +1038,7 b' But what about obsoleted changesets?' | |||||
1037 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1038 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1038 | $ mkcommit H |
|
1039 | $ mkcommit H | |
1039 | test-debug-phase: new rev 5: x -> 2 |
|
1040 | test-debug-phase: new rev 5: x -> 2 | |
1040 | created new head |
|
1041 | warning: commit already existed in the repository! | |
1041 | test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret |
|
1042 | test-hook-close-phase: a030c6be5127abc010fcbff1851536552e6951a8: -> secret | |
1042 | $ hg phase -r 5 |
|
1043 | $ hg phase -r 5 | |
1043 | 5: secret |
|
1044 | 5: secret |
@@ -204,5 +204,6 b'' | |||||
204 | $ hg update -r '.^' -q |
|
204 | $ hg update -r '.^' -q | |
205 | $ echo 1 > A |
|
205 | $ echo 1 > A | |
206 | $ hg commit -m foo -A A |
|
206 | $ hg commit -m foo -A A | |
|
207 | warning: commit already existed in the repository! | |||
207 | $ hg log -r . -T '{node}\n' |
|
208 | $ hg log -r . -T '{node}\n' | |
208 | 383ce605500277f879b7460a16ba620eb6930b7f |
|
209 | 383ce605500277f879b7460a16ba620eb6930b7f |
@@ -405,8 +405,10 b' Rename a->b, then amend b->c, and workin' | |||||
405 | $ hg co -q 0 |
|
405 | $ hg co -q 0 | |
406 | $ hg mv a b |
|
406 | $ hg mv a b | |
407 | $ hg ci -qm 'move to a b' |
|
407 | $ hg ci -qm 'move to a b' | |
|
408 | warning: commit already existed in the repository! | |||
408 | $ hg mv b c |
|
409 | $ hg mv b c | |
409 | $ hg amend |
|
410 | $ hg amend | |
|
411 | warning: commit already existed in the repository! | |||
410 | $ hg mv c d |
|
412 | $ hg mv c d | |
411 | $ hg unamend |
|
413 | $ hg unamend | |
412 | $ hg st --copies --change . |
|
414 | $ hg st --copies --change . |
General Comments 0
You need to be logged in to leave comments.
Login now