Permalink
Browse files

Merge branch 'master' of https://github.com/stettberger/metagit

  • Loading branch information...
2 parents f111403 + 8221b9f commit c60c3b51b9e5b9e8668ef98fa61010a0475b3f4d @stettberger stettberger committed Sep 26, 2010
View
6 .gitignore
@@ -0,0 +1,6 @@
+*.pyc
+\#*
+*~
+.#*
+build/
+wiki/
View
0 gmp/__init__.py
No changes.
View
6 listers.py → gmp/listers.py
@@ -4,9 +4,9 @@
import subprocess
from xml.dom.minidom import parse as xml_parse
-from policy import *
-from repository import *
-from tools import *
+from gmp.policy import *
+from gmp.repository import *
+from gmp.tools import *
#
# Repository Lister Services
#
View
25 gmp.py → gmp/main.py
@@ -6,11 +6,11 @@
# Project specify
-from policy import *
-from repository import *
-from listers import *
-from tools import *
-from scm import *
+from gmp.policy import *
+from gmp.repository import *
+from gmp.listers import *
+from gmp.tools import *
+from gmp.scm import *
#
@@ -92,16 +92,21 @@ def _select(self, selector, state = None):
if selector in SCM.states:
selector = "^\\" + selector
repos = []
+
for s in self.sets.keys():
for repo in self.sets[s]:
- if os.path.exists(repo.local_url) \
- and os.path.exists(selector) \
- and os.path.samefile(selector, repo.local_url):
- return [repo]
- if (selector == "all" or re.search(selector, repo.status_line())) \
+ if selector == ".":
+ if os.path.exists(repo.local_url) and os.path.abspath(os.curdir).startswith(repo.local_url):
+ repos.append(repo)
+ elif (selector == "all" or re.search(selector, repo.status_line())) \
and repo.check_policy(self.hostname):
if not state or repo.get_state() in state:
repos.append(repo)
+
+ if selector == "." and len(repos) > 0:
+ # Take the closest match
+ repos = [sorted(repos, lambda a, b: len(b.local_url) - len(a.local_url))[0]]
+
return repos
def cmd_list(self, selector):
View
0 policy.py → gmp/policy.py
File renamed without changes.
View
6 repository.py → gmp/repository.py
@@ -1,8 +1,8 @@
import os
import re
-from policy import PolicyMixin
-from tools import *
-from scm import *
+from gmp.policy import PolicyMixin
+from gmp.tools import *
+from gmp.scm import *
class Repository (PolicyMixin):
"""A Repository instance represents exactly one repository"""
View
0 scm.py → gmp/scm.py
File renamed without changes.
View
0 tools.py → gmp/tools.py
File renamed without changes.
View
4 metagit
@@ -3,13 +3,13 @@
import imp, os
# git meta project: gmp
-import gmp
+import gmp.main
# Load the configuration file
config = imp.load_source("config", os.path.expanduser("~/.metagitrc"))
# Initialize a new repo manager
-manager = gmp.RepoManager()
+manager = gmp.main.RepoManager()
# Get all repository sets
for set_name in filter(lambda x: x.endswith("_repos"), dir(config)):
View
2 metagitrc-example
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# Import everything from the work module
-from gmp import *
+from gmp.main import *
###########################################
# Customize it and move it to ~/.metagitrc
View
21 setup.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+
+# The version is the latest git tag
+import subprocess
+a = subprocess.Popen("git tag | grep '^v' | tail -n 1", shell = True, stdout = subprocess.PIPE)
+version = a.stdout.readline().strip().replace("v", "")
+a.wait()
+
+setup(
+ name='metagit',
+ version= version,
+ author = "Christian Dietrich",
+ author_email = "stettberger@dokucode.de",
+ description='managing big amount of git repositories',
+ license = "GPLv3",
+ url='http://github.com/stettberger/metagit/',
+ packages=['gmp'],
+ scripts=['metagit']
+)
View
28 tests.py
@@ -1,28 +0,0 @@
-#!/usr/bin/python
-
-import unittest
-from gmp import *
-
-class RepositoryTestcase(unittest.TestCase):
- def setUp(self):
- self.repo = Repository("peer.zerites.org:config", "~/.git")
- def testPolicies(self):
- assert self.repo.check_policy("foobar") == True
-
- self.repo.add_policy("vamos1", "deny")
- assert self.repo.check_policy("vamos1.i4.informatik.uni-erlangen.de") == False
- assert self.repo.check_policy("foobar") == True
-
- def testGitOptions(self):
- self.repo.add_option("clone", "--bare")
- self.repo.add_option("clone", ["--bare", "foo"])
-
- assert self.repo.option("clone") == "--bare --bare foo"
-
- def testLocalName(self):
- self.assertEqual(Repository("foo/bar/baz/das.git").local_url, "./das")
- self.assertEqual(Repository("foo/bar/baz/das").local_url, "./das")
-
-
-if __name__ == "__main__":
- unittest.main()

0 comments on commit c60c3b5

Please sign in to comment.