File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -547,27 +547,36 @@ def gitConfigList(key):
547
547
_gitConfig [key ] = read_pipe ("git config --get-all %s" % key , ignore_error = True ).strip ().split (os .linesep )
548
548
return _gitConfig [key ]
549
549
550
- def p4BranchesInGit (branchesAreInRemotes = True ):
550
+ def p4BranchesInGit (branchesAreInRemotes = True ):
551
+ """Find all the branches whose names start with "p4/", looking
552
+ in remotes or heads as specified by the argument. Return
553
+ a dictionary of { branch: revision } for each one found.
554
+ The branch names are the short names, without any
555
+ "p4/" prefix."""
556
+
551
557
branches = {}
552
558
553
559
cmdline = "git rev-parse --symbolic "
554
560
if branchesAreInRemotes :
555
- cmdline += " --remotes"
561
+ cmdline += "--remotes"
556
562
else :
557
- cmdline += " --branches"
563
+ cmdline += "--branches"
558
564
559
565
for line in read_pipe_lines (cmdline ):
560
566
line = line .strip ()
561
567
562
- ## only import to p4/
563
- if not line .startswith ('p4/' ) or line == "p4/HEAD" :
568
+ # only import to p4/
569
+ if not line .startswith ('p4/' ):
570
+ continue
571
+ # special symbolic ref to p4/master
572
+ if line == "p4/HEAD" :
564
573
continue
565
- branch = line
566
574
567
- # strip off p4
568
- branch = re . sub ( "^ p4/", "" , line )
575
+ # strip off p4/ prefix
576
+ branch = line [ len ( " p4/"):]
569
577
570
578
branches [branch ] = parseRevision (line )
579
+
571
580
return branches
572
581
573
582
def findUpstreamBranchPoint (head = "HEAD" ):
You can’t perform that action at this time.
0 commit comments