Skip to content

Commit 4749784

Browse files
Pete Wyckoffgitster
authored andcommitted
git p4: rearrange self.initialParent use
This was set in a couple of places, both of which were very far away from its use. Move it a bit closer to importChanges(), and add some comments. Signed-off-by: Pete Wyckoff <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 40d69ac commit 4749784

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

git-p4.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,6 +2683,7 @@ def importChanges(self, changes):
26832683
files = self.extractFilesFromCommit(description)
26842684
self.commit(description, files, self.branch,
26852685
self.initialParent)
2686+
# only needed once, to connect to the previous commit
26862687
self.initialParent = ""
26872688
except IOError:
26882689
print self.gitError.read()
@@ -2748,7 +2749,6 @@ def importHeadRevision(self, revision):
27482749
def run(self, args):
27492750
self.depotPaths = []
27502751
self.changeRange = ""
2751-
self.initialParent = ""
27522752
self.previousDepotPaths = []
27532753
self.hasOrigin = False
27542754

@@ -2836,8 +2836,6 @@ def run(self, args):
28362836
if p4Change > 0:
28372837
self.depotPaths = sorted(self.previousDepotPaths)
28382838
self.changeRange = "@%s,#head" % p4Change
2839-
if not self.detectBranches:
2840-
self.initialParent = parseRevision(self.branch)
28412839
if not self.silent and not self.detectBranches:
28422840
print "Performing incremental import into %s git branch" % self.branch
28432841

@@ -2982,6 +2980,14 @@ def run(self, args):
29822980

29832981
self.updatedBranches = set()
29842982

2983+
if not self.detectBranches:
2984+
if args:
2985+
# start a new branch
2986+
self.initialParent = ""
2987+
else:
2988+
# build on a previous revision
2989+
self.initialParent = parseRevision(self.branch)
2990+
29852991
self.importChanges(changes)
29862992

29872993
if not self.silent:

0 commit comments

Comments
 (0)