<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 8:42 AM, Pierre-Yves David <span dir="ltr"><<a href="mailto:pierre-yves.david@ens-lyon.org" target="_blank">pierre-yves.david@ens-lyon.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 03/11/2016 02:47 AM, Nathan Goldbaum wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
# HG changeset patch<br>
# User Nathan Goldbaum <<a href="mailto:ngoldbau@illinois.edu" target="_blank">ngoldbau@illinois.edu</a>><br>
# Date 1457664319 21600<br>
#      Thu Mar 10 20:45:19 2016 -0600<br>
# Node ID fa56f5ded2ef6c9b0a0bec00f42c252c51e2f094<br>
# Parent  4cbd3237f1e5b4f442c4ee527d977ace2f6ce619<br>
push: warn after pushing draft changesets with tags<br>
</blockquote>
<br></span>
Can we get a bit more details here? What is the rational, some exemple output, etc.<br>
<br>
More comment below.<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r 4cbd3237f1e5 -r fa56f5ded2ef mercurial/commands.py<br>
--- a/mercurial/commands.py     Thu Mar 10 17:31:38 2016 -0600<br>
+++ b/mercurial/commands.py     Thu Mar 10 20:45:19 2016 -0600<br>
@@ -5846,6 +5846,19 @@ def push(ui, repo, dest=None, **opts):<br>
          elif not result and pushop.bkresult:<br>
              result = 2<br>
<br>
+    # warn if any draft changesets with tags were pushed<br>
+    if not result:<br>
+        for rev in pushop.outgoing.missing:<br>
+            ctx = repo[rev]<br>
+            tag_names = ctx.tags()<br>
+            if 'tip' in tag_names:<br>
+                tag_names.remove('tip')<br>
+            if tag_names and ctx.phase() == phases.draft:<br>
</blockquote>
<br></span>
be safe of check of "mutable" of "not public())<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+                tag_names = ["'" + t + "'" for t in tag_names]<br>
+                tag_names = ' and '.join(tag_names)<br>
</blockquote>
<br></span>
Revset would be more efficient here, you are looking for:<br>
<br>
  repo.revs("(%ln - public()) and tagged()", pushop.outgoing.missing)<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+                ui.warn(_('pushing draft changeset tagged %s '<br>
+                          'to a non-publishing repository\n') % tag_names)<br>
</blockquote>
<br></span>
a) You are running this -after- the push. so it should be<br>
<br>
  "pushed draft …"<br>
<br>
b) Also, don't put all the name on a single message. This will give massively gigantic line in pathological case. We have two options here:<br>
<br>
  * one line per tags<br>
  * print the first couple and mention how many other there is. (cf remote head warning on push for exemple)<br>
<br>
c) We can probably have a more compact message.<br>
<br>
  pushed tag "foobar" as draft<br>
<br>
(a bit less precise more likely to be read.<br>
<br>
"draft" should be ready to be "secret" when applicable. Or maybe we should use "mutable"<br>
<br>
d) should we put a hint about how to publish it and repush?<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
      return result<br>
<br>
  @command('recover', [])<br>
diff -r 4cbd3237f1e5 -r fa56f5ded2ef tests/test-hardlinks.t<br>
--- a/tests/test-hardlinks.t    Thu Mar 10 17:31:38 2016 -0600<br>
+++ b/tests/test-hardlinks.t    Thu Mar 10 20:45:19 2016 -0600<br>
@@ -213,6 +213,7 @@ r4 has hardlinks in the working dir (not<br>
    2 r4/.hg/cache/branch2-served<br>
    2 r4/.hg/cache/rbc-names-v1<br>
    2 r4/.hg/cache/rbc-revs-v1<br>
+  2 r4/.hg/cache/tags2-visible<br>
    2 r4/.hg/dirstate<br>
    2 r4/.hg/hgrc<br>
    2 r4/.hg/last-message.txt<br>
@@ -249,6 +250,7 @@ Update back to revision 11 in r4 should<br>
    2 r4/.hg/cache/branch2-served<br>
    2 r4/.hg/cache/rbc-names-v1<br>
    2 r4/.hg/cache/rbc-revs-v1<br>
+  2 r4/.hg/cache/tags2-visible<br>
    1 r4/.hg/dirstate<br>
    2 r4/.hg/hgrc<br>
    2 r4/.hg/last-message.txt<br>
</blockquote>
<br>
<br></span>
Why is this test affected?</blockquote><div><br></div><div>I'm not sure, let's see if it still happens after I apply your suggestions.</div><div><br></div><div>Thank you for the careful review.</div><div><br></div><div>-Nathan</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
diff -r 4cbd3237f1e5 -r fa56f5ded2ef tests/test-push-warn.t<br>
--- a/tests/test-push-warn.t    Thu Mar 10 17:31:38 2016 -0600<br>
+++ b/tests/test-push-warn.t    Thu Mar 10 20:45:19 2016 -0600<br>
@@ -88,6 +88,23 @@ Specifying a revset that evaluates to nu<br>
    adding file changes<br>
    added 2 changesets with 1 changes to 1 files<br>
<br>
+Warn about pushing a draft, tagged changeset to a non-publishing repository<br>
+<br>
+  $ echo "[phases]" >> ../a/.hg/hgrc<br>
+  $ echo "publish = False" >> ../a/.hg/hgrc<br>
+  $ echo "foobar" > t5<br>
+  $ hg add t5<br>
+  $ hg commit -m "5"<br>
+  $ hg tag tag-name<br>
+  $ hg push ../a<br>
+  pushing to ../a<br>
+  searching for changes<br>
+  adding changesets<br>
+  adding manifests<br>
+  adding file changes<br>
+  added 2 changesets with 2 changes to 2 files<br>
+  pushing draft changeset tagged 'tag-name' to a non-publishing repository<br>
+<br>
    $ cd ..<br>
<br>
    $ hg init c<br>
</blockquote>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Pierre-Yves David<br>
</font></span></blockquote></div><br></div></div>