Skip to content

Commit

Permalink
git p4: rearrange self.initialParent use
Browse files Browse the repository at this point in the history
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 <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Pete Wyckoff authored and Junio C Hamano committed Jan 15, 2013
1 parent 40d69ac commit 4749784
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions git-p4.py
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,7 @@ def importChanges(self, changes):
files = self.extractFilesFromCommit(description)
self.commit(description, files, self.branch,
self.initialParent)
# only needed once, to connect to the previous commit
self.initialParent = ""
except IOError:
print self.gitError.read()
Expand Down Expand Up @@ -2748,7 +2749,6 @@ def importHeadRevision(self, revision):
def run(self, args):
self.depotPaths = []
self.changeRange = ""
self.initialParent = ""
self.previousDepotPaths = []
self.hasOrigin = False

Expand Down Expand Up @@ -2836,8 +2836,6 @@ def run(self, args):
if p4Change > 0:
self.depotPaths = sorted(self.previousDepotPaths)
self.changeRange = "@%s,#head" % p4Change
if not self.detectBranches:
self.initialParent = parseRevision(self.branch)
if not self.silent and not self.detectBranches:
print "Performing incremental import into %s git branch" % self.branch

Expand Down Expand Up @@ -2982,6 +2980,14 @@ def run(self, args):

self.updatedBranches = set()

if not self.detectBranches:
if args:
# start a new branch
self.initialParent = ""
else:
# build on a previous revision
self.initialParent = parseRevision(self.branch)

self.importChanges(changes)

if not self.silent:
Expand Down

0 comments on commit 4749784

Please sign in to comment.