https://bz.mercurial-scm.org/show_bug.cgi?id=5918

            Bug ID: 5918
           Summary: context.metadataonlyctx doesn't respect the secret
                    phase of the original ctx
           Product: Mercurial
           Version: default branch
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: bug
          Priority: normal
         Component: Mercurial
          Assignee: bugzi...@mercurial-scm.org
          Reporter: matt_harbi...@yahoo.com
                CC: mercurial-devel@mercurial-scm.org

This was reported to me by somebody who noticed that the phabricator extension
changed a secret cset to draft when it was posted for review.  It looks like
that extension is the only user in the hg repo.  Maybe the ctx class is the
wrong place to handle this, and it should be handled in scmutil.cleanupnodes()?
 Here's a test (without scmutil.cleanupnodes()):

diff --git a/tests/test-context-metadata.t b/tests/test-context-metadata.t
--- a/tests/test-context-metadata.t
+++ b/tests/test-context-metadata.t
@@ -9,7 +9,7 @@ Tests about metadataonlyctx
   $ echo C > C
   $ echo B2 > B
   $ hg add C -q
-  $ hg commit -m 'Remove A'
+  $ hg commit --secret -m 'Remove A'

   $ cat > metaedit.py <<EOF
   > from __future__ import absolute_import
@@ -28,15 +28,16 @@ Tests about metadataonlyctx
   >                                       **pycompat.strkwargs(kwargs))
   >         new.commit()
   > EOF
+  $ hg log -T '{rev}: ({phase}) {desc}\n'
+  2: (secret) Remove A
+  1: (draft) Add B
+  0: (draft) Add A
   $ hg --config extensions.metaedit=$TESTTMP/metaedit.py metaedit
'text=Changed'
-  $ hg log -r tip
-  changeset:   3:ad83e9e00ec9
-  tag:         tip
-  parent:      1:3afb7afe6632
-  user:        test
-  date:        Thu Jan 01 00:00:00 1970 +0000
-  summary:     Changed
-
+  $ hg log -T '{rev}: ({phase}) {desc}\n'
+  3: (draft) Changed
+  2: (secret) Remove A
+  1: (draft) Add B
+  0: (draft) Add A
   $ hg --config extensions.metaedit=$TESTTMP/metaedit.py metaedit 'parents=0'
2>&1 | egrep '^RuntimeError'
   RuntimeError: can't reuse the manifest: its p1 doesn't match the new ctx p1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to