git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org
Cc: James Farwell <jfarwell@vmware.com>,
	Lars Schneider <larsxschneider@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	Eric Sunshine <sunshine@sunshineco.com>,
	Luke Diamand <luke@diamand.org>
Subject: [PATCH 2/2] git-p4: fix handling of multiple depot paths
Date: Sun, 13 Dec 2015 20:07:14 +0000	[thread overview]
Message-ID: <1450037234-15344-3-git-send-email-luke@diamand.org> (raw)
In-Reply-To: <1450037234-15344-1-git-send-email-luke@diamand.org>

With multiple depot paths (//depot/pathA, //depot/pathB) if there
are more changes than the changes-block-size limit, then some
of the changes will be skipped. This fixes this by correcting
the loop in p4ChangesForPaths() to reset the "start" point
for each depot.

Suggested-by: James Farwell <jfarwell@vmware.com>
Signed-off-by: Luke Diamand <luke@diamand.org>
---
 git-p4.py               | 8 +++++---
 t/t9818-git-p4-block.sh | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/git-p4.py b/git-p4.py
index 7a9dd6a..a8b5278 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -829,12 +829,14 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):
         # Retrieve changes a block at a time, to prevent running
         # into a MaxResults/MaxScanRows error from the server.
 
+        start = changeStart
+
         while True:
             cmd = ['changes']
 
             if block_size:
-                end = min(changeEnd, changeStart + block_size)
-                revisionRange = "%d,%d" % (changeStart, end)
+                end = min(changeEnd, start + block_size)
+                revisionRange = "%d,%d" % (start, end)
             else:
                 revisionRange = "%s,%s" % (changeStart, changeEnd)
 
@@ -850,7 +852,7 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):
             if end >= changeEnd:
                 break
 
-            changeStart = end + 1
+            start = end + 1
 
     changelist = changes.keys()
     changelist.sort()
diff --git a/t/t9818-git-p4-block.sh b/t/t9818-git-p4-block.sh
index 64510b7..8840a18 100755
--- a/t/t9818-git-p4-block.sh
+++ b/t/t9818-git-p4-block.sh
@@ -128,7 +128,7 @@ test_expect_success 'Create a repo with multiple depot paths' '
 	done
 '
 
-test_expect_failure 'Clone repo with multiple depot paths' '
+test_expect_success 'Clone repo with multiple depot paths' '
 	(
 		cd "$git" &&
 		git p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \
-- 
2.6.2.474.g3eb3291

  parent reply	other threads:[~2015-12-13 20:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-13 20:07 [PATCH 0/2] git-p4: fix for handling of multiple depot paths Luke Diamand
2015-12-13 20:07 ` [PATCH 1/2] git-p4: failing test case for skipping changes with multiple depots Luke Diamand
2015-12-13 20:07 ` Luke Diamand [this message]
2015-12-13 20:19 ` [PATCH 0/2] git-p4: fix for handling of multiple depot paths Luke Diamand
2015-12-14 19:16   ` Junio C Hamano
2015-12-14 20:58     ` Luke Diamand
2015-12-14 22:06       ` Junio C Hamano
2015-12-14 23:09         ` Luke Diamand
2015-12-15 22:56           ` James Farwell
2015-12-16  0:38             ` Sam Hocevar
2015-12-16  7:51               ` Luke Diamand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450037234-15344-3-git-send-email-luke@diamand.org \
    --to=luke@diamand.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jfarwell@vmware.com \
    --cc=larsxschneider@gmail.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).