diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-29 22:26:08 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2012-11-29 22:34:33 (GMT) |
commit | 59df9bd4d22715b03d1b765321021a59ebc9366b (patch) | |
tree | be1075a9e3a3c2d4908735e948e0d73d690ba9dd /devbot | |
parent | 48c02f188784d65bd501a907e572e041ed61dc15 (diff) |
Git clean not out-of-source modules instead of removing
Diffstat (limited to 'devbot')
-rw-r--r-- | devbot/build.py | 8 | ||||
-rw-r--r-- | devbot/config.py | 4 | ||||
-rw-r--r-- | devbot/git.py | 10 |
3 files changed, 17 insertions, 5 deletions
diff --git a/devbot/build.py b/devbot/build.py index e958078..8740927 100644 --- a/devbot/build.py +++ b/devbot/build.py @@ -8,7 +8,6 @@ import time from devbot import command from devbot import config from devbot import environ -from devbot import git from devbot import state from devbot import utils @@ -78,7 +77,8 @@ def clean(): for module in config.load_modules(): if not module.out_of_source: - _rmtree(module.get_source_dir()) + if module.get_git_module().clean(): + print "Cleaned %s git repository." % module.name def _unlink_libtool_files(): def func(arg, dirname, fnames): @@ -91,9 +91,7 @@ def _pull_module(module): print "\n=== Pulling %s ===\n" % module.name try: - git_module = git.Module(config.get_source_dir(), module.name, - module.repo, module.tag) - git_module.update() + module.get_git_module().update() except subprocess.CalledProcessError: return False diff --git a/devbot/config.py b/devbot/config.py index 0f76644..cece353 100644 --- a/devbot/config.py +++ b/devbot/config.py @@ -7,6 +7,7 @@ import tempfile from devbot import distro from devbot import utils from devbot import plugins +from devbot import git devbot_dir = None config_dir = None @@ -54,6 +55,9 @@ class Module: return utils.get_commit_id(self.get_source_dir()) + def get_git_module(self): + return git.Module(get_source_dir(), self.name, self.repo, self.tag) + def _ensure_dir(dir): if not os.path.exists(dir): os.mkdir(dir) diff --git a/devbot/git.py b/devbot/git.py index 55fd9f5..8db61d2 100644 --- a/devbot/git.py +++ b/devbot/git.py @@ -36,3 +36,13 @@ class Module: command.run(["git", "checkout", self.tag]) else: command.run(["git", "merge", "origin", self._branch]) + + def clean(self): + try: + os.chdir(self.local) + except OSError: + return False + + command.run(["git", "clean", "-fdx"]) + + return True |