def p4BranchesInGit(branchesAreInRemotes=True):
 branches = {}
 cmdline = 'git rev-parse --symbolic '
 if branchesAreInRemotes:
  cmdline += '--remotes'
 else:
  cmdline += '--branches'
 for line in read_pipe_lines(cmdline):
  line = line.strip()
  if (not line.startswith('p4/')):
   continue
  if (line == 'p4/HEAD'):
   continue
  branch = line[len('p4/'):]
  branches[branch] = parseRevision(line)
 return branches

def p4BranchesInGit ( branchesAreInRemotes = True ) : branches = { } cmdline = 'git rev-parse --symbolic ' if branchesAreInRemotes : cmdline += '--remotes' else : cmdline += '--branches' for line in read_pipe_lines ( cmdline ) : line = line . strip ( ) if ( not line . startswith ( 'p4/' ) ) : continue if ( line == 'p4/HEAD' ) : continue branch = line [ len ( 'p4/' ) : ] branches [ branch ] = parseRevision ( line ) return branches
find all the branches whose names start with "p4/" .