Ejemplo n.º 1
0
	def oldcreate(self, name):
		"""
		create a new repo
		
		:param name: the name to give the new repo
		:type name: string
		"""
		repo = Repo.init_bare(name)
	
		from dulwich.objects import Tree
		tree = Tree()
		
		from dulwich.objects import Commit, parse_timezone
		from time import time
		commit = Commit()
		commit.tree = tree.id	#is the tree.id the sha1 of the files contained in tree
		author = "New Project Wizard <wizard@host>"
		commit.author = commit.committer = author
		commit.commit_time = commit.author_time = int(time())
		tz = parse_timezone('+1000')[0]
		commit.commit_timezone = commit.author_timezone = tz
		commit.encoding = "UTF-8"
		commit.message = "New Project."
	
		object_store = repo.object_store

		#then add the tree
		object_store.add_object(tree)
		#then add the commit
		object_store.add_object(commit)
		
		repo.refs['refs/heads/master'] = commit.id
		
		return {"success":"%s.git created" % name}
Ejemplo n.º 2
0
    def oldcreate(self, name):
        """
		create a new repo
		
		:param name: the name to give the new repo
		:type name: string
		"""
        repo = Repo.init_bare(name)

        from dulwich.objects import Tree
        tree = Tree()

        from dulwich.objects import Commit, parse_timezone
        from time import time
        commit = Commit()
        commit.tree = tree.id  #is the tree.id the sha1 of the files contained in tree
        author = "New Project Wizard <wizard@host>"
        commit.author = commit.committer = author
        commit.commit_time = commit.author_time = int(time())
        tz = parse_timezone('+1000')[0]
        commit.commit_timezone = commit.author_timezone = tz
        commit.encoding = "UTF-8"
        commit.message = "New Project."

        object_store = repo.object_store

        #then add the tree
        object_store.add_object(tree)
        #then add the commit
        object_store.add_object(commit)

        repo.refs['refs/heads/master'] = commit.id

        return {"success": "%s.git created" % name}
Ejemplo n.º 3
0
	def create(self, name):
		"""
		create a new repo
		
		:param name: the name to give the new repo
		:type name: string
		"""
		repo = Repo.init_bare(name)
Ejemplo n.º 4
0
    def create(self, name):
        """
		create a new repo
		
		:param name: the name to give the new repo
		:type name: string
		"""
        repo = Repo.init_bare(name)
Ejemplo n.º 5
0
 def open_repository(cls, path):
     regex = re.compile('/([A-Za-z0-9]+).git')
     results = regex.findall(path)
     name = results[0]
     return Repo(name)