Пример #1
0
def GrepFile(search, filename, ignoreCase):
    if not Perforce.IsFileInDepot(filename):
        print(('ERROR: %s is not in the depot.' % filename))
        return

    contents = Perforce.GetFileContents(filename)
    if ignoreCase:
        regex = re.compile(search, re.I | re.S)
    else:
        regex = re.compile(search, re.S)

    for match in regex.finditer(contents):
        print(('%s %s' % (filename, PrintMatch(match))))
Пример #2
0
    def __init__(self, path, cfg):
        self.mName = os.path.basename(path)
        self.mPath = path
        self.mConfig = cfg
        self.mProjects = {}

        regex = re.compile('^.*\.(?:h|hpp|c|cpp)$', re.I)
        devdir = os.path.join(self.mPath, 'Dev')

        for root, dirs, files in os.walk(devdir):
            for dir in dirs:
                if dir.lower() == cfg.lower():
                    keyname = root.lower
                    self.mProjects[keyname] = Project(root, cfg)
                    print(root)
                    for file in files:
                        filename = os.path.join(root, file)
                        if regex.match(filename) and Perforce.IsFileInDepot(
                                filename):
                            self.mProjects[keyname].AddFile(filename)
Пример #3
0
def IsFileOpened(name):
    return IsFileWritable(name) and Perforce.IsFileInDepot(name)