Lines Matching full:branch
47 # Add this in case we have a branch with the same name as a directory.
54 """Returns number of commits between HEAD and the tracking branch.
56 This looks back to the tracking branch and works out the number of commits
60 Number of patches that exist on top of the branch
84 def GuessUpstream(git_dir, branch): argument
85 """Tries to guess the upstream for a branch
87 This lists out top commits on a branch and tries to find a suitable
89 'git name-rev' returns a plain branch name, with no ! or ^ modifiers.
93 branch: Name of branch
97 Name of upstream branch (e.g. 'upstream/master') or None if none
100 pipe = [LogCmd(branch, git_dir=git_dir, oneline=True, count=100)]
104 return None, "Branch '%s' not found" % branch
112 return None, "Cannot find a suitable upstream for branch '%s'" % branch
114 def GetUpstream(git_dir, branch): argument
115 """Returns the name of the upstream for a branch
119 branch: Name of branch
123 Name of upstream branch (e.g. 'upstream/master') or None if none
128 'branch.%s.remote' % branch)
130 'branch.%s.merge' % branch)
132 upstream, msg = GuessUpstream(git_dir, branch)
141 raise ValueError("Cannot determine upstream branch for branch "
142 "'%s' remote='%s', merge='%s'" % (branch, remote, merge))
145 def GetRangeInBranch(git_dir, branch, include_upstream=False): argument
146 """Returns an expression for the commits in the given branch.
150 branch: Name of branch
152 Expression in the form 'upstream..branch' which can be used to
153 access the commits. If the branch does not exist, returns None.
155 upstream, msg = GetUpstream(git_dir, branch)
158 rstr = '%s%s..%s' % (upstream, '~' if include_upstream else '', branch)
179 def CountCommitsInBranch(git_dir, branch, include_upstream=False): argument
180 """Returns the number of commits in the given branch.
184 branch: Name of branch
186 Number of patches that exist on top of the branch, or None if the
187 branch does not exist.
189 range_expr, msg = GetRangeInBranch(git_dir, branch, include_upstream)
200 Number of patches that exist on top of the branch
257 """Create a series of patches from the top of the current branch.