[damned-lies] Refs #187 - Removed some hardcoded references to 'master' branch
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Refs #187 - Removed some hardcoded references to 'master' branch
- Date: Mon, 17 Aug 2020 07:20:29 +0000 (UTC)
commit 2c2ce83c53308c3b487049e388e903e34839f498
Author: Claude Paroz <claude 2xlibre net>
Date: Mon Aug 17 09:19:43 2020 +0200
Refs #187 - Removed some hardcoded references to 'master' branch
stats/repos.py | 11 +++++++----
stats/utils.py | 13 +++++--------
2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/stats/repos.py b/stats/repos.py
index 28de2682..3ff79d49 100644
--- a/stats/repos.py
+++ b/stats/repos.py
@@ -48,8 +48,8 @@ class GitRepo(RepoBase):
return output != ""
def init_checkout(self):
- # We are assuming here that master is the first branch created
- if self.branch.name == "master":
+ if self.branch.is_head():
+ # We are assuming here that this is the first branch created
commands = [
['git', 'clone', self.branch.module.vcs_root, str(self.branch.co_path)],
['git', 'remote', 'update'],
@@ -117,10 +117,13 @@ class GitRepo(RepoBase):
def remove(self):
wdir = str(self.branch.co_path)
if os.access(wdir, os.W_OK):
- if self.branch.name == 'master':
+ if self.branch.is_head():
shutil.rmtree(wdir)
else:
- run_shell_command(['git', 'checkout', 'master'], cwd=wdir)
+ run_shell_command(
+ ['git', 'checkout', self.branch.module.get_head_branch().name],
+ cwd=wdir
+ )
run_shell_command(['git', 'branch', '-D', self.branch.name], cwd=wdir)
diff --git a/stats/utils.py b/stats/utils.py
index ec7de78d..e9ddaff3 100644
--- a/stats/utils.py
+++ b/stats/utils.py
@@ -647,18 +647,15 @@ def collect_its_data():
Fill a data directory with *.loc/*its files needed by gettext to extract
XML strings for GNOME modules .
"""
- from .models import Branch, ModuleLock
+ from .models import Module, ModuleLock
if not os.path.exists(ITS_DATA_DIR):
os.makedirs(ITS_DATA_DIR)
data_to_collect = getattr(settings, 'GETTEXT_ITS_DATA', {})
- for module, files in data_to_collect.items():
- try:
- branch = Branch.objects.get(module__name=module, name='master')
- except Branch.DoesNotExist:
- logging.error("Unable to find the master branch of module '%s'" % module)
- continue
- with ModuleLock(branch.module):
+ for module_name, files in data_to_collect.items():
+ mod = Module.objects.get(name=module_name)
+ branch = mod.get_head_branch()
+ with ModuleLock(mod):
branch.checkout()
for file_path in files:
src = branch.co_path / file_path
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]