Comments
Patch
@@ -5865,6 +5865,26 @@ 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:
+ tag_and_draft = "(%ln - public()) and tagged()"
+ warned = False
+ for rev in repo.revs(tag_and_draft, 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_warning = '"%s"' % tag_names[0]
+ ntags = len(tag_names)
+ if ntags > 1:
+ tag_warning += ' and %s other tags' % (ntags - 1)
+ warned = True
+ ui.warn(_('pushed tags %s as draft\n') % tag_warning)
+ if warned:
+ ui.warn(_('(use "hg phase --public" and push again to publish '
+ 'the tags)\n'))
+
return result
@command('recover', [])
@@ -88,6 +88,24 @@ 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
+ pushed tags "tag-name" as draft
+ (use "hg phase --public" and push again to publish the tags)
+
$ cd ..
$ hg init c