Ejemplo n.º 1
0
    def query_users_from_emails(self, emails):
        """Return a list of username strings based on the provided emails.

        If an email does not correspond to a username then None is inserted in
        its place.

        :emails: a list of strings corresponding to user email addresses
        :returns: a list of strings corresponding to Phabricator usernames

        """
        return phlcon_user.query_users_from_emails(self._multi_conduit, emails)
Ejemplo n.º 2
0
    def query_users_from_emails(self, emails):
        """Return a list of username strings based on the provided emails.

        If an email does not correspond to a username then None is inserted in
        its place.

        :emails: a list of strings corresponding to user email addresses
        :returns: a list of strings corresponding to Phabricator usernames

        """
        return phlcon_user.query_users_from_emails(self._conduit, emails)
Ejemplo n.º 3
0
    def testEmptyLists(self):
        users = phlcon_user.query_users_from_usernames(self.conduit, [])
        self.assertEqual(len(users), 0)

        users = phlcon_user.query_users_from_phids(self.conduit, [])
        self.assertEqual(len(users), 0)

        users = phlcon_user.query_usernames_from_phids(self.conduit, [])
        self.assertEqual(len(users), 0)

        users = phlcon_user.query_users_from_emails(self.conduit, [])
        self.assertEqual(len(users), 0)
def getPrimaryNameEmailAndUserFromBranch(clone, conduit, base, branch):
    hashes = phlgit_log.get_range_hashes(clone, base, branch)
    if not hashes:
        raise abdt_exception.AbdUserException("no history to diff")
    commit = hashes[-1]
    committer = phlgit_log.get_author_names_emails_from_hashes(
        clone, [commit])[0]
    name = committer[0]
    email = committer[1]
    user = phlcon_user.query_users_from_emails(conduit, [email])[0]
    if not user:
        raise abdt_exception.AbdUserException(
            "first committer is not a Phabricator user")
    return name, email, user
def getAnyUserFromBranch(clone, conduit, base, branch):
    if phlgitu_ref.parse_ref_hash(clone, base) is None:
        hashes = phlgit_log.get_last_n_commit_hashes_from_ref(clone, 1, branch)
    else:
        hashes = phlgit_log.get_range_hashes(clone, base, branch)

    if not hashes:
        hashes = phlgit_log.get_last_n_commit_hashes_from_ref(clone, 1, branch)
    committers = phlgit_log.get_author_names_emails_from_hashes(clone, hashes)
    emails = [committer[1] for committer in committers]
    users = phlcon_user.query_users_from_emails(conduit, emails)
    for user in users:
        if user:
            return user
    raise abdt_exception.NoUsersOnBranchException(branch, base, emails)
Ejemplo n.º 6
0
    def testAliceEmail(self):
        users = phlcon_user.query_users_from_emails(
            self.conduit, [self.test_email])
        self.assertEqual(len(users), 1)
        self.assertEqual(users[0], self.test_user)

        user = phlcon_user.query_user_from_email(self.conduit, self.test_email)
        self.assertEqual(user.userName, self.test_user)

        phidUsers = phlcon_user.query_users_from_phids(
            self.conduit, [user.phid])
        self.assertEqual(phidUsers[0].userName, self.test_user)

        phidUsernames = phlcon_user.query_usernames_from_phids(
            self.conduit, [user.phid])
        self.assertEqual(phidUsernames[0], self.test_user)
Ejemplo n.º 7
0
 def testAliceAndNooneEmail(self):
     emails = [self.test_email, "*****@*****.**", "*****@*****.**"]
     users = phlcon_user.query_users_from_emails(self.conduit, emails)
     self.assertEqual(len(users), 3)
     self.assertListEqual(users, [self.test_user, None, None])