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 <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
40d69ac3a4
commit
4749784444
12
git-p4.py
12
git-p4.py
|
|
@ -2683,6 +2683,7 @@ class P4Sync(Command, P4UserMap):
|
||||||
files = self.extractFilesFromCommit(description)
|
files = self.extractFilesFromCommit(description)
|
||||||
self.commit(description, files, self.branch,
|
self.commit(description, files, self.branch,
|
||||||
self.initialParent)
|
self.initialParent)
|
||||||
|
# only needed once, to connect to the previous commit
|
||||||
self.initialParent = ""
|
self.initialParent = ""
|
||||||
except IOError:
|
except IOError:
|
||||||
print self.gitError.read()
|
print self.gitError.read()
|
||||||
|
|
@ -2748,7 +2749,6 @@ class P4Sync(Command, P4UserMap):
|
||||||
def run(self, args):
|
def run(self, args):
|
||||||
self.depotPaths = []
|
self.depotPaths = []
|
||||||
self.changeRange = ""
|
self.changeRange = ""
|
||||||
self.initialParent = ""
|
|
||||||
self.previousDepotPaths = []
|
self.previousDepotPaths = []
|
||||||
self.hasOrigin = False
|
self.hasOrigin = False
|
||||||
|
|
||||||
|
|
@ -2836,8 +2836,6 @@ class P4Sync(Command, P4UserMap):
|
||||||
if p4Change > 0:
|
if p4Change > 0:
|
||||||
self.depotPaths = sorted(self.previousDepotPaths)
|
self.depotPaths = sorted(self.previousDepotPaths)
|
||||||
self.changeRange = "@%s,#head" % p4Change
|
self.changeRange = "@%s,#head" % p4Change
|
||||||
if not self.detectBranches:
|
|
||||||
self.initialParent = parseRevision(self.branch)
|
|
||||||
if not self.silent and not self.detectBranches:
|
if not self.silent and not self.detectBranches:
|
||||||
print "Performing incremental import into %s git branch" % self.branch
|
print "Performing incremental import into %s git branch" % self.branch
|
||||||
|
|
||||||
|
|
@ -2982,6 +2980,14 @@ class P4Sync(Command, P4UserMap):
|
||||||
|
|
||||||
self.updatedBranches = set()
|
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)
|
self.importChanges(changes)
|
||||||
|
|
||||||
if not self.silent:
|
if not self.silent:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue