{"thread":{"id":"48678","subject":"[PATCHv2 0/6] git-p4: some small fixes updated","startedAt":"2018-06-08T20:32:59Z","lastAt":"2018-06-12T22:23:26Z","messageCount":13,"participants":["Luke Diamand","Junio C Hamano","Eric Sunshine"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"349730","messageId":"20180608203248.16311-1-luke@diamand.org","threadId":"48678","inReplyTo":null,"subject":"[PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:42Z","receivedAt":"2018-06-08T20:32:59Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"This is an updated version of the set of changes I posted recently,\nfollowing comments on the list:\n\ndisable automatic sync after git-p4 submit:\n    https://marc.info/?l=git&m=152818734814838&w=2\n\nbetter handling of being logged out by Perforce:\n   https://marc.info/?l=git&m=152818893815326&w=2\n\nadapt the block size automatically on git-p4 submit:\n   https://marc.info/?l=git&m=152819004315688&w=2\n\n- Spelling corrections (Eric)\n- Improved comments (Eric)\n- Exception class hierarchy fix (Merland)\n- test simplification (Eric)\n\n\nLuke Diamand (6):\n  git-p4: disable-rebase: allow setting this via configuration\n  git-p4: add option to disable syncing of p4/master with p4\n  git-p4: better error reporting when p4 fails\n  git-p4: raise exceptions from p4CmdList based on error from p4 server\n  git-p4: narrow the scope of exceptions caught when parsing an int\n  git-p4: auto-size the block\n\n Documentation/git-p4.txt |  13 +++-\n git-p4.py                | 161 +++++++++++++++++++++++++++++++++------\n t/t9818-git-p4-block.sh  |   8 ++\n t/t9833-errors.sh        |  78 +++++++++++++++++++\n 4 files changed, 236 insertions(+), 24 deletions(-)\n create mode 100755 t/t9833-errors.sh\n\n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349732","messageId":"20180608203248.16311-3-luke@diamand.org","threadId":"48678","inReplyTo":"20180608203248.16311-2-luke@diamand.org","subject":"[PATCHv2 2/6] git-p4: add option to disable syncing of p4/master with p4","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:44Z","receivedAt":"2018-06-08T20:33:05Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Add an option to the git-p4 submit command to disable syncing\nwith Perforce.\n\nThis is useful for the case where a git-p4 mirror has been setup\non a server somewhere, running from (e.g.) cron, and developers\nthen clone from this. Having the local cloned copy also sync\nfrom Perforce just isn't useful.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n Documentation/git-p4.txt |  8 ++++++++\n git-p4.py                | 31 ++++++++++++++++++++-----------\n 2 files changed, 28 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex 3d83842e47..f0de3b891b 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -369,6 +369,11 @@ These options can be used to modify 'git p4 submit' behavior.\n     Disable the automatic rebase after all commits have been successfully\n     submitted. Can also be set with git-p4.disableRebase.\n \n+--disable-p4sync::\n+    Disable the automatic sync of p4/master from Perforce after commits have\n+    been submitted. Implies --disable-rebase. Can also be set with\n+    git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.\n+\n Rebase options\n ~~~~~~~~~~~~~~\n These options can be used to modify 'git p4 rebase' behavior.\n@@ -693,6 +698,9 @@ git-p4.conflict::\n git-p4.disableRebase::\n     Do not rebase the tree against p4/master following a submit.\n \n+git-p4.disableP4Sync::\n+    Do not sync p4/master with Perforce following a submit. Implies git-p4.disableRebase.\n+\n IMPLEMENTATION DETAILS\n ----------------------\n * Changesets from p4 are imported using Git fast-import.\ndiff --git a/git-p4.py b/git-p4.py\nindex 5ab9421af8..b61f47cc61 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1368,7 +1368,9 @@ def __init__(self):\n                                      help=\"submit only the specified commit(s), one commit or xxx..xxx\"),\n                 optparse.make_option(\"--disable-rebase\", dest=\"disable_rebase\", action=\"store_true\",\n                                      help=\"Disable rebase after submit is completed. Can be useful if you \"\n-                                     \"work from a local git branch that is not master\")\n+                                     \"work from a local git branch that is not master\"),\n+                optparse.make_option(\"--disable-p4sync\", dest=\"disable_p4sync\", action=\"store_true\",\n+                                     help=\"Skip Perforce sync of p4/master after submit or shelve\"),\n         ]\n         self.description = \"Submit changes from git to the perforce depot.\"\n         self.usage += \" [name of git branch to submit into perforce depot]\"\n@@ -1380,6 +1382,7 @@ def __init__(self):\n         self.update_shelve = list()\n         self.commit = \"\"\n         self.disable_rebase = gitConfigBool(\"git-p4.disableRebase\")\n+        self.disable_p4sync = gitConfigBool(\"git-p4.disableP4Sync\")\n         self.prepare_p4_only = False\n         self.conflict_behavior = None\n         self.isWindows = (platform.system() == \"Windows\")\n@@ -2240,11 +2243,14 @@ def run(self, args):\n             sync = P4Sync()\n             if self.branch:\n                 sync.branch = self.branch\n-            sync.run([])\n+            if self.disable_p4sync:\n+                sync.sync_origin_only()\n+            else:\n+                sync.run([])\n \n-            if self.disable_rebase is False:\n-                rebase = P4Rebase()\n-                rebase.rebase()\n+                if not self.disable_rebase:\n+                    rebase = P4Rebase()\n+                    rebase.rebase()\n \n         else:\n             if len(applied) == 0:\n@@ -3324,6 +3330,14 @@ def importChanges(self, changes, shelved=False, origin_revision=0):\n                 print self.gitError.read()\n                 sys.exit(1)\n \n+    def sync_origin_only(self):\n+        if self.syncWithOrigin:\n+            self.hasOrigin = originP4BranchesExist()\n+            if self.hasOrigin:\n+                if not self.silent:\n+                    print 'Syncing with origin first, using \"git fetch origin\"'\n+                system(\"git fetch origin\")\n+\n     def importHeadRevision(self, revision):\n         print \"Doing initial import of %s from revision %s into %s\" % (' '.join(self.depotPaths), revision, self.branch)\n \n@@ -3402,12 +3416,7 @@ def run(self, args):\n         else:\n             self.refPrefix = \"refs/heads/p4/\"\n \n-        if self.syncWithOrigin:\n-            self.hasOrigin = originP4BranchesExist()\n-            if self.hasOrigin:\n-                if not self.silent:\n-                    print 'Syncing with origin first, using \"git fetch origin\"'\n-                system(\"git fetch origin\")\n+        self.sync_origin_only()\n \n         branch_arg_given = bool(self.branch)\n         if len(self.branch) == 0:\n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349733","messageId":"20180608203248.16311-6-luke@diamand.org","threadId":"48678","inReplyTo":"20180608203248.16311-5-luke@diamand.org","subject":"[PATCHv2 5/6] git-p4: narrow the scope of exceptions caught when parsing an int","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:47Z","receivedAt":"2018-06-08T20:33:07Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"The current code traps all exceptions around some code which parses an\ninteger, and then talks to Perforce.\n\nThat can result in errors from Perforce being ignored. Change the code\nto only catch the integer conversion exceptions.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex f4b5deeb83..5f59feb5bb 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -959,7 +959,7 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):\n         try:\n             (changeStart, changeEnd) = p4ParseNumericChangeRange(parts)\n             block_size = chooseBlockSize(requestedBlockSize)\n-        except:\n+        except ValueError:\n             changeStart = parts[0][1:]\n             changeEnd = parts[1]\n             if requestedBlockSize:\n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349734","messageId":"20180608203248.16311-2-luke@diamand.org","threadId":"48678","inReplyTo":"20180608203248.16311-1-luke@diamand.org","subject":"[PATCHv2 1/6] git-p4: disable-rebase: allow setting this via configuration","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:43Z","receivedAt":"2018-06-08T20:33:11Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"This just lets you set the --disable-rebase option with the\ngit configuration options git-p4.disableRebase. If you're\nusing this option, you probably want to set it all the time\nfor a given repo.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n Documentation/git-p4.txt | 5 ++++-\n git-p4.py                | 2 +-\n 2 files changed, 5 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex e8452528fc..3d83842e47 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -367,7 +367,7 @@ These options can be used to modify 'git p4 submit' behavior.\n \n --disable-rebase::\n     Disable the automatic rebase after all commits have been successfully\n-    submitted.\n+    submitted. Can also be set with git-p4.disableRebase.\n \n Rebase options\n ~~~~~~~~~~~~~~\n@@ -690,6 +690,9 @@ git-p4.conflict::\n \tSpecify submit behavior when a conflict with p4 is found, as per\n \t--conflict.  The default behavior is 'ask'.\n \n+git-p4.disableRebase::\n+    Do not rebase the tree against p4/master following a submit.\n+\n IMPLEMENTATION DETAILS\n ----------------------\n * Changesets from p4 are imported using Git fast-import.\ndiff --git a/git-p4.py b/git-p4.py\nindex c4581d20a6..5ab9421af8 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1379,7 +1379,7 @@ def __init__(self):\n         self.shelve = False\n         self.update_shelve = list()\n         self.commit = \"\"\n-        self.disable_rebase = False\n+        self.disable_rebase = gitConfigBool(\"git-p4.disableRebase\")\n         self.prepare_p4_only = False\n         self.conflict_behavior = None\n         self.isWindows = (platform.system() == \"Windows\")\n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349735","messageId":"20180608203248.16311-4-luke@diamand.org","threadId":"48678","inReplyTo":"20180608203248.16311-3-luke@diamand.org","subject":"[PATCHv2 3/6] git-p4: better error reporting when p4 fails","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:45Z","receivedAt":"2018-06-08T20:33:14Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Currently when p4 fails to run, git-p4 just crashes with an obscure\nerror message.\n\nFor example, if the P4 ticket has expired, you get:\n\n  Error: Cannot locate perforce checkout of <path> in client view\n\nThis change checks whether git-p4 can talk to the Perforce server when\nthe first P4 operation is attempted, and tries to print a meaningful\nerror message if it fails.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py         | 55 +++++++++++++++++++++++++++++++++\n t/t9833-errors.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 133 insertions(+)\n create mode 100755 t/t9833-errors.sh\n\ndiff --git a/git-p4.py b/git-p4.py\nindex b61f47cc61..3de12a4a0a 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -50,6 +50,8 @@ def __str__(self):\n # Grab changes in blocks of this many revisions, unless otherwise requested\n defaultBlockSize = 512\n \n+p4_access_checked = False\n+\n def p4_build_cmd(cmd):\n     \"\"\"Build a suitable p4 command line.\n \n@@ -91,6 +93,13 @@ def p4_build_cmd(cmd):\n         real_cmd = ' '.join(real_cmd) + ' ' + cmd\n     else:\n         real_cmd += cmd\n+\n+    # now check that we can actually talk to the server\n+    global p4_access_checked\n+    if not p4_access_checked:\n+        p4_access_checked = True    # suppress access checks in p4_check_access itself\n+        p4_check_access()\n+\n     return real_cmd\n \n def git_dir(path):\n@@ -264,6 +273,52 @@ def p4_system(cmd):\n     if retcode:\n         raise CalledProcessError(retcode, real_cmd)\n \n+def die_bad_access(s):\n+    die(\"failure accessing depot: {0}\".format(s.rstrip()))\n+\n+def p4_check_access(min_expiration=1):\n+    \"\"\" Check if we can access Perforce - account still logged in\n+    \"\"\"\n+    results = p4CmdList([\"login\", \"-s\"])\n+\n+    if len(results) == 0:\n+        # should never get here: always get either some results, or a p4ExitCode\n+        assert(\"could not parse response from perforce\")\n+\n+    result = results[0]\n+\n+    if 'p4ExitCode' in result:\n+        # p4 returned non-zero status, e.g. P4PORT invalid, or p4 not in path\n+        die_bad_access(\"could not run p4\")\n+\n+    code = result.get(\"code\")\n+    if not code:\n+        # we get here if we couldn't connect and there was nothing to unmarshal\n+        die_bad_access(\"could not connect\")\n+\n+    elif code == \"stat\":\n+        expiry = result.get(\"TicketExpiration\")\n+        if expiry:\n+            expiry = int(expiry)\n+            if expiry > min_expiration:\n+                # ok to carry on\n+                return\n+            else:\n+                die_bad_access(\"perforce ticket expires in {0} seconds\".format(expiry))\n+\n+        else:\n+            # account without a timeout - all ok\n+            return\n+\n+    elif code == \"error\":\n+        data = result.get(\"data\")\n+        if data:\n+            die_bad_access(\"p4 error: {0}\".format(data))\n+        else:\n+            die_bad_access(\"unknown error\")\n+    else:\n+        die_bad_access(\"unknown error code {0}\".format(code))\n+\n _p4_version_string = None\n def p4_version_string():\n     \"\"\"Read the version string, showing just the last line, which\ndiff --git a/t/t9833-errors.sh b/t/t9833-errors.sh\nnew file mode 100755\nindex 0000000000..9ba892de7a\n--- /dev/null\n+++ b/t/t9833-errors.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+\n+test_description='git p4 errors'\n+\n+. ./lib-git-p4.sh\n+\n+test_expect_success 'start p4d' '\n+\tstart_p4d\n+'\n+\n+test_expect_success 'add p4 files' '\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\techo file1 >file1 &&\n+\t\tp4 add file1 &&\n+\t\tp4 submit -d \"file1\"\n+\t)\n+'\n+\n+# after this test, the default user requires a password\n+test_expect_success 'error handling' '\n+\tgit p4 clone --dest=\"$git\" //depot@all &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tP4PORT=: test_must_fail git p4 submit 2>errmsg\n+\t) &&\n+\tp4 passwd -P newpassword &&\n+\t(\n+\t\tP4PASSWD=badpassword test_must_fail git p4 clone //depot/foo 2>errmsg &&\n+\t\tgrep -q \"failure accessing depot.*P4PASSWD\" errmsg\n+\t)\n+'\n+\n+test_expect_success 'ticket logged out' '\n+\tP4TICKETS=\"$cli/tickets\" &&\n+\techo \"newpassword\" | p4 login &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest_commit \"ticket-auth-check\" &&\n+\t\tp4 logout &&\n+\t\ttest_must_fail git p4 submit 2>errmsg &&\n+\t\tgrep -q \"failure accessing depot\" errmsg\n+\t)\n+'\n+\n+test_expect_success 'create group with short ticket expiry' '\n+\tP4TICKETS=\"$cli/tickets\" &&\n+\techo \"newpassword\" | p4 login &&\n+\tp4_add_user short_expiry_user &&\n+\tp4 -u short_expiry_user passwd -P password &&\n+\tp4 group -i <<-EOF &&\n+\tGroup: testgroup\n+\tTimeout: 3\n+\tUsers: short_expiry_user\n+\tEOF\n+\n+\tp4 users | grep short_expiry_user\n+'\n+\n+test_expect_success 'git operation with expired ticket' '\n+\tP4TICKETS=\"$cli/tickets\" &&\n+\tP4USER=short_expiry_user &&\n+\techo \"password\" | p4 login &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit p4 sync &&\n+\t\tsleep 5 &&\n+\t\ttest_must_fail git p4 sync 2>errmsg &&\n+\t\tgrep \"failure accessing depot\" errmsg\n+\t)\n+'\n+\n+test_expect_success 'kill p4d' '\n+\tkill_p4d\n+'\n+\n+\n+test_done\n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349736","messageId":"20180608203248.16311-5-luke@diamand.org","threadId":"48678","inReplyTo":"20180608203248.16311-4-luke@diamand.org","subject":"[PATCHv2 4/6] git-p4: raise exceptions from p4CmdList based on error from p4 server","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:46Z","receivedAt":"2018-06-08T20:33:15Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"This change lays some groundwork for better handling of rowcount errors\nfrom the server, where it fails to send us results because we requested\ntoo many.\n\nIt adds an option to p4CmdList() to return errors as a Python exception.\n\nThe exceptions are derived from P4Exception (something went wrong),\nP4ServerException (the server sent us an error code) and\nP4RequestSizeException (we requested too many rows/results from the\nserver database).\n\nThis makes the code that handles the errors a bit easier.\n\nThe default behavior is unchanged; the new code is enabled with a flag.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py | 44 ++++++++++++++++++++++++++++++++++++++++----\n 1 file changed, 40 insertions(+), 4 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 3de12a4a0a..f4b5deeb83 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -566,10 +566,30 @@ def isModeExec(mode):\n     # otherwise False.\n     return mode[-3:] == \"755\"\n \n+class P4Exception(Exception):\n+    \"\"\" Base class for exceptions from the p4 client \"\"\"\n+    def __init__(self, exit_code):\n+        self.p4ExitCode = exit_code\n+\n+class P4ServerException(P4Exception):\n+    \"\"\" Base class for exceptions where we get some kind of marshalled up result from the server \"\"\"\n+    def __init__(self, exit_code, p4_result):\n+        super(P4ServerException, self).__init__(exit_code)\n+        self.p4_result = p4_result\n+        self.code = p4_result[0]['code']\n+        self.data = p4_result[0]['data']\n+\n+class P4RequestSizeException(P4ServerException):\n+    \"\"\" One of the maxresults or maxscanrows errors \"\"\"\n+    def __init__(self, exit_code, p4_result, limit):\n+        super(P4RequestSizeException, self).__init__(exit_code, p4_result)\n+        self.limit = limit\n+\n def isModeExecChanged(src_mode, dst_mode):\n     return isModeExec(src_mode) != isModeExec(dst_mode)\n \n-def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False):\n+def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False,\n+        errors_as_exceptions=False):\n \n     if isinstance(cmd,basestring):\n         cmd = \"-G \" + cmd\n@@ -616,9 +636,25 @@ def p4CmdList(cmd, stdin=None, stdin_mode='w+b', cb=None, skip_info=False):\n         pass\n     exitCode = p4.wait()\n     if exitCode != 0:\n-        entry = {}\n-        entry[\"p4ExitCode\"] = exitCode\n-        result.append(entry)\n+        if errors_as_exceptions:\n+            if len(result) > 0:\n+                data = result[0].get('data')\n+                if data:\n+                    m = re.search('Too many rows scanned \\(over (\\d+)\\)', data)\n+                    if not m:\n+                        m = re.search('Request too large \\(over (\\d+)\\)', data)\n+\n+                    if m:\n+                        limit = int(m.group(1))\n+                        raise P4RequestSizeException(exitCode, result, limit)\n+\n+                raise P4ServerException(exitCode, result)\n+            else:\n+                raise P4Exception(exitCode)\n+        else:\n+            entry = {}\n+            entry[\"p4ExitCode\"] = exitCode\n+            result.append(entry)\n \n     return result\n \n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349737","messageId":"20180608203248.16311-7-luke@diamand.org","threadId":"48678","inReplyTo":"20180608203248.16311-6-luke@diamand.org","subject":"[PATCHv2 6/6] git-p4: auto-size the block","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-08T20:32:48Z","receivedAt":"2018-06-08T20:33:18Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"git-p4 originally would fetch changes in one query. On large repos this\ncould fail because of the limits that Perforce imposes on the number of\nitems returned and the number of queries in the database.\n\nTo fix this, git-p4 learned to query changes in blocks of 512 changes,\nHowever, this can be very slow - if you have a few million changes,\nwith each chunk taking about a second, it can be an hour or so.\n\nAlthough it's possible to tune this value manually with the\n\"--changes-block-size\" option, it's far from obvious to ordinary users\nthat this is what needs doing.\n\nThis change alters the block size dynamically by looking for the\nspecific error messages returned from the Perforce server, and reducing\nthe block size if the error is seen, either to the limit reported by the\nserver, or to half the current block size.\n\nThat means we can start out with a very large block size, and then let\nit automatically drop down to a value that works without error, while\nstill failing correctly if some other error occurs.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py               | 27 +++++++++++++++++++++------\n t/t9818-git-p4-block.sh |  8 ++++++++\n 2 files changed, 29 insertions(+), 6 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 5f59feb5bb..0354d4df5c 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -47,8 +47,8 @@ def __str__(self):\n # Only labels/tags matching this will be imported/exported\n defaultLabelRegexp = r'[a-zA-Z0-9_\\-.]+$'\n \n-# Grab changes in blocks of this many revisions, unless otherwise requested\n-defaultBlockSize = 512\n+# The block size is reduced automatically if required\n+defaultBlockSize = 1<<20\n \n p4_access_checked = False\n \n@@ -969,7 +969,8 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):\n     changes = set()\n \n     # Retrieve changes a block at a time, to prevent running\n-    # into a MaxResults/MaxScanRows error from the server.\n+    # into a MaxResults/MaxScanRows error from the server. If\n+    # we _do_ hit one of those errors, turn down the block size\n \n     while True:\n         cmd = ['changes']\n@@ -983,10 +984,24 @@ def p4ChangesForPaths(depotPaths, changeRange, requestedBlockSize):\n         for p in depotPaths:\n             cmd += [\"%s...@%s\" % (p, revisionRange)]\n \n+        # fetch the changes\n+        try:\n+            result = p4CmdList(cmd, errors_as_exceptions=True)\n+        except P4RequestSizeException as e:\n+            if not block_size:\n+                block_size = e.limit\n+            elif block_size > e.limit:\n+                block_size = e.limit\n+            else:\n+                block_size = max(2, block_size // 2)\n+\n+            if verbose: print(\"block size error, retrying with block size {0}\".format(block_size))\n+            continue\n+        except P4Exception as e:\n+            die('Error retrieving changes description ({0})'.format(e.p4ExitCode))\n+\n         # Insert changes in chronological order\n-        for entry in reversed(p4CmdList(cmd)):\n-            if entry.has_key('p4ExitCode'):\n-                die('Error retrieving changes descriptions ({})'.format(entry['p4ExitCode']))\n+        for entry in reversed(result):\n             if not entry.has_key('change'):\n                 continue\n             changes.add(int(entry['change']))\ndiff --git a/t/t9818-git-p4-block.sh b/t/t9818-git-p4-block.sh\nindex 8840a183ac..ce7cb22ad3 100755\n--- a/t/t9818-git-p4-block.sh\n+++ b/t/t9818-git-p4-block.sh\n@@ -129,6 +129,7 @@ test_expect_success 'Create a repo with multiple depot paths' '\n '\n \n test_expect_success 'Clone repo with multiple depot paths' '\n+\ttest_when_finished cleanup_git &&\n \t(\n \t\tcd \"$git\" &&\n \t\tgit p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \\\n@@ -138,6 +139,13 @@ test_expect_success 'Clone repo with multiple depot paths' '\n \t)\n '\n \n+test_expect_success 'Clone repo with self-sizing block size' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --changes-block-size=1000000 //depot@all --destination=\"$git\" &&\n+\tgit -C \"$git\" log --oneline >log &&\n+\ttest_line_count \\> 10 log\n+'\n+\n test_expect_success 'kill p4d' '\n \tkill_p4d\n '\n-- \n2.17.0.392.gdeb1a6e9b7\n\n"},{"id":"349991","messageId":"xmqqo9gg9bi3.fsf@gitster-ct.c.googlers.com","threadId":"48678","inReplyTo":"20180608203248.16311-1-luke@diamand.org","subject":"Re: [PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-06-12T17:10:28Z","receivedAt":"2018-06-12T17:10:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Luke Diamand <luke@diamand.org> writes:\n\n> This is an updated version of the set of changes I posted recently,\n> following comments on the list:\n>\n> disable automatic sync after git-p4 submit:\n>     https://marc.info/?l=git&m=152818734814838&w=2\n>\n> better handling of being logged out by Perforce:\n>    https://marc.info/?l=git&m=152818893815326&w=2\n>\n> adapt the block size automatically on git-p4 submit:\n>    https://marc.info/?l=git&m=152819004315688&w=2\n>\n> - Spelling corrections (Eric)\n> - Improved comments (Eric)\n> - Exception class hierarchy fix (Merland)\n> - test simplification (Eric)\n>\n\nThat reminds me of one thing.  \n\nThis 6-patch series depends on the rm/p4-submit-with-commit-option\nthat came without and still waiting for a sign-off by the original\nauthor.  Also I do not think the original patch reached the public\nlist, so I'm attaching the patch to make sure people know which\npatch I am talking about.\n\nRomain, can we get your sign-off on the patch you sent earlier?\n\nThanks.\n\n-- >8 --\nFrom: Romain Merland <merlorom@yahoo.fr>\nDate: Wed, 9 May 2018 17:32:12 +0200\nSubject: [PATCH] git-p4: add options --commit and --disable-rebase\n\nOn a daily work with multiple local git branches, the usual way to\nsubmit only a specified commit was to cherry-pick the commit on\nmaster then run git-p4 submit.  It can be very annoying to switch\nbetween local branches and master, only to submit one commit.  The\nproposed new way is to select directly the commit you want to\nsubmit.\n\nAdd option --commit to command 'git-p4 submit' in order to submit\nonly specified commit(s) in p4.\n\nOn a daily work developping software with big compilation time, one\nmay not want to rebase on his local git tree, in order to avoid long\nrecompilation.\n\nAdd option --disable-rebase to command 'git-p4 submit' in order to\ndisable rebase after submission.\n\nReviewed-by: Luke Diamand <luke@diamand.org>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-p4.txt | 14 ++++++++++++++\n git-p4.py                | 29 +++++++++++++++++++++++------\n t/t9807-git-p4-submit.sh | 40 ++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 77 insertions(+), 6 deletions(-)\n\ndiff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\nindex d8c8f11c9f..88d109debb 100644\n--- a/Documentation/git-p4.txt\n+++ b/Documentation/git-p4.txt\n@@ -149,6 +149,12 @@ To specify a branch other than the current one, use:\n $ git p4 submit topicbranch\n ------------\n \n+To specify a single commit or a range of commits, use:\n+------------\n+$ git p4 submit --commit <sha1>\n+$ git p4 submit --commit <sha1..sha1>\n+------------\n+\n The upstream reference is generally 'refs/remotes/p4/master', but can\n be overridden using the `--origin=` command-line option.\n \n@@ -330,6 +336,14 @@ These options can be used to modify 'git p4 submit' behavior.\n \tp4/master.  See the \"Sync options\" section above for more\n \tinformation.\n \n+--commit <sha1>|<sha1..sha1>::\n+    Submit only the specified commit or range of commits, instead of the full\n+    list of changes that are in the current Git branch.\n+\n+--disable-rebase::\n+    Disable the automatic rebase after all commits have been successfully\n+    submitted.\n+\n Rebase options\n ~~~~~~~~~~~~~~\n These options can be used to modify 'git p4 rebase' behavior.\ndiff --git a/git-p4.py b/git-p4.py\nindex 7bb9cadc69..f4a6f3b4c3 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1352,7 +1352,12 @@ def __init__(self):\n                 optparse.make_option(\"--update-shelve\", dest=\"update_shelve\", action=\"append\", type=\"int\",\n                                      metavar=\"CHANGELIST\",\n                                      help=\"update an existing shelved changelist, implies --shelve, \"\n-                                           \"repeat in-order for multiple shelved changelists\")\n+                                           \"repeat in-order for multiple shelved changelists\"),\n+                optparse.make_option(\"--commit\", dest=\"commit\", metavar=\"COMMIT\",\n+                                     help=\"submit only the specified commit(s), one commit or xxx..xxx\"),\n+                optparse.make_option(\"--disable-rebase\", dest=\"disable_rebase\", action=\"store_true\",\n+                                     help=\"Disable rebase after submit is completed. Can be useful if you \"\n+                                     \"work from a local git branch that is not master\")\n         ]\n         self.description = \"Submit changes from git to the perforce depot.\"\n         self.usage += \" [name of git branch to submit into perforce depot]\"\n@@ -1362,6 +1367,8 @@ def __init__(self):\n         self.dry_run = False\n         self.shelve = False\n         self.update_shelve = list()\n+        self.commit = \"\"\n+        self.disable_rebase = False\n         self.prepare_p4_only = False\n         self.conflict_behavior = None\n         self.isWindows = (platform.system() == \"Windows\")\n@@ -2103,9 +2110,18 @@ def run(self, args):\n         else:\n             commitish = 'HEAD'\n \n-        for line in read_pipe_lines([\"git\", \"rev-list\", \"--no-merges\", \"%s..%s\" % (self.origin, commitish)]):\n-            commits.append(line.strip())\n-        commits.reverse()\n+        if self.commit != \"\":\n+            if self.commit.find(\"..\") != -1:\n+                limits_ish = self.commit.split(\"..\")\n+                for line in read_pipe_lines([\"git\", \"rev-list\", \"--no-merges\", \"%s..%s\" % (limits_ish[0], limits_ish[1])]):\n+                    commits.append(line.strip())\n+                commits.reverse()\n+            else:\n+                commits.append(self.commit)\n+        else:\n+            for line in read_pipe_lines([\"git\", \"rev-list\", \"--no-merges\", \"%s..%s\" % (self.origin, commitish)]):\n+                commits.append(line.strip())\n+            commits.reverse()\n \n         if self.preserveUser or gitConfigBool(\"git-p4.skipUserNameCheck\"):\n             self.checkAuthorship = False\n@@ -2215,8 +2231,9 @@ def run(self, args):\n                 sync.branch = self.branch\n             sync.run([])\n \n-            rebase = P4Rebase()\n-            rebase.rebase()\n+            if self.disable_rebase is False:\n+                rebase = P4Rebase()\n+                rebase.rebase()\n \n         else:\n             if len(applied) == 0:\ndiff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh\nindex 71cae2874d..2325599ee6 100755\n--- a/t/t9807-git-p4-submit.sh\n+++ b/t/t9807-git-p4-submit.sh\n@@ -155,6 +155,46 @@ test_expect_success 'allow submit from branch with same revision but different n\n \t)\n '\n \n+# make two commits, but tell it to apply only one\n+\n+test_expect_success 'submit --commit one' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest_commit \"file9\" &&\n+\t\ttest_commit \"file10\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --commit HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\ttest_path_is_missing \"file9.t\" &&\n+\t\ttest_path_is_file \"file10.t\"\n+\t)\n+'\n+\n+# make three commits, but tell it to apply only range\n+\n+test_expect_success 'submit --commit range' '\n+\ttest_when_finished cleanup_git &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\ttest_commit \"file11\" &&\n+\t\ttest_commit \"file12\" &&\n+\t\ttest_commit \"file13\" &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tgit p4 submit --commit HEAD~2..HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\ttest_path_is_missing \"file11.t\" &&\n+\t\ttest_path_is_file \"file12.t\" &&\n+\t\ttest_path_is_file \"file13.t\"\n+\t)\n+'\n+\n #\n # Basic submit tests, the five handled cases\n #\n-- \n2.18.0-rc1-1-g6f333ff2fb\n\n"},{"id":"350023","messageId":"CAE5ih7_ZDzg9h8BEGDWyg_jBG1rj=_eW1Kg7JO7oKiF6Q2+37w@mail.gmail.com","threadId":"48678","inReplyTo":"xmqqo9gg9bi3.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-12T21:24:38Z","receivedAt":"2018-06-12T21:24:43Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On 12 June 2018 at 18:10, Junio C Hamano <gitster@pobox.com> wrote:\n> Luke Diamand <luke@diamand.org> writes:\n>\n>> This is an updated version of the set of changes I posted recently,\n>> following comments on the list:\n>>\n>> disable automatic sync after git-p4 submit:\n>>     https://marc.info/?l=git&m=152818734814838&w=2\n>>\n>> better handling of being logged out by Perforce:\n>>    https://marc.info/?l=git&m=152818893815326&w=2\n>>\n>> adapt the block size automatically on git-p4 submit:\n>>    https://marc.info/?l=git&m=152819004315688&w=2\n>>\n>> - Spelling corrections (Eric)\n>> - Improved comments (Eric)\n>> - Exception class hierarchy fix (Merland)\n>> - test simplification (Eric)\n>>\n>\n> That reminds me of one thing.\n>\n> This 6-patch series depends on the rm/p4-submit-with-commit-option\n> that came without and still waiting for a sign-off by the original\n> author.  Also I do not think the original patch reached the public\n> list, so I'm attaching the patch to make sure people know which\n> patch I am talking about.\n>\n> Romain, can we get your sign-off on the patch you sent earlier?\n\nWasn't it already sent in this message:\n\nhttps://marc.info/?l=git&m=152783923418317&w=2\n\nLuke\n\n\n>\n> Thanks.\n>\n> -- >8 --\n> From: Romain Merland <merlorom@yahoo.fr>\n> Date: Wed, 9 May 2018 17:32:12 +0200\n> Subject: [PATCH] git-p4: add options --commit and --disable-rebase\n>\n> On a daily work with multiple local git branches, the usual way to\n> submit only a specified commit was to cherry-pick the commit on\n> master then run git-p4 submit.  It can be very annoying to switch\n> between local branches and master, only to submit one commit.  The\n> proposed new way is to select directly the commit you want to\n> submit.\n>\n> Add option --commit to command 'git-p4 submit' in order to submit\n> only specified commit(s) in p4.\n>\n> On a daily work developping software with big compilation time, one\n> may not want to rebase on his local git tree, in order to avoid long\n> recompilation.\n>\n> Add option --disable-rebase to command 'git-p4 submit' in order to\n> disable rebase after submission.\n>\n> Reviewed-by: Luke Diamand <luke@diamand.org>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  Documentation/git-p4.txt | 14 ++++++++++++++\n>  git-p4.py                | 29 +++++++++++++++++++++++------\n>  t/t9807-git-p4-submit.sh | 40 ++++++++++++++++++++++++++++++++++++++++\n>  3 files changed, 77 insertions(+), 6 deletions(-)\n>\n> diff --git a/Documentation/git-p4.txt b/Documentation/git-p4.txt\n> index d8c8f11c9f..88d109debb 100644\n> --- a/Documentation/git-p4.txt\n> +++ b/Documentation/git-p4.txt\n> @@ -149,6 +149,12 @@ To specify a branch other than the current one, use:\n>  $ git p4 submit topicbranch\n>  ------------\n>\n> +To specify a single commit or a range of commits, use:\n> +------------\n> +$ git p4 submit --commit <sha1>\n> +$ git p4 submit --commit <sha1..sha1>\n> +------------\n> +\n>  The upstream reference is generally 'refs/remotes/p4/master', but can\n>  be overridden using the `--origin=` command-line option.\n>\n> @@ -330,6 +336,14 @@ These options can be used to modify 'git p4 submit' behavior.\n>         p4/master.  See the \"Sync options\" section above for more\n>         information.\n>\n> +--commit <sha1>|<sha1..sha1>::\n> +    Submit only the specified commit or range of commits, instead of the full\n> +    list of changes that are in the current Git branch.\n> +\n> +--disable-rebase::\n> +    Disable the automatic rebase after all commits have been successfully\n> +    submitted.\n> +\n>  Rebase options\n>  ~~~~~~~~~~~~~~\n>  These options can be used to modify 'git p4 rebase' behavior.\n> diff --git a/git-p4.py b/git-p4.py\n> index 7bb9cadc69..f4a6f3b4c3 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -1352,7 +1352,12 @@ def __init__(self):\n>                  optparse.make_option(\"--update-shelve\", dest=\"update_shelve\", action=\"append\", type=\"int\",\n>                                       metavar=\"CHANGELIST\",\n>                                       help=\"update an existing shelved changelist, implies --shelve, \"\n> -                                           \"repeat in-order for multiple shelved changelists\")\n> +                                           \"repeat in-order for multiple shelved changelists\"),\n> +                optparse.make_option(\"--commit\", dest=\"commit\", metavar=\"COMMIT\",\n> +                                     help=\"submit only the specified commit(s), one commit or xxx..xxx\"),\n> +                optparse.make_option(\"--disable-rebase\", dest=\"disable_rebase\", action=\"store_true\",\n> +                                     help=\"Disable rebase after submit is completed. Can be useful if you \"\n> +                                     \"work from a local git branch that is not master\")\n>          ]\n>          self.description = \"Submit changes from git to the perforce depot.\"\n>          self.usage += \" [name of git branch to submit into perforce depot]\"\n> @@ -1362,6 +1367,8 @@ def __init__(self):\n>          self.dry_run = False\n>          self.shelve = False\n>          self.update_shelve = list()\n> +        self.commit = \"\"\n> +        self.disable_rebase = False\n>          self.prepare_p4_only = False\n>          self.conflict_behavior = None\n>          self.isWindows = (platform.system() == \"Windows\")\n> @@ -2103,9 +2110,18 @@ def run(self, args):\n>          else:\n>              commitish = 'HEAD'\n>\n> -        for line in read_pipe_lines([\"git\", \"rev-list\", \"--no-merges\", \"%s..%s\" % (self.origin, commitish)]):\n> -            commits.append(line.strip())\n> -        commits.reverse()\n> +        if self.commit != \"\":\n> +            if self.commit.find(\"..\") != -1:\n> +                limits_ish = self.commit.split(\"..\")\n> +                for line in read_pipe_lines([\"git\", \"rev-list\", \"--no-merges\", \"%s..%s\" % (limits_ish[0], limits_ish[1])]):\n> +                    commits.append(line.strip())\n> +                commits.reverse()\n> +            else:\n> +                commits.append(self.commit)\n> +        else:\n> +            for line in read_pipe_lines([\"git\", \"rev-list\", \"--no-merges\", \"%s..%s\" % (self.origin, commitish)]):\n> +                commits.append(line.strip())\n> +            commits.reverse()\n>\n>          if self.preserveUser or gitConfigBool(\"git-p4.skipUserNameCheck\"):\n>              self.checkAuthorship = False\n> @@ -2215,8 +2231,9 @@ def run(self, args):\n>                  sync.branch = self.branch\n>              sync.run([])\n>\n> -            rebase = P4Rebase()\n> -            rebase.rebase()\n> +            if self.disable_rebase is False:\n> +                rebase = P4Rebase()\n> +                rebase.rebase()\n>\n>          else:\n>              if len(applied) == 0:\n> diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh\n> index 71cae2874d..2325599ee6 100755\n> --- a/t/t9807-git-p4-submit.sh\n> +++ b/t/t9807-git-p4-submit.sh\n> @@ -155,6 +155,46 @@ test_expect_success 'allow submit from branch with same revision but different n\n>         )\n>  '\n>\n> +# make two commits, but tell it to apply only one\n> +\n> +test_expect_success 'submit --commit one' '\n> +       test_when_finished cleanup_git &&\n> +       git p4 clone --dest=\"$git\" //depot &&\n> +       (\n> +               cd \"$git\" &&\n> +               test_commit \"file9\" &&\n> +               test_commit \"file10\" &&\n> +               git config git-p4.skipSubmitEdit true &&\n> +               git p4 submit --commit HEAD\n> +       ) &&\n> +       (\n> +               cd \"$cli\" &&\n> +               test_path_is_missing \"file9.t\" &&\n> +               test_path_is_file \"file10.t\"\n> +       )\n> +'\n> +\n> +# make three commits, but tell it to apply only range\n> +\n> +test_expect_success 'submit --commit range' '\n> +       test_when_finished cleanup_git &&\n> +       git p4 clone --dest=\"$git\" //depot &&\n> +       (\n> +               cd \"$git\" &&\n> +               test_commit \"file11\" &&\n> +               test_commit \"file12\" &&\n> +               test_commit \"file13\" &&\n> +               git config git-p4.skipSubmitEdit true &&\n> +               git p4 submit --commit HEAD~2..HEAD\n> +       ) &&\n> +       (\n> +               cd \"$cli\" &&\n> +               test_path_is_missing \"file11.t\" &&\n> +               test_path_is_file \"file12.t\" &&\n> +               test_path_is_file \"file13.t\"\n> +       )\n> +'\n> +\n>  #\n>  # Basic submit tests, the five handled cases\n>  #\n> --\n> 2.18.0-rc1-1-g6f333ff2fb\n>\n"},{"id":"350025","messageId":"xmqq7en38z8o.fsf@gitster-ct.c.googlers.com","threadId":"48678","inReplyTo":"CAE5ih7_ZDzg9h8BEGDWyg_jBG1rj=_eW1Kg7JO7oKiF6Q2+37w@mail.gmail.com","subject":"Re: [PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-06-12T21:35:19Z","receivedAt":"2018-06-12T21:35:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Luke Diamand <luke@diamand.org> writes:\n\n> On 12 June 2018 at 18:10, Junio C Hamano <gitster@pobox.com> wrote:\n>> Luke Diamand <luke@diamand.org> writes:\n>>\n>>> This is an updated version of the set of changes I posted recently,\n>>> following comments on the list:\n>>>\n>>> disable automatic sync after git-p4 submit:\n>>>     https://marc.info/?l=git&m=152818734814838&w=2\n>>>\n>>> better handling of being logged out by Perforce:\n>>>    https://marc.info/?l=git&m=152818893815326&w=2\n>>>\n>>> adapt the block size automatically on git-p4 submit:\n>>>    https://marc.info/?l=git&m=152819004315688&w=2\n>>>\n>>> - Spelling corrections (Eric)\n>>> - Improved comments (Eric)\n>>> - Exception class hierarchy fix (Merland)\n>>> - test simplification (Eric)\n>>>\n>>\n>> That reminds me of one thing.\n>>\n>> This 6-patch series depends on the rm/p4-submit-with-commit-option\n>> that came without and still waiting for a sign-off by the original\n>> author.  Also I do not think the original patch reached the public\n>> list, so I'm attaching the patch to make sure people know which\n>> patch I am talking about.\n>>\n>> Romain, can we get your sign-off on the patch you sent earlier?\n>\n> Wasn't it already sent in this message:\n>\n> https://marc.info/?l=git&m=152783923418317&w=2\n>\n> Luke\n\n\nThanks for a pointer.  Will replace and requeue.\n\n"},{"id":"350027","messageId":"CAE5ih79NoTpbkU50tts2GgLJ7Wy9WyBUgJncm3KXPLxuy0P0hQ@mail.gmail.com","threadId":"48678","inReplyTo":"xmqq7en38z8o.fsf@gitster-ct.c.googlers.com","subject":"Re: [PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-12T21:49:13Z","receivedAt":"2018-06-12T21:49:17Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On 12 June 2018 at 22:35, Junio C Hamano <gitster@pobox.com> wrote:\n> Luke Diamand <luke@diamand.org> writes:\n>\n>> On 12 June 2018 at 18:10, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Luke Diamand <luke@diamand.org> writes:\n>>>\n>>>> This is an updated version of the set of changes I posted recently,\n>>>> following comments on the list:\n>>>>\n>>>> disable automatic sync after git-p4 submit:\n>>>>     https://marc.info/?l=git&m=152818734814838&w=2\n>>>>\n>>>> better handling of being logged out by Perforce:\n>>>>    https://marc.info/?l=git&m=152818893815326&w=2\n>>>>\n>>>> adapt the block size automatically on git-p4 submit:\n>>>>    https://marc.info/?l=git&m=152819004315688&w=2\n>>>>\n>>>> - Spelling corrections (Eric)\n>>>> - Improved comments (Eric)\n>>>> - Exception class hierarchy fix (Merland)\n>>>> - test simplification (Eric)\n>>>>\n>>>\n>>> That reminds me of one thing.\n>>>\n>>> This 6-patch series depends on the rm/p4-submit-with-commit-option\n>>> that came without and still waiting for a sign-off by the original\n>>> author.  Also I do not think the original patch reached the public\n>>> list, so I'm attaching the patch to make sure people know which\n>>> patch I am talking about.\n>>>\n>>> Romain, can we get your sign-off on the patch you sent earlier?\n>>\n>> Wasn't it already sent in this message:\n>>\n>> https://marc.info/?l=git&m=152783923418317&w=2\n>>\n>> Luke\n>\n>\n> Thanks for a pointer.  Will replace and requeue.\n\nThanks. While on the subject of git-p4, I thought I should mention\nthat I've been looking at getting git-p4 to work with Python3.\n\nI've got some low risk easy (mostly automated) changes which get it to\nthe point where it compiles. After that I have to figure out how to\nfix the byte-vs-string unicode problem that Python3 brings. Having\nbeen playing around with it, I think it should be possible to make the\nsame git-p4.py script work with 2.7, 3.6 and probably 2.6, although\nI'm still some way from making this last bit work.\n\nLuke\n"},{"id":"350028","messageId":"CAPig+cQg5XE7peXDC-q0mkB9y6boK_iiM_55O6Po2PVmyZNLww@mail.gmail.com","threadId":"48678","inReplyTo":"CAE5ih79NoTpbkU50tts2GgLJ7Wy9WyBUgJncm3KXPLxuy0P0hQ@mail.gmail.com","subject":"Re: [PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-06-12T21:53:59Z","receivedAt":"2018-06-12T21:54:03Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jun 12, 2018 at 5:49 PM, Luke Diamand <luke@diamand.org> wrote:\n> Thanks. While on the subject of git-p4, I thought I should mention\n> that I've been looking at getting git-p4 to work with Python3.\n>\n> I've got some low risk easy (mostly automated) changes which get it to\n> the point where it compiles. After that I have to figure out how to\n> fix the byte-vs-string unicode problem that Python3 brings. [...]\n\nSee how reposurgeon handles the problem[1]. It defines polystr() and\npolybytes() functions which coerce strings and byte sequences as\nneeded. It's not pretty, but it works.\n\n[1]: https://gitlab.com/esr/reposurgeon/blob/master/reposurgeon#L100\n"},{"id":"350029","messageId":"CAE5ih7-3_jUFNpodvv4szZ75hbgZwvrR1DsmnZqWBus=__37sA@mail.gmail.com","threadId":"48678","inReplyTo":"CAPig+cQg5XE7peXDC-q0mkB9y6boK_iiM_55O6Po2PVmyZNLww@mail.gmail.com","subject":"Re: [PATCHv2 0/6] git-p4: some small fixes updated","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2018-06-12T22:23:22Z","receivedAt":"2018-06-12T22:23:26Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On 12 June 2018 at 22:53, Eric Sunshine <sunshine@sunshineco.com> wrote:\n> On Tue, Jun 12, 2018 at 5:49 PM, Luke Diamand <luke@diamand.org> wrote:\n>> Thanks. While on the subject of git-p4, I thought I should mention\n>> that I've been looking at getting git-p4 to work with Python3.\n>>\n>> I've got some low risk easy (mostly automated) changes which get it to\n>> the point where it compiles. After that I have to figure out how to\n>> fix the byte-vs-string unicode problem that Python3 brings. [...]\n>\n> See how reposurgeon handles the problem[1]. It defines polystr() and\n> polybytes() functions which coerce strings and byte sequences as\n> needed. It's not pretty, but it works.\n>\n> [1]: https://gitlab.com/esr/reposurgeon/blob/master/reposurgeon#L100\n\nThanks, that's got some useful tips!\n"}]}