Skip to content

Commit

Permalink
Modified function in launcher script to use varargs.
Browse files Browse the repository at this point in the history
Stylistically, it's a bit nicer than a list.
  • Loading branch information
mdippery committed Oct 30, 2008
1 parent 802f3da commit 74896a8
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions bin/code_swarm
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def autogenerate_files(options):
dir = code_swarm_dir("hg")
generate_log = do_hg
else:
msg = "This directory isn't an svn, git, or hg project."
msg = "This directory isn't an svn, git, or hg project. "
msg += "Run in the base directory of a source-controlled project."
print >>sys.stderr, msg
sys.exit(2)
Expand All @@ -184,7 +184,7 @@ def autogenerate_files(options):
return proj_cfg


def do_cmds(cmds):
def do_cmds(*cmds):
for cmd in cmds:
if not os.system(cmd) == 0:
raise Exception("Error running `%s'" % cmd)
Expand All @@ -196,28 +196,27 @@ def do_git(dir):
tmp = os.path.join(dir, "temp.log")
xml = os.path.join(dir, "log.xml")

return do_cmds(['git log --name-status --pretty=format:"%s" > %s'
% (fmt, tmp)
,"convert_logs.py -g %s -o %s" % (tmp, xml)
,"rm " + tmp])
return do_cmds('git log --name-status --pretty=format:"%s" > %s'%(fmt, tmp)
,"convert_logs.py -g %s -o %s" % (tmp, xml)
,"rm " + tmp)


def do_svn(dir):
tmp = os.path.join(dir, "temp.log")
xml = os.path.join(dir, "log.xml")

return do_cmds(["svn log -v > " + tmp
,"convert_logs.py -s %s -o %s" % (tmp, xml)
,"rm " + tmp])
return do_cmds("svn log -v > " + tmp
,"convert_logs.py -s %s -o %s" % (tmp, xml)
,"rm " + tmp)


def do_hg(dir):
tmp = os.path.join(dir, "unsorted_log.xml")
xml = os.path.join(dir, "log.xml")

return do_cmds(["hg_log.py -o %s ." % tmp
,"sort_code_swarm_input.py < %s > %s" % (tmp, xml)
,"rm " + tmp])
return do_cmds("hg_log.py -o %s ." % tmp
,"sort_code_swarm_input.py < %s > %s" % (tmp, xml)
,"rm " + tmp)

def do_freebase(domain):
dir = os.path.abspath(tempfile.gettempdir())
Expand Down

0 comments on commit 74896a8

Please sign in to comment.