[PATCH 2 of 2] tag: fix uncommitted merge check and error message (issue2542)
Adrian Buehlmann
adrian at cadifra.com
Tue Dec 14 02:46:22 CST 2010
tl;dr summary: IMHO, not really progress compared to my version
On 2010-12-14 04:42, Kevin Bullock wrote:
> # HG changeset patch
> # User Adrian Buehlmann <adrian at cadifra.com>
Please don't send patches on my behalf. Just put your name here, it's
all yours now. I don't want to be blamed for your changes.
> # Date 1291705374 -3600
> # Branch stable
> # Node ID 08021c74f46ed05b9739b3cea8ecd35e10c17645
> # Parent 55ee5a2cc1f5f62cc3284d900e21d40d23d5a3ff
> tag: fix uncommitted merge check and error message (issue2542)
>
> This patch corrects the check for tagging on an uncommitted merge. We
> should never commit a new tag changeset on an uncommitted merge, whether
> or not --rev is specified. It also changes the error message from:
>
> abort: cannot partially commit a merge (do not specify files or patterns)
>
> to the much more accurate (and terse):
>
> abort: uncommitted merge
>
> Local tags are ok.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -3712,9 +3712,8 @@
> if n in repo.tags():
> raise util.Abort(_('tag \'%s\' already exists '
> '(use -f to force)') % n)
> - if not rev_ and repo.dirstate.parents()[1] != nullid:
> - raise util.Abort(_('uncommitted merge - please provide a '
> - 'specific revision'))
> + if not opts.get('local') and repo.dirstate.parents()[1] != nullid:
> + raise util.Abort(_('uncommitted merge'))
> r = repo[rev_].node()
>
> if not message:
> diff --git a/tests/test-tag.t b/tests/test-tag.t
> --- a/tests/test-tag.t
> +++ b/tests/test-tag.t
> @@ -208,3 +208,42 @@
> ? editor
> $ hg tag --local baz
> $ hg revert --no-backup .hgtags
> +
> +tagging with a uncommitted merge
> +
> + $ hg heads -q
> + 11:7d32ded1f932
> + 8:2bba354f91af
> + 5:b4bb47aaff09
> + $ hg up 8
> + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
> + $ hg st -A
> + ? .hgtags.orig
> + ? editor
> + C .hgtags
> + C a
> + $ hg merge --tool internal:local 5
> + 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
> + (branch merge, don't forget to commit)
The careful test reader notes here that this merge is merging .hgtags.
> + $ hg diff
> +
> + $ hg tag t1
> + abort: uncommitted merge
> + [255]
> + $ hg tag --rev 1 t2
> + abort: uncommitted merge
> + [255]
> + $ hg tag --rev 1 --local t3
> + $ hg tags -v
> + tip 11:7d32ded1f932
> + baz 11:7d32ded1f932 local
> + custom-tag 10:e51b312ec2b1
> + tag-and-branch-same-name 9:1ba9e63eb5b8
> + newline 7:a0eea09de1ee
> + localnewline 6:c2899151f4e7 local
> + gawk 2:336fccc858a4
> + t3 1:d4f0d2909abc local
> + bleah1 1:d4f0d2909abc local
> + foobar 0:acb14030fe0a
> + bleah0 0:acb14030fe0a
> + bleah 0:acb14030fe0a
Not really easier to spot the new t3 line in this pile, compared to my
original version of this patch:
+ $ hg tag --rev 1 --local t3
+ $ hg tags -v
+ tip 2:9adf12931dba
+ t3 1:3ec40a953f20 local
More information about the Mercurial-devel
mailing list