Fix common path "calculation" from logs of multiple branches.
Need to use min instead of max for prev/cur to avoid out-of-bounds string access. Also treat "i" as index of the last match instead of a length because in case of a complete match of the two strings i was off by one. Signed-off-by: Simon Hausmann <shausman@trolltech.com>
This commit is contained in:
parent
845b42cb6c
commit
583e170706
@ -1059,11 +1059,12 @@ class P4Sync(Command):
|
|||||||
else:
|
else:
|
||||||
paths = []
|
paths = []
|
||||||
for (prev, cur) in zip(self.previousDepotPaths, depotPaths):
|
for (prev, cur) in zip(self.previousDepotPaths, depotPaths):
|
||||||
for i in range(0, max(len(cur), len(prev))):
|
for i in range(0, min(len(cur), len(prev))):
|
||||||
if cur[i] <> prev[i]:
|
if cur[i] <> prev[i]:
|
||||||
|
i = i - 1
|
||||||
break
|
break
|
||||||
|
|
||||||
paths.append (cur[:i])
|
paths.append (cur[:i + 1])
|
||||||
|
|
||||||
self.previousDepotPaths = paths
|
self.previousDepotPaths = paths
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user