예제 #1
0
    def connect(self):
        self.p4 = P4Server(self.P4PORT, self.P4USER, self.P4PASSWD,
                           log_level=self.cli_arguments.verbose)
        self.p4.exception_level = P4.RAISE_ERROR
        self.p4.client = self.P4CLIENT

        clientspec = self.p4.fetch_client(self.p4.client)

        self.stream = clientspec.get('Stream')

        self.root = clientspec._root
        self.p4.cwd = self.root
        self.clientmap = Map(clientspec._view)

        ctr = Map('//%s/...  %s/...' % (clientspec._client,
                                        clientspec._root))
        self.localmap = Map.join(self.clientmap, ctr)
        self.depotmap = self.localmap.reverse()

        self.maskdepotmap = None
        if self.P4MASKCLIENT:
            maskclientspec = self.p4.fetch_client(self.P4MASKCLIENT)
            maskclientmap = Map(maskclientspec._view)
            ctr = Map('//%s/...  %s/...' % (maskclientspec._client,
                                              maskclientspec._root))
            masklocalmap = Map.join(maskclientmap, ctr)
            self.maskdepotmap = masklocalmap.reverse()
예제 #2
0
def has_intersecting_views(current_reviews, clientmap):
    """Determine whether the clientmap intersects the
    current set of reviews for this GF reviews user.
    """

    reviews_map = Map()
    for v in current_reviews:
        reviews_map.insert(v)

    repo_map = Map()
    for l in clientmap.lhs():
        repo_map.insert(l)

    joined = Map.join(reviews_map, repo_map)

    #for l in joined.lhs():
    #    if not l.startswith('-'):
    #        return INTERSECT

    return NO_INTERSECT
예제 #3
0
    def __set_up_p4gf_paths(self):
        """set up depot and local paths for P4GF

        These paths are derived from the client root and client view.
        """

        client = self.p4gf.fetch_client()
        self.client_spec_gf = client
        self.gitrootdir = client_spec_to_root(client)
        self.clientmap_gf = Map(client["View"])

        lhs = self.clientmap_gf.lhs()
        check_client_view_gf(lhs)

        assert len(lhs) == 1, _('view must contain only one line')
        rpath = self.clientmap_gf.translate(lhs[0])
        self.gitlocalroot = strip_wild(
            client_path_to_local(rpath, self.p4gf.client, self.gitrootdir))
예제 #4
0
    def __set_up_content_paths(self):
        """set up depot and local paths for both content and P4GF

        These paths are derived from the client root and client view.
        """

        client = self.p4.fetch_client()
        self.clientmap = Map(client["View"])
        # If the len of the client Views differs from the len of the Map
        # then the P4 disabmbiguator added exclusionary mappings - note this here
        # for reporting a message back to the user.
        self.client_exclusions_added = len(client["View"]) != len(
            self.clientmap.as_array())

        # local syntax client root, force trailing /
        self.contentlocalroot = client["Root"]
        if not self.contentlocalroot.endswith("/"):
            self.contentlocalroot += '/'

        # client sytax client root with wildcard
        self.contentclientroot = '//' + self.p4.client + '/...'