Patchwork D8137: phabricator: add a config knob to import in the secret phase

login
register
mail settings
Submitter phabricator
Date Feb. 21, 2020, 1:10 a.m.
Message ID <differential-rev-PHID-DREV-rkfc5hgdz5ubb6vjr6ng-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/45276/
State Superseded
Headers show

Comments

phabricator - Feb. 21, 2020, 1:10 a.m.
mharbison72 created this revision.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  For my use anyway, it's better to have a config knob that's always set than to
  try to remember a switch.  But we can add a tristate switch if desired.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/phabricator.py
  tests/test-phabricator.t

CHANGE DETAILS




To: mharbison72, #hg-reviewers
Cc: Kwan, mercurial-devel
phabricator - Feb. 21, 2020, 5 a.m.
mharbison72 added a comment.


  This needs D8126 <https://phab.mercurial-scm.org/D8126> (which I assume is going to end up on stable) to pass.

REPOSITORY
  rHG Mercurial

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

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

To: mharbison72, #hg-reviewers
Cc: Kwan, mercurial-devel
phabricator - March 4, 2020, 6:57 p.m.
This revision is now accepted and ready to land.
durin42 added a comment.
durin42 accepted this revision.


  Seems fine.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

To: mharbison72, #hg-reviewers, durin42
Cc: durin42, Kwan, mercurial-devel

Patch

diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t
--- a/tests/test-phabricator.t
+++ b/tests/test-phabricator.t
@@ -282,5 +282,39 @@ 
   o  0   c44b38f24a45   1970-01-01 00:00 +0000   test
        create alpha for phabricator test \x80 (esc)
   
+Phabimport can create secret commits
+
+  $ hg rollback --config ui.rollback=True
+  repository tip rolled back to revision 1 (undo phabimport)
+  $ hg phabimport --stack 'D7918' --test-vcr "$VCR/phabimport-stack.json" \
+  >    --config phabimport.secret=True
+  applying patch from D7917
+  applying patch from D7918
+  $ hg log -T phases
+  changeset:   3:aaef04066140
+  tag:         tip
+  phase:       secret
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     create draft change for phabricator testing
+  
+  changeset:   2:8de3712202d1
+  phase:       secret
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     create public change for phabricator testing
+  
+  changeset:   1:a692622e6937
+  phase:       public
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     create beta for phabricator test
+  
+  changeset:   0:c44b38f24a45
+  phase:       public
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     create alpha for phabricator test \x80 (esc)
+  
 
   $ cd ..
diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -124,6 +124,9 @@ 
 eh.configitem(
     b'phabsend', b'confirm', default=False,
 )
+eh.configitem(
+    b'phabimport', b'secret', default=False,
+)
 
 colortable = {
     b'phabricator.action.created': b'green',
@@ -1706,6 +1709,9 @@ 
     opts[b'strip'] = 1
     opts[b'prefix'] = b''
 
+    if ui.configbool(b'phabimport', b'secret'):
+        opts[b'secret'] = True
+
     def _write(patches):
         parents = repo[None].parents()