예제 #1
0
 def change_branch_name(self, args):
   new_name = args.new_name
   node_index = self._tree._get_node_index(self._get_current_branch_name())
   if new_name is None:
     new_name = str(node_index)
   common.sys_raise("git branch -m %s" % new_name)
   self._tree.set_node_name(node_index, new_name)
예제 #2
0
  def commit(self, args):
    branch_name = args.branch_name
    if branch_name is None:
      branch_name = str(self._get_next_available_branch())

    current_name = self._get_current_branch_name()
    common.sys_raise("git checkout -b %s && git commit" % branch_name)
    # Add a new one.
    self._tree.create_node(branch_name)
    self._tree.add_edge(current_name, branch_name)
예제 #3
0
 def _switch_branch(self, new_branch_name):
   #error = common.sys_raise("git diff-index --quiet HEAD -- && git checkout " + new_branch_name)
   error = common.sys_raise("git checkout " + new_branch_name)
   if self._get_current_branch_name() != new_branch_name:
     raise RuntimeError("switch to branch %s failed" % new_branch_name)
   return error
예제 #4
0
 def set_as_master_branch(self, args):
   common.sys_raise("git checkout -b 0")
예제 #5
0
 def diff_parent(self, git_command, *args):
   current_branch = self._get_current_branch_name()
   parent_branch_name = self._tree.get_parent(current_branch)
   opt = " ".join(args)
   common.sys_raise("git %s %s %s" % (git_command, parent_branch_name, opt))
예제 #6
0
 def sync(self, args):
   common.sys_raise("git checkout master")
   common.sys_raise("git pull")
   self._tree.move_one_edge_by_index(0, -1)
예제 #7
0
 def update(self, args):
   branch_name = args.branch_name
   common.sys_raise("git checkout %s" % branch_name)
예제 #8
0
 def prune(self, args):
   branch_name = args.branch_name
   common.sys_raise("git branch -D %s" % branch_name)
   self._tree.remove_node_by_name(branch_name)
예제 #9
0
 def amend(self, args):
   common.sys_raise("git commit --amend --no-edit")
   current_branch = self._get_current_branch_name()
   self._tree.move_one_edge(current_branch,
                            self._tree.get_parent(current_branch))