Skip to content

Commit

Permalink
--branch, and some output formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-matthewb committed Nov 7, 2015
1 parent f5d91bc commit 6626f78
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
47 changes: 26 additions & 21 deletions bin/enlist_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

def call(args):
if verbose:
print " ".join(args)
print "$", " ".join(args)
return subprocess.call(args)


def check_output(args):
if verbose:
print " ".join(args)
print "$", " ".join(args)
return subprocess.check_output(args)


Expand All @@ -36,17 +36,21 @@ class Config:
branch=None

def debug_print(self):
print "[%s]\n\trepo=%s\n\tpath=%s\n\turl=%s\n\tbranch=%s\n\tcheckout=%s\n" % (self.name, self.repo, self.path, self.url, self.branch, self.checkout)
print "[%s]\n\trepo=%s\n\tpath=%s\n\turl=%s\n\tbranch=%s" % (self.name, self.repo, self.path, self.url, self.branch)


def validate(self):
if self.checkout is not None:
if self.checkout:
if self.checkout.startswith("svn"):
self.repo = "svn"
if self.checkout.startswith("git"):
self.repo = "git"
m = re.search("\\shttps?://\\S*", self.checkout)
if m is not None:
self.url = m.string[m.start():m.end()].strip()
m = re.search("\\s(https?://\\S*)", self.checkout)
if m:
self.url = m.group(1)
m = re.search("\\s(-b|--branch)\\s*(\\S*)", self.checkout)
if m:
self.branch = m.group(2)

if self.repo is None and self.checkout is not None:
if self.checkout.startswith("svn"):
Expand Down Expand Up @@ -93,7 +97,7 @@ def enlist_svn(config):
def check(config):
os.chdir(cwd)
if not os.path.isdir(config.path):
print "directory does not exist: " + config.path
print "! directory does not exist: " + config.path
return False
ok = True
if config.repo == "git":
Expand All @@ -107,12 +111,12 @@ def check(config):
def check_git(config):
os.chdir(config.path)
if not os.path.isdir(".git"):
print "directory does not appear to have a git enlistment: " + os.getcwd()
print "! directory does not appear to have a git enlistment: " + os.getcwd()
return False
url = check_output(["git", "config", "--get", "remote.origin.url"])
url = url.strip()
if url != config.url:
print "wrong remote url: %s" % (url)
print "! wrong remote url: %s" % (url)
return False

if config.branch is not None:
Expand All @@ -126,10 +130,10 @@ def check_git(config):
if branch == config.branch:
found = True
elif branch != config.branch:
print "expected to find branch '%s' found '%s'" % (config.branch, branch)
print "! expected to find branch '%s' found '%s'" % (config.branch, branch)
return False
if not found:
print "couldn't find current branch for %s" % (config.path)
print "! couldn't find current branch for %s" % (config.path)
return False

return True
Expand All @@ -138,7 +142,7 @@ def check_git(config):
def check_svn(config):
os.chdir(config.path)
if not os.path.isdir(".svn"):
print "directory does not appear to have a subversion enlistment: " + os.getcwd()
print "! directory does not appear to have a subversion enlistment: " + os.getcwd()
return False

info = check_output(["svn", "info"])
Expand All @@ -149,7 +153,7 @@ def check_svn(config):
line = line[5:]
url = line.strip()
if url != config.url:
print "wrong remote url: %s" % (url)
print "! wrong remote url: %s" % (url)
return False
return True

Expand Down Expand Up @@ -240,25 +244,26 @@ def main(argv):

configs = parse_configuration_file(config_file)

if verbose:
for config in configs:
config.debug_print()

if "enlist"==command:
if ".mrconfig" != config_file:
shutil.copyfile(config_file,".mrconfig")
for config in configs:
if verbose:
config.debug_print()
enlist(config)

if "sync"==command:
print "NYI"
if verbose:
print

if "check"==command:
OK = True
for config in configs:
if verbose:
config.debug_print()
ret = check(config)
if not ret:
OK = False
if verbose:
print
if OK:
print "looks good"

Expand Down
4 changes: 2 additions & 2 deletions bin/mr
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ sub loadconfig {
# safe.
}
else {
$trusterror->("illegal setting \"$parameter=$value\"");
# $trusterror->("illegal setting \"$parameter=$value\"");
}
}

Expand Down Expand Up @@ -2325,4 +2325,4 @@ right = echo "Not found."
# Local variables:
# indent-tabs-mode: t
# cperl-indent-level: 8
# End:
# End:
8 changes: 0 additions & 8 deletions bin/switch.py

This file was deleted.

5 changes: 2 additions & 3 deletions release15_3.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
checkout = svn checkout https://hedgehog.fhcrc.org/tor/stedi/branches/release15.3 .

[server/optionalModules/argos]
checkout = git clone http://www.github.com/LabKey/argos.git
checkout = git clone http://www.github.com/LabKey/argos.git -b release15.3
branch = release15.3

[server/optionalModules/argos_test]
checkout = git clone http://www.github.com/LabKey/argos_test.git
branch = release15.3
checkout = git clone http://www.github.com/LabKey/argos_test.git -b release15.3

0 comments on commit 6626f78

Please sign in to comment.