Exemplo n.º 1
0
 def __init__(self,
              dirty=True,
              describe="v0.1.2-3-g123",
              branch="master",
              commitid="abc123"):
     self.dirty = dirty
     self.describe = describe
     self.branch = branch
     self.commitid = commitid
     Git.__init__(self, TESTS)
Exemplo n.º 2
0
 def __init__(self,
              dirty=True,
              describe='v0.1.2-3-g123',
              branch='master',
              commitid='abc123'):
     self.dirty = dirty
     self.describe = describe
     self.branch = branch
     self.commitid = commitid
     Git.__init__(self, TESTS)
Exemplo n.º 3
0
    def get_output(self, cmd, *args, **kwargs):
        if cmd.startswith("diff"):
            return 1 if self.dirty else 0

        if cmd == "describe":
            return self.describe

        if cmd == "rev-parse":
            if "--abbrev-ref" in args:
                return self.branch

            return self.commitid

        if cmd == "rev-list":
            return self.commitid.split()

        if cmd == "config":
            return args[1]

        if cmd == "show-ref":
            return self._local_tags

        if cmd == "ls-remote":
            return self._remote_tags

        if cmd.startswith("fetch"):
            return None

        if cmd.startswith("status"):
            return self.status_message

        assert kwargs.get("dryrun") is True
        return Git.get_output(self, cmd, *args, **kwargs)
Exemplo n.º 4
0
 def __init__(
         self,
         dirty=True,
         describe="v0.1.2-3-g123",
         branch="master",
         commitid="abc123",
         local_tags="",
         remote_tags="",
 ):
     self.dirty = dirty
     self.describe = describe
     self.branch = branch
     self.commitid = commitid
     self._local_tags = local_tags
     self._remote_tags = remote_tags
     Git.__init__(self, TESTS)
Exemplo n.º 5
0
def project_scm(root):
    """
    :param str root: Path to project folder
    :return setupmeta.scm.Scm: SCM used by project, if any
    """
    scm_root = find_scm_root(os.path.abspath(root), 'git')
    if scm_root:
        return Git(scm_root)
    if os.environ.get(setupmeta.SCM_DESCRIBE):
        return Snapshot(root)
    snapshot = os.path.join(root, setupmeta.VERSION_FILE)
    if os.path.isfile(snapshot):
        return Snapshot(root)
    setupmeta.trace("could not determine SCM for '%s'" % root)
    return None
Exemplo n.º 6
0
 def get_output(self, cmd, *args, **kwargs):
     if cmd == "diff":
         return 1 if self.dirty else 0
     if cmd == "describe":
         return self.describe
     if cmd == "rev-parse":
         if "--abbrev-ref" in args:
             return self.branch
         return self.commitid
     if cmd == "rev-list":
         return self.commitid.split()
     if cmd == "config":
         return args[1]
     assert kwargs.get("dryrun") is True
     return Git.get_output(self, cmd, *args, **kwargs)
Exemplo n.º 7
0
 def get_output(self, cmd, *args, **kwargs):
     if cmd == 'diff':
         return 1 if self.dirty else 0
     if cmd == 'describe':
         return self.describe
     if cmd == 'rev-parse':
         if '--abbrev-ref' in args:
             return self.branch
         return self.commitid
     if cmd == 'rev-list':
         return self.commitid.split()
     if cmd == 'config':
         return args[1]
     assert kwargs.get('dryrun') is True
     return Git.get_output(self, cmd, *args, **kwargs)