Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: infra/services/gnumbd/__main__.py

Issue 355153002: Refactor infra git libs and testing. (Closed) Base URL: https://chromium.googlesource.com/infra/infra@fake_testing_support
Patch Set: Change config ref to have a sandard naming scheme Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: infra/services/gnumbd/__main__.py
diff --git a/infra/services/gnumbd/__main__.py b/infra/services/gnumbd/__main__.py
index 4f81953c4d46cc23b95a7c4ab80b56ddaa6a789e..b332f965bb8b4a1f83ba8e8b036d26dcf8478e1d 100644
--- a/infra/services/gnumbd/__main__.py
+++ b/infra/services/gnumbd/__main__.py
@@ -10,12 +10,14 @@ import sys
import time
import urlparse
-LOGGER = logging.getLogger(__name__)
+from infra.libs import git2
+
+from infra.services.gnumbd import gnumbd
-from infra.services.gnumbd.inner_loop import (
- inner_loop, DEFAULT_CONFIG_REF, DEFAULT_REPO_DIR)
-from infra.services.gnumbd.support import git, config_ref
+LOGGER = logging.getLogger(__name__)
+
+DEFAULT_REPO_DIR = 'gnumbd_repos'
def parse_args(args): # pragma: no cover
@@ -26,7 +28,7 @@ def parse_args(args): # pragma: no cover
'Repo URL must use https, git or file protocol.')
if not parsed.path.strip('/'):
raise argparse.ArgumentTypeError('URL is missing a path?')
- return git.Repo(s)
+ return git2.Repo(s)
parser = argparse.ArgumentParser('python -m %s' % __package__)
g = parser.add_mutually_exclusive_group()
@@ -39,8 +41,6 @@ def parse_args(args): # pragma: no cover
dest='log_level', help='Make the output really loud.')
parser.add_argument('--dry_run', action='store_true',
help='Do not actually push anything.')
- parser.add_argument('--config_ref', metavar='REF', default=DEFAULT_CONFIG_REF,
- help='The config ref to use (default: %(default)s)')
parser.add_argument('--repo_dir', metavar='DIR', default=DEFAULT_REPO_DIR,
help=('The directory to use for git clones '
'(default: %(default)s)'))
@@ -60,11 +60,12 @@ def parse_args(args): # pragma: no cover
if e.errno != errno.EEXIST:
raise
- return repo, config_ref.ConfigRef(git.Ref(repo, opts.config_ref))
+ return repo
def main(args): # pragma: no cover
- repo, cref = parse_args(args)
+ repo = parse_args(args)
+ cref = gnumbd.GnumbdConfigRef(repo)
repo.reify()
loop_count = 0
@@ -75,7 +76,7 @@ def main(args): # pragma: no cover
print
try:
- inner_loop(repo, cref)
+ gnumbd.inner_loop(repo, cref)
except KeyboardInterrupt:
raise
except Exception:

Powered by Google App Engine
This is Rietveld 408576698