[PATCH 2 of 2] push: warn after pushing draft changesets with tags
Nathan Goldbaum
nathan12343 at gmail.com
Fri Mar 11 12:39:00 EST 2016
oops, forgot to edit the commit message, will send a v3
On Thu, Mar 10, 2016 at 8:47 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:
> # HG changeset patch
> # User Nathan Goldbaum <ngoldbau at illinois.edu>
> # Date 1457664319 21600
> # Thu Mar 10 20:45:19 2016 -0600
> # Node ID fa56f5ded2ef6c9b0a0bec00f42c252c51e2f094
> # Parent 4cbd3237f1e5b4f442c4ee527d977ace2f6ce619
> push: warn after pushing draft changesets with tags
>
> diff -r 4cbd3237f1e5 -r fa56f5ded2ef mercurial/commands.py
> --- a/mercurial/commands.py Thu Mar 10 17:31:38 2016 -0600
> +++ b/mercurial/commands.py Thu Mar 10 20:45:19 2016 -0600
> @@ -5846,6 +5846,19 @@ def push(ui, repo, dest=None, **opts):
> elif not result and pushop.bkresult:
> result = 2
>
> + # warn if any draft changesets with tags were pushed
> + if not result:
> + for rev in pushop.outgoing.missing:
> + ctx = repo[rev]
> + tag_names = ctx.tags()
> + if 'tip' in tag_names:
> + tag_names.remove('tip')
> + if tag_names and ctx.phase() == phases.draft:
> + tag_names = ["'" + t + "'" for t in tag_names]
> + tag_names = ' and '.join(tag_names)
> + ui.warn(_('pushing draft changeset tagged %s '
> + 'to a non-publishing repository\n') % tag_names)
> +
> return result
>
> @command('recover', [])
> diff -r 4cbd3237f1e5 -r fa56f5ded2ef tests/test-hardlinks.t
> --- a/tests/test-hardlinks.t Thu Mar 10 17:31:38 2016 -0600
> +++ b/tests/test-hardlinks.t Thu Mar 10 20:45:19 2016 -0600
> @@ -213,6 +213,7 @@ r4 has hardlinks in the working dir (not
> 2 r4/.hg/cache/branch2-served
> 2 r4/.hg/cache/rbc-names-v1
> 2 r4/.hg/cache/rbc-revs-v1
> + 2 r4/.hg/cache/tags2-visible
> 2 r4/.hg/dirstate
> 2 r4/.hg/hgrc
> 2 r4/.hg/last-message.txt
> @@ -249,6 +250,7 @@ Update back to revision 11 in r4 should
> 2 r4/.hg/cache/branch2-served
> 2 r4/.hg/cache/rbc-names-v1
> 2 r4/.hg/cache/rbc-revs-v1
> + 2 r4/.hg/cache/tags2-visible
> 1 r4/.hg/dirstate
> 2 r4/.hg/hgrc
> 2 r4/.hg/last-message.txt
> diff -r 4cbd3237f1e5 -r fa56f5ded2ef tests/test-push-warn.t
> --- a/tests/test-push-warn.t Thu Mar 10 17:31:38 2016 -0600
> +++ b/tests/test-push-warn.t Thu Mar 10 20:45:19 2016 -0600
> @@ -88,6 +88,23 @@ Specifying a revset that evaluates to nu
> adding file changes
> added 2 changesets with 1 changes to 1 files
>
> +Warn about pushing a draft, tagged changeset to a non-publishing
> repository
> +
> + $ echo "[phases]" >> ../a/.hg/hgrc
> + $ echo "publish = False" >> ../a/.hg/hgrc
> + $ echo "foobar" > t5
> + $ hg add t5
> + $ hg commit -m "5"
> + $ hg tag tag-name
> + $ hg push ../a
> + pushing to ../a
> + searching for changes
> + adding changesets
> + adding manifests
> + adding file changes
> + added 2 changesets with 2 changes to 2 files
> + pushing draft changeset tagged 'tag-name' to a non-publishing repository
> +
> $ cd ..
>
> $ hg init c
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160311/e62e3956/attachment.html>
More information about the Mercurial-devel
mailing list