def close_revision(self, revisionid):
        """Set an existing Differential revision to 'closed'.

        :revisionid: id of the Differential revision to close
        :returns: None

        """
        author_user = self._get_author_user(revisionid)
        with phlsys_conduit.act_as_user_context(self._conduit, author_user):
            phlcon_differential.close(self._conduit, revisionid)
Exemplo n.º 2
0
    def close_revision(self, revisionid):
        """Set an existing Differential revision to 'closed'.

        :revisionid: id of the Differential revision to close
        :returns: None

        """
        author_user = self._get_author_user(revisionid)
        as_user_conduit = self._make_as_user_conduit(author_user)
        with self._log_context(
                'conduit-close',
                'close {} as {}'.format(revisionid, author_user)):

            phlcon_differential.close(as_user_conduit, revisionid)
Exemplo n.º 3
0
    def close_revision(self, revisionid):
        """Set an existing Differential revision to 'closed'.

        :revisionid: id of the Differential revision to close
        :returns: None

        """
        author_user = self._get_author_user(revisionid)
        as_user_conduit = self._make_as_user_conduit(author_user)
        with self._log_context(
                'conduit-close',
                'close {} as {}'.format(revisionid, author_user)):

            phlcon_differential.close(as_user_conduit, revisionid)
    def test_C_CantUpdateClosedReviews(self):
        conduit = self.phabConduit
        author = phldef_conduit.ALICE.user
        reviewer = phldef_conduit.BOB.user
        with phlsys_conduit.act_as_user_context(conduit, author):
            revision = phlcon_differential.create_empty_revision(conduit)
        with phlsys_conduit.act_as_user_context(conduit, reviewer):
            phlcon_differential.create_comment(conduit, revision, action=phlcon_differential.Action.accept)
        with phlsys_conduit.act_as_user_context(conduit, author):
            phlcon_differential.create_comment(conduit, revision, action=phlcon_differential.Action.close)
            self.assertRaises(
                phlcon_differential.UpdateClosedRevisionError,
                phlcon_differential.update_revision_empty,
                conduit,
                revision,
            )

            # expect that we can close a closed revision without errors
            phlcon_differential.close(conduit, revision)
Exemplo n.º 5
0
    def test_C_CantUpdateClosedReviews(self):
        conduit = self.phabConduit
        author = phldef_conduit.ALICE.user
        reviewer = phldef_conduit.BOB.user
        with phlsys_conduit.act_as_user_context(conduit, author):
            revision = phlcon_differential.create_empty_revision(conduit)
        with phlsys_conduit.act_as_user_context(conduit, reviewer):
            phlcon_differential.create_comment(
                conduit,
                revision,
                action=phlcon_differential.Action.accept)
        with phlsys_conduit.act_as_user_context(conduit, author):
            phlcon_differential.create_comment(
                conduit,
                revision,
                action=phlcon_differential.Action.close)
            self.assertRaises(
                phlcon_differential.UpdateClosedRevisionError,
                phlcon_differential.update_revision_empty,
                conduit,
                revision)

            # expect that we can close a closed revision without errors
            phlcon_differential.close(conduit, revision)
    def testCreateCloseRawDiffRevision(self):
        diff = """
diff --git a/readme b/readme
index d4711bb..ee5b241 100644
--- a/readme
+++ b/readme
@@ -7,3 +7,4 @@ and one more!!
 -- and one last(?) one
 alaric!
 local stuff!
+manual conduit submission
"""
        message = """
add a line to README

Test Plan: I proof-read it and it looked ok
"""

        diff2 = """
diff --git a/readme b/readme
index d4711bb..1c634f5 100644
--- a/readme
+++ b/readme
@@ -7,3 +7,5 @@ and one more!!
 -- and one last(?) one
 alaric!
 local stuff!
+manual conduit submission
+another line
"""

        diff_response = phlcon_differential.create_raw_diff(self.conduit, diff)

        get_diff_response = phlcon_differential._get_diff(
            self.conduit, diff_id=diff_response.id)
        self.assertEqual(get_diff_response.id, diff_response.id)

        parse_response = phlcon_differential.parse_commit_message(
            self.conduit, message)
        self.assertEqual(len(parse_response.errors), 0)

        create_response = phlcon_differential.create_revision(
            self.conduit, diff_response.id, parse_response.fields)

        query_response_list = phlcon_differential.query(
            self.conduit, [create_response.revisionid])
        self.assertEqual(len(query_response_list), 1)
        self.assertEqual(query_response_list[0].uri, create_response.uri)
        self.assertEqual(query_response_list[0].id, create_response.revisionid)
        self.assertEqual(
            query_response_list[0].status,
            phlcon_differential.ReviewStates.needs_review)

        diff2_response = phlcon_differential.create_raw_diff(
            self.conduit, diff2)

        update_response = phlcon_differential.update_revision(
            self.conduit,
            create_response.revisionid, diff2_response.id,
            parse_response.fields, "updated with new diff")
        self.assertEqual(
            update_response.revisionid, create_response.revisionid)
        self.assertEqual(update_response.uri, create_response.uri)

        comment_response = phlcon_differential.create_comment(
            self.reviewerConduit, create_response.revisionid, action="accept")
        self.assertEqual(
            comment_response.revisionid, create_response.revisionid)
        self.assertEqual(comment_response.uri, create_response.uri)

        query_response_list = phlcon_differential.query(
            self.conduit, [create_response.revisionid])
        self.assertEqual(len(query_response_list), 1)
        self.assertEqual(query_response_list[0].uri, create_response.uri)
        self.assertEqual(query_response_list[0].id, create_response.revisionid)
        self.assertEqual(
            query_response_list[0].status,
            phlcon_differential.ReviewStates.accepted)

        phlcon_differential.close(self.conduit, create_response.revisionid)

        query_response_list = phlcon_differential.query(
            self.conduit, [create_response.revisionid])
        self.assertEqual(len(query_response_list), 1)
        self.assertEqual(query_response_list[0].uri, create_response.uri)
        self.assertEqual(query_response_list[0].id, create_response.revisionid)
        self.assertEqual(
            query_response_list[0].status,
            phlcon_differential.ReviewStates.closed)
Exemplo n.º 7
0
    def testCreateCloseRawDiffRevision(self):
        diff = """
diff --git a/readme b/readme
index d4711bb..ee5b241 100644
--- a/readme
+++ b/readme
@@ -7,3 +7,4 @@ and one more!!
 -- and one last(?) one
 alaric!
 local stuff!
+manual conduit submission
"""
        message = """
add a line to README

Test Plan: I proof-read it and it looked ok
"""

        diff2 = """
diff --git a/readme b/readme
index d4711bb..1c634f5 100644
--- a/readme
+++ b/readme
@@ -7,3 +7,5 @@ and one more!!
 -- and one last(?) one
 alaric!
 local stuff!
+manual conduit submission
+another line
"""

        diff_response = phlcon_differential.create_raw_diff(self.conduit, diff)

        parse_response = phlcon_differential.parse_commit_message(
            self.conduit, message)
        self.assertEqual(len(parse_response.errors), 0)

        create_response = phlcon_differential.create_revision(
            self.conduit, diff_response.id, parse_response.fields)

        query_response_list = phlcon_differential.query(
            self.conduit, [create_response.revisionid])
        self.assertEqual(len(query_response_list), 1)
        self.assertEqual(query_response_list[0].uri, create_response.uri)
        self.assertEqual(query_response_list[0].id, create_response.revisionid)
        self.assertEqual(
            query_response_list[0].status,
            phlcon_differential.ReviewStates.needs_review)

        diff2_response = phlcon_differential.create_raw_diff(
            self.conduit, diff2)

        update_response = phlcon_differential.update_revision(
            self.conduit,
            create_response.revisionid, diff2_response.id,
            parse_response.fields, "updated with new diff")
        self.assertEqual(
            update_response.revisionid, create_response.revisionid)
        self.assertEqual(update_response.uri, create_response.uri)

        comment_response = phlcon_differential.create_comment(
            self.reviewerConduit, create_response.revisionid, action="accept")
        self.assertEqual(
            comment_response.revisionid, create_response.revisionid)
        self.assertEqual(comment_response.uri, create_response.uri)

        query_response_list = phlcon_differential.query(
            self.conduit, [create_response.revisionid])
        self.assertEqual(len(query_response_list), 1)
        self.assertEqual(query_response_list[0].uri, create_response.uri)
        self.assertEqual(query_response_list[0].id, create_response.revisionid)
        self.assertEqual(
            query_response_list[0].status,
            phlcon_differential.ReviewStates.accepted)

        phlcon_differential.close(self.conduit, create_response.revisionid)

        query_response_list = phlcon_differential.query(
            self.conduit, [create_response.revisionid])
        self.assertEqual(len(query_response_list), 1)
        self.assertEqual(query_response_list[0].uri, create_response.uri)
        self.assertEqual(query_response_list[0].id, create_response.revisionid)
        self.assertEqual(
            query_response_list[0].status,
            phlcon_differential.ReviewStates.closed)