diff options
Diffstat (limited to 'netrender/versioning.py')
-rw-r--r-- | netrender/versioning.py | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/netrender/versioning.py b/netrender/versioning.py index e88416cd..871fe687 100644 --- a/netrender/versioning.py +++ b/netrender/versioning.py @@ -23,34 +23,34 @@ import subprocess from netrender.utils import * class AbstractVCS: - name = "ABSTRACT VCS" + name = "ABSTRACT VCS" def __init__(self): pass - + def update(self, info): """update(info) Update a working copy to the specified revision. If working copy doesn't exist, do a full get from server to create it. [info] model.VersioningInfo instance, specifies the working path, remote path and version number.""" pass - + def revision(self, path): """revision(path) return the current revision of the specified working copy path""" pass - + def path(self, path): """path(path) return the remote path of the specified working copy path""" pass - + class Subversion(AbstractVCS): name = "Subversion" description = "Use the Subversion version control system" def __init__(self): super().__init__() - self.version_exp = re.compile("([0-9]*)") - self.path_exp = re.compile("URL: (.*)") + self.version_exp = re.compile("([0-9]*)") + self.path_exp = re.compile("URL: (.*)") def update(self, info): if not os.path.exists(info.wpath): @@ -61,28 +61,28 @@ class Subversion(AbstractVCS): else: with DirectoryContext(info.wpath): subprocess.call(["svn", "up", "--accept", "theirs-full", "-r", str(info.revision)]) - + def revision(self, path): if not os.path.exists(path): return with DirectoryContext(path): stdout = subprocess.check_output(["svnversion"]) - + match = self.version_exp.match(str(stdout, encoding="utf-8")) - + if match: return match.group(1) - + def path(self, path): if not os.path.exists(path): return with DirectoryContext(path): stdout = subprocess.check_output(["svn", "info"]) - + match = self.path_exp.search(str(stdout, encoding="utf-8")) - + if match: return match.group(1) @@ -91,7 +91,7 @@ class Git(AbstractVCS): description = "Use the Git distributed version control system" def __init__(self): super().__init__() - self.version_exp = re.compile("^commit (.*)") + self.version_exp = re.compile("^commit (.*)") def update(self, info): if not os.path.exists(info.wpath): @@ -102,19 +102,19 @@ class Git(AbstractVCS): with DirectoryContext(info.wpath): subprocess.call(["git", "checkout", str(info.revision)]) - + def revision(self, path): if not os.path.exists(path): return with DirectoryContext(path): stdout = subprocess.check_output(["git", "show"]) - + match = self.version_exp.search(str(stdout, encoding="utf-8")) - + if match: return match.group(1) - + def path(self, path): if not os.path.exists(path): return |