summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Likins <alikins@redhat.com>2008-11-10 13:07:17 -0500
committerAdrian Likins <alikins@redhat.com>2008-11-10 13:07:17 -0500
commite4d2cf1ce12ac6e9c315b4b4d10cf5d768ff9e0b (patch)
tree4a8298c3c220efe377ea4e23bf7ca8a59cd118e8
parent44fea7931e4dd04857500125aeb5ee3fb10544cd (diff)
parent1a92458de0cc1e594ef5fdc292d8c322902db7fe (diff)
downloadfunc-e4d2cf1ce12ac6e9c315b4b4d10cf5d768ff9e0b.tar.gz
func-e4d2cf1ce12ac6e9c315b4b4d10cf5d768ff9e0b.tar.xz
func-e4d2cf1ce12ac6e9c315b4b4d10cf5d768ff9e0b.zip
Merge branch 'gum'
-rwxr-xr-xgum216
-rw-r--r--gum.config14
-rw-r--r--pusher.py2
3 files changed, 231 insertions, 1 deletions
diff --git a/gum b/gum
new file mode 100755
index 0000000..241157f
--- /dev/null
+++ b/gum
@@ -0,0 +1,216 @@
+#!/usr/bin/python
+
+
+import optparse
+import os
+import subprocess
+import sys
+
+# wrapper script to make it a little easier to track git repo's of func
+#
+## Copyright 2008, Adrian Likins <alikins@redhat.com>
+##
+## This software may be freely redistributed under the terms of the GNU
+## general public license.
+##
+
+
+#REPOS=$(git-config --file gum.config --get-regexp "remote\..*\.url" | cut -f2 -d' ')
+#echo $REPOS
+
+def get_remotes():
+ pass
+
+
+def find_new_branches(remote):
+ pass
+
+def find_all_new_branches(remotes):
+ pass
+
+
+# ugh, what is it with me and software that involces "repos"? -akl
+class Repos(object):
+ remotes = {}
+ def __init__(self):
+ self.remotes = {}
+ self.local_config = {}
+ self.parse_config(filename="gum.config",
+ config=self.remotes)
+ self.parse_config(filename=".git/config",
+ config=self.local_config)
+
+ def parse_config(self, filename=None, config={}):
+ file_arg = ""
+ if filename:
+ file_arg = "--file %s" % filename
+ cmd = "git-config %s --get-regexp 'remote\..*\.url'" % file_arg
+ p = subprocess.Popen(cmd, shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ output = p.communicate()
+ lines = output[0].splitlines()
+
+ for line in lines:
+ (name_blurb, url) = line.split()
+ # uh yeah, this should be a regex of something.
+ name = name_blurb.split('.')[1]
+ config[name] = url
+
+ def find_remote_branches(self, name):
+ remote_branches = []
+ branches_cmd = "git-ls-remote -h %s" % self.remotes[name]
+ p = subprocess.Popen(branches_cmd, shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ output = p.communicate()[0]
+ # print "output", output
+ branch_names = output.splitlines()
+ for branch_name_bits in branch_names:
+ # print branch_name
+ bits = branch_name_bits.split()
+ # print bits
+ # it's not really a path, but it looks enough like it
+ branch_name = os.path.basename(bits[1])
+ # print "name: %s branch_name %s" % (name, branch_name)
+ # print branch_name
+ remote_branches.append(branch_name)
+
+ return remote_branches
+
+ def find_remotes_branches(self, names):
+ remote_branches = {}
+ for name in names:
+ branches = self.find_remote_branches(name)
+ for branch in branches:
+ if not remote_branches.has_key(name):
+ remote_branches[name] = []
+ remote_branches[name].append(branch)
+
+ return remote_branches
+
+
+ def show_remote_branches(self):
+ branches = self.find_remotes_branches(self.names())
+
+ for repo in branches.keys():
+ for branch in branches[repo]:
+ print "%s/%s" % (repo, branch)
+
+ # see if we are already cofigured for a remote
+ def remote_exists(self, name):
+ if self.local_config.has_key(name):
+ print "remote exists", name
+ return True
+ return False
+
+ # see if we are already configure for a branch
+ def branch_exists(self, name):
+ pass
+
+ def add_remote(self, names):
+ print "add_remote", names
+ for name in names:
+ if not self.remote_exists(name):
+ print "name", name, "self.remotes[name]", self.remotes[name]
+ add_cmd = "git remote add %s %s" % (name, self.remotes[name])
+ p = subprocess.Popen(add_cmd, shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ output = p.communicate()
+
+ fetch_cmd = "git fetch %s" % name
+ p = subprocess.Popen(fetch_cmd, shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ output = p.communicate()
+ else:
+ print "%s is already added to the local git config" % name
+
+ branches = self.find_remote_branches(name)
+ print "add_remote branches", branches
+
+ for branch in branches:
+ add_branch_cmd = "echo git checkout -b %s-%s %s/%s " % (name, branch, name, branch)
+ p = subprocess.Popen(add_branch_cmd, shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE)
+ output = p.communicate()
+ print add_branch_cmd, output
+
+
+
+
+ def list_remotes(self):
+ for name in self.remotes.keys():
+ print name, self.remotes[name]
+
+ def names(self):
+ return self.remotes.keys()
+
+# parse args
+# "parse" gum.conf
+#
+
+#options
+# list-remotes
+# list-branches
+# add [remote]
+# (adds branches automatically)
+# --all
+# (adds all remotes we know about, and all branches)
+#
+# update remote
+# (adds any new branches)
+#
+# orphans [remote]
+# (shows any branches that are local that no longer exist remotely)
+#
+
+
+
+def main(args):
+ parser = optparse.OptionParser()
+ parser.add_option("-a","--add",
+ help="add a remote repo",
+ action="store_true",
+ dest="add",
+ default=False)
+ parser.add_option("-A","--add-all",
+ help="add a remote repo",
+ action="store_true",
+ dest="add_all",
+ default=False)
+ parser.add_option("-l","--list",
+ help="list remote repos",
+ action="store_true",
+ dest="list_remote",
+ default=False)
+ parser.add_option("-L","--list-branches",
+ help="list remote repos and branches",
+ action="store_true",
+ dest="list_remote_branches",
+ default=False)
+
+ parser.add_option("-u","--update",
+ help="update remote repos",
+ action="store_true",
+ dest="update_remote",
+ default=False)
+
+
+ (options,args) = parser.parse_args()
+
+
+ repos = Repos()
+
+ if options.add:
+ repos.add_remote(args)
+
+ if options.add_all:
+ repos.add_remote(repos.names())
+
+ if options.list_remote:
+ repos.list_remotes()
+
+ if options.list_remote_branches:
+ repos.show_remote_branches()
+# repos.find_remote_branches(repos.names())
+
+if __name__ == "__main__":
+ main(sys.argv)
diff --git a/gum.config b/gum.config
new file mode 100644
index 0000000..3618790
--- /dev/null
+++ b/gum.config
@@ -0,0 +1,14 @@
+[remote "kadamski"]
+ url = git://github.com/kadamski/func.git
+ fetch = refs/heads/*:refs/remotes/kadamski/*
+[remote "makkalot"]
+ url = git://github.com/makkalot/func.git
+ fetch = refs/heads/*:refs/remotes/makkalot/*
+[remote "mhicks"]
+ url = git://github.com/matthicksj/func.git
+ fetch = refs/heads/*:refs/remotes/mhicks/*
+
+[remote "alikins"]
+ url = git://github.com/alikins/func-alikins-devel.git
+ fetch = refs/heads/*:refs/remotes/func-alikins-devel/*
+
diff --git a/pusher.py b/pusher.py
index 4aab643..4fbd5cd 100644
--- a/pusher.py
+++ b/pusher.py
@@ -24,7 +24,7 @@ Work in progress
"""
# if new releases come out or old ones go away, edit here
-PROCESS_RELEASES = [ "devel", "F-9", "F-8", "F-7", "EL-5", "EL-4" ]
+PROCESS_RELEASES = [ "devel", "F-9", "F-8", "EL-5", "EL-4" ]
import optparse
import os