{"thread":{"id":"50258","subject":"[PATCHv3 0/2] git-p4: shelved change update with move/copy","startedAt":"2019-01-18T09:37:07Z","lastAt":"2019-01-22T18:16:06Z","messageCount":5,"participants":["Luke Diamand","Junio C Hamano","Mazo, Andrey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"367067","messageId":"20190118093656.16521-1-luke@diamand.org","threadId":"50258","inReplyTo":null,"subject":"[PATCHv3 0/2] git-p4: shelved change update with move/copy","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2019-01-18T09:36:54Z","receivedAt":"2019-01-18T09:37:07Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"This updates the patchset to support copy, as suggested by Andrey.\n\nLuke Diamand (2):\n  git-p4: add failing test for shelved CL update involving move/copy\n  git-p4: handle update of moved/copied files when updating a shelve\n\n git-p4.py                |  2 ++\n t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++---\n 2 files changed, 56 insertions(+), 3 deletions(-)\n\n-- \n2.20.1.100.g9ee79a14a8\n\n"},{"id":"367068","messageId":"20190118093656.16521-2-luke@diamand.org","threadId":"50258","inReplyTo":"20190118093656.16521-1-luke@diamand.org","subject":"[PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2019-01-18T09:36:55Z","receivedAt":"2019-01-18T09:37:08Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Updating a shelved P4 changelist where one or more files have\nbeen moved or copied does not work. Add a test for this.\n\nThe problem is that P4 requires a complete list of the files being\nchanged, and move/copy only includes the _source_ in the case of\nupdating a shelved changelist. This results in errors from Perforce\nsuch as:\n\n  //depot/src - needs tofile //depot/dst\n  Submit aborted -- fix problems then use 'p4 submit -c 1234'\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\nAcked-by: Andrey Mazo <amazo@checkvideo.com>\n---\n t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++---\n 1 file changed, 54 insertions(+), 3 deletions(-)\n\ndiff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh\nindex 2325599ee6..2ad3d801cc 100755\n--- a/t/t9807-git-p4-submit.sh\n+++ b/t/t9807-git-p4-submit.sh\n@@ -500,6 +500,10 @@ test_expect_success 'submit --shelve' '\n \t)\n '\n \n+last_shelve() {\n+\tp4 -G changes -s shelved -m 1 //depot/... | marshal_dump change\n+}\n+\n make_shelved_cl() {\n \ttest_commit \"$1\" >/dev/null &&\n \tgit p4 submit --origin HEAD^ --shelve >/dev/null &&\n@@ -533,12 +537,59 @@ test_expect_success 'submit --update-shelve' '\n \t) &&\n \t(\n \t\tcd \"$cli\" &&\n-\t\tchange=$(p4 -G changes -s shelved -m 1 //depot/... | \\\n-\t\t\t marshal_dump change) &&\n+\t\tchange=$(last_shelve) &&\n \t\tp4 unshelve -c $change -s $change &&\n \t\tgrep -q updated-line shelf.t &&\n \t\tp4 describe -S $change | grep added-file.t &&\n-\t\ttest_path_is_missing shelved-change-1.t\n+\t\ttest_path_is_missing shelved-change-1.t &&\n+\t\tp4 revert ...\n+\t)\n+'\n+\n+test_expect_failure 'update a shelve involving moved and copied files' '\n+\ttest_when_finished cleanup_git &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\t: >file_to_move &&\n+\t\tp4 add file_to_move &&\n+\t\tp4 submit -d \"change1\" &&\n+\t\tp4 edit file_to_move &&\n+\t\techo change >>file_to_move &&\n+\t\tp4 submit -d \"change2\" &&\n+\t\tp4 opened\n+\t) &&\n+\tgit p4 clone --dest=\"$git\" //depot &&\n+\t(\n+\t\tcd \"$git\" &&\n+\t\tgit config git-p4.detectCopies true &&\n+\t\tgit config git-p4.detectRenames true &&\n+\t\tgit config git-p4.skipSubmitEdit true &&\n+\t\tmkdir moved &&\n+\t\tcp file_to_move copy_of_file &&\n+\t\tgit add copy_of_file &&\n+\t\tgit mv file_to_move moved/ &&\n+\t\tgit commit -m \"rename a file\" &&\n+\t\tgit p4 submit -M --shelve --origin HEAD^ &&\n+\t\t: >new_file &&\n+\t\tgit add new_file &&\n+\t\tgit commit --amend &&\n+\t\tgit show --stat HEAD &&\n+\t\tchange=$(last_shelve) &&\n+\t\tgit p4 submit -M --update-shelve $change --commit HEAD\n+\t) &&\n+\t(\n+\t\tcd \"$cli\" &&\n+\t\tchange=$(last_shelve) &&\n+\t\techo change=$change &&\n+\t\tp4 unshelve -s $change &&\n+\t\tp4 submit -d \"Testing update-shelve\" &&\n+\t\ttest_path_is_file copy_of_file &&\n+\t\ttest_path_is_file moved/file_to_move &&\n+\t\ttest_path_is_missing file_to_move &&\n+\t\ttest_path_is_file new_file &&\n+\t\techo \"unshelved and submitted change $change\" &&\n+\t\tp4 changes moved/file_to_move | grep \"Testing update-shelve\" &&\n+\t\tp4 changes copy_of_file | grep \"Testing update-shelve\"\n \t)\n '\n \n-- \n2.20.1.100.g9ee79a14a8\n\n"},{"id":"367069","messageId":"20190118093656.16521-3-luke@diamand.org","threadId":"50258","inReplyTo":"20190118093656.16521-2-luke@diamand.org","subject":"[PATCHv3 2/2] git-p4: handle update of moved/copied files when updating a shelve","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2019-01-18T09:36:56Z","receivedAt":"2019-01-18T09:37:09Z","isPatch":false,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"Perforce requires a complete list of files being operated on. If\ngit is updating an existing shelved changelist, then any files\nwhich are moved or copied were not being added to this list.\n\nSigned-off-by: Luke Diamand <luke@diamand.org>\nAcked-by: Andrey Mazo <amazo@checkvideo.com>\n---\n git-p4.py                | 2 ++\n t/t9807-git-p4-submit.sh | 2 +-\n 2 files changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 1998c3e141..b1c262e13d 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1859,6 +1859,7 @@ def applyCommit(self, id):\n                     filesToAdd.remove(path)\n             elif modifier == \"C\":\n                 src, dest = diff['src'], diff['dst']\n+                all_files.append(dest)\n                 p4_integrate(src, dest)\n                 pureRenameCopy.add(dest)\n                 if diff['src_sha1'] != diff['dst_sha1']:\n@@ -1875,6 +1876,7 @@ def applyCommit(self, id):\n                 editedFiles.add(dest)\n             elif modifier == \"R\":\n                 src, dest = diff['src'], diff['dst']\n+                all_files.append(dest)\n                 if self.p4HasMoveCommand:\n                     p4_edit(src)        # src must be open before move\n                     p4_move(src, dest)  # opens for (move/delete, move/add)\ndiff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh\nindex 2ad3d801cc..099e5e079d 100755\n--- a/t/t9807-git-p4-submit.sh\n+++ b/t/t9807-git-p4-submit.sh\n@@ -546,7 +546,7 @@ test_expect_success 'submit --update-shelve' '\n \t)\n '\n \n-test_expect_failure 'update a shelve involving moved and copied files' '\n+test_expect_success 'update a shelve involving moved and copied files' '\n \ttest_when_finished cleanup_git &&\n \t(\n \t\tcd \"$cli\" &&\n-- \n2.20.1.100.g9ee79a14a8\n\n"},{"id":"367117","messageId":"xmqqva2lluz6.fsf@gitster-ct.c.googlers.com","threadId":"50258","inReplyTo":"20190118093656.16521-1-luke@diamand.org","subject":"Re: [PATCHv3 0/2] git-p4: shelved change update with move/copy","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-01-18T17:46:21Z","receivedAt":"2019-01-18T17:46: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> This updates the patchset to support copy, as suggested by Andrey.\n>\n> Luke Diamand (2):\n>   git-p4: add failing test for shelved CL update involving move/copy\n>   git-p4: handle update of moved/copied files when updating a shelve\n>\n>  git-p4.py                |  2 ++\n>  t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++---\n>  2 files changed, 56 insertions(+), 3 deletions(-)\n\nThanks.\n\nThis has been listed among those that have been planned to be merged\ndown to 'next', which I wanted to do today.  I'll replace it with\nthis round and merge it in a few days.\n"},{"id":"367331","messageId":"20190122181547.2172-1-amazo@checkvideo.com","threadId":"50258","inReplyTo":"20190118093656.16521-1-luke@diamand.org","subject":"Re: [PATCHv3 0/2] git-p4: shelved change update with move/copy","fromName":"Mazo, Andrey","fromEmail":"amazo@checkvideo.com","sentAt":"2019-01-22T18:16:02Z","receivedAt":"2019-01-22T18:16:06Z","isPatch":false,"sender":{"key":"amazo@checkvideo.com","avatar":null},"body":"> This updates the patchset to support copy, as suggested by Andrey.\n> \n> Luke Diamand (2):\n>   git-p4: add failing test for shelved CL update involving move/copy\n>   git-p4: handle update of moved/copied files when updating a shelve\n> \n>  git-p4.py                |  2 ++\n>  t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++---\n>  2 files changed, 56 insertions(+), 3 deletions(-)\n\nThank you for addressing my comments!\nThe updated patchset looks good to me:\nAcked-by: Andrey Mazo <amazo@checkvideo.com>\n\nThank you,\nAndrey\n"}]}