D8313: phabricator: extract logic to print the status when posting a commit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

D8313: phabricator: extract logic to print the status when posting a commit

valentin.gatienbaron (Valentin Gatien-Baron)
mharbison72 created this revision.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This will make it easier to list each commit when folding.  That makes the
  output less confusing because it matches the output of `--confirm` and the
  revisions listed on the command line.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8313

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -1163,6 +1163,26 @@
     return [entry[b'phid'] for entry in data]
 
 
+def _print_phabsend_action(ui, ctx, newrevid, action):
+    """print the ``action`` that occurred when posting ``ctx`` for review
+
+    This is a utility function for the sending phase of ``phabsend``, which
+    makes it easier to show a status for all local commits with `--fold``.
+    """
+    actiondesc = ui.label(
+        {
+            b'created': _(b'created'),
+            b'skipped': _(b'skipped'),
+            b'updated': _(b'updated'),
+        }[action],
+        b'phabricator.action.%s' % action,
+    )
+    drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev')
+    nodedesc = ui.label(bytes(ctx), b'phabricator.node')
+    desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc')
+    ui.write(_(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc))
+
+
 def _amend_diff_properties(unfi, drevid, newnodes, diff):
     """update the local commit list for the ``diff`` associated with ``drevid``
 
@@ -1312,23 +1332,11 @@
             newrevid = revid
             action = b'skipped'
 
-        actiondesc = ui.label(
-            {
-                b'created': _(b'created'),
-                b'skipped': _(b'skipped'),
-                b'updated': _(b'updated'),
-            }[action],
-            b'phabricator.action.%s' % action,
-        )
-        drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev')
-        nodedesc = ui.label(bytes(ctx), b'phabricator.node')
-        desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc')
-        ui.write(
-            _(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc)
-        )
         drevids.append(newrevid)
         lastrevphid = newrevphid
 
+        _print_phabsend_action(ui, ctx, newrevid, action)
+
     # Update commit messages and remove tags
     if opts.get(b'amend'):
         unfi = repo.unfiltered()



To: mharbison72, #hg-reviewers
Cc: Kwan, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8313: phabricator: extract logic to print the status when posting a commit

valentin.gatienbaron (Valentin Gatien-Baron)
mharbison72 updated this revision to Diff 20909.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8313?vs=20853&id=20909

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8313/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8313

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -1168,6 +1168,26 @@
     return [entry[b'phid'] for entry in data]
 
 
+def _print_phabsend_action(ui, ctx, newrevid, action):
+    """print the ``action`` that occurred when posting ``ctx`` for review
+
+    This is a utility function for the sending phase of ``phabsend``, which
+    makes it easier to show a status for all local commits with `--fold``.
+    """
+    actiondesc = ui.label(
+        {
+            b'created': _(b'created'),
+            b'skipped': _(b'skipped'),
+            b'updated': _(b'updated'),
+        }[action],
+        b'phabricator.action.%s' % action,
+    )
+    drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev')
+    nodedesc = ui.label(bytes(ctx), b'phabricator.node')
+    desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc')
+    ui.write(_(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc))
+
+
 def _amend_diff_properties(unfi, drevid, newnodes, diff):
     """update the local commit list for the ``diff`` associated with ``drevid``
 
@@ -1317,23 +1337,11 @@
             newrevid = revid
             action = b'skipped'
 
-        actiondesc = ui.label(
-            {
-                b'created': _(b'created'),
-                b'skipped': _(b'skipped'),
-                b'updated': _(b'updated'),
-            }[action],
-            b'phabricator.action.%s' % action,
-        )
-        drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev')
-        nodedesc = ui.label(bytes(ctx), b'phabricator.node')
-        desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc')
-        ui.write(
-            _(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc)
-        )
         drevids.append(newrevid)
         lastrevphid = newrevphid
 
+        _print_phabsend_action(ui, ctx, newrevid, action)
+
     # Update commit messages and remove tags
     if opts.get(b'amend'):
         unfi = repo.unfiltered()



To: mharbison72, #hg-reviewers
Cc: Kwan, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D8313: phabricator: extract logic to print the status when posting a commit

valentin.gatienbaron (Valentin Gatien-Baron)
In reply to this post by valentin.gatienbaron (Valentin Gatien-Baron)
Closed by commit rHG949a87145336: phabricator: extract logic to print the status when posting a commit (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8313?vs=20909&id=20946

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8313/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8313

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -1168,6 +1168,26 @@
     return [entry[b'phid'] for entry in data]
 
 
+def _print_phabsend_action(ui, ctx, newrevid, action):
+    """print the ``action`` that occurred when posting ``ctx`` for review
+
+    This is a utility function for the sending phase of ``phabsend``, which
+    makes it easier to show a status for all local commits with `--fold``.
+    """
+    actiondesc = ui.label(
+        {
+            b'created': _(b'created'),
+            b'skipped': _(b'skipped'),
+            b'updated': _(b'updated'),
+        }[action],
+        b'phabricator.action.%s' % action,
+    )
+    drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev')
+    nodedesc = ui.label(bytes(ctx), b'phabricator.node')
+    desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc')
+    ui.write(_(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc))
+
+
 def _amend_diff_properties(unfi, drevid, newnodes, diff):
     """update the local commit list for the ``diff`` associated with ``drevid``
 
@@ -1317,23 +1337,11 @@
             newrevid = revid
             action = b'skipped'
 
-        actiondesc = ui.label(
-            {
-                b'created': _(b'created'),
-                b'skipped': _(b'skipped'),
-                b'updated': _(b'updated'),
-            }[action],
-            b'phabricator.action.%s' % action,
-        )
-        drevdesc = ui.label(b'D%d' % newrevid, b'phabricator.drev')
-        nodedesc = ui.label(bytes(ctx), b'phabricator.node')
-        desc = ui.label(ctx.description().split(b'\n')[0], b'phabricator.desc')
-        ui.write(
-            _(b'%s - %s - %s: %s\n') % (drevdesc, actiondesc, nodedesc, desc)
-        )
         drevids.append(newrevid)
         lastrevphid = newrevphid
 
+        _print_phabsend_action(ui, ctx, newrevid, action)
+
     # Update commit messages and remove tags
     if opts.get(b'amend'):
         unfi = repo.unfiltered()



To: mharbison72, #hg-reviewers, Alphare
Cc: Kwan, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel