MCPcopy
hub / github.com/gitless-vcs/gitless / create_branch

Method create_branch

gitless/core.py:465–480  ·  view source on GitHub ↗
(self, name, head)

Source from the content-addressed store, hash-verified

463 # Branch-related methods
464
465 def create_branch(self, name, head):
466 if self.lookup_branch(name):
467 raise GlError(
468 'Branch {0} already exists in remote repository {1}'.format(
469 name, self.name))
470 # Push won't let us push the creation of a new branch from a SHA. So we
471 # create a temporary local ref, make it point to the commit, and do the
472 # push
473 tmp_b = self.gl_repo.create_branch('gl_tmp_ref', head)
474 try:
475 git.push(self.name, '{0}:{1}'.format(tmp_b, name))
476 return self.lookup_branch(name)
477 except ErrorReturnCode as e:
478 raise GlError(stderr(e))
479 finally:
480 tmp_b.delete()
481
482 def listall_branches(self):
483 """Return a list with the names of all the branches in this repository.

Callers 6

create_branchMethod · 0.45
_do_createFunction · 0.45
test_createMethod · 0.45
setUpMethod · 0.45

Calls 4

lookup_branchMethod · 0.95
GlErrorClass · 0.85
stderrFunction · 0.70
deleteMethod · 0.45

Tested by 4

test_createMethod · 0.36
setUpMethod · 0.36