예제 #1
0
 def itdb_exists(self):
     if git.branch_exists(it.ITDB_BRANCH):
         ls = git.full_tree(it.ITDB_BRANCH)
         abs_hold_file = os.path.join(it.TICKET_DIR, it.HOLD_FILE)
         for _, _, _, file in ls:
             if file == abs_hold_file:
                 return True
         return False
예제 #2
0
파일: gitit.py 프로젝트: dongrote/git-it
 def itdb_exists(self):
     if git.branch_exists(it.ITDB_BRANCH):
         ls = git.full_tree(it.ITDB_BRANCH)
         abs_hold_file = os.path.join(it.TICKET_DIR, it.HOLD_FILE)
         for _, _, _, file in ls:
             if file == abs_hold_file:
                 return True
         return False
예제 #3
0
파일: gitit.py 프로젝트: dongrote/git-it
    def match_or_error(self, sha):
        self.require_itdb()
        files = git.full_tree(it.ITDB_BRANCH + ':' + it.TICKET_DIR)
        matches = []
        for _, _, _, path in files:
            _, file = os.path.split(path)
            if file.startswith(sha):
                matches.append(path)

        if len(matches) == 0:
            log.printerr('no such ticket')
            sys.exit(1)
        elif len(matches) > 1:
            log.printerr('ambiguous match critiria. the following tickets match:')
            for match in matches:
                _, id = os.path.split(match)
                log.printerr(id)
            sys.exit(1)
        else:
            return os.path.join(it.TICKET_DIR, matches[0])
예제 #4
0
    def match_or_error(self, sha):
        self.require_itdb()
        files = git.full_tree(it.ITDB_BRANCH + ':' + it.TICKET_DIR)
        matches = []
        for _, _, _, path in files:
            _, file = os.path.split(path)
            if file.startswith(sha):
                matches.append(path)

        if len(matches) == 0:
            log.printerr('no such ticket')
            sys.exit(1)
        elif len(matches) > 1:
            log.printerr(
                'ambiguous match critiria. the following tickets match:')
            for match in matches:
                _, id = os.path.split(match)
                log.printerr(id)
            sys.exit(1)
        else:
            return os.path.join(it.TICKET_DIR, matches[0])