* [PATCHv3 0/2] git-p4: shelved change update with move/copy @ 2019-01-18 9:36 Luke Diamand 2019-01-18 9:36 ` [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy Luke Diamand ` (2 more replies) 0 siblings, 3 replies; 5+ messages in thread From: Luke Diamand @ 2019-01-18 9:36 UTC (permalink / raw) To: git Cc: Junio C Hamano, Andrew Oakley, Romain Merland, SZEDER Gábor, Vitor Antunes, Andrey Mazo, Luke Diamand This updates the patchset to support copy, as suggested by Andrey. Luke Diamand (2): git-p4: add failing test for shelved CL update involving move/copy git-p4: handle update of moved/copied files when updating a shelve git-p4.py | 2 ++ t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 3 deletions(-) -- 2.20.1.100.g9ee79a14a8 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy 2019-01-18 9:36 [PATCHv3 0/2] git-p4: shelved change update with move/copy Luke Diamand @ 2019-01-18 9:36 ` Luke Diamand 2019-01-18 9:36 ` [PATCHv3 2/2] git-p4: handle update of moved/copied files when updating a shelve Luke Diamand 2019-01-18 17:46 ` [PATCHv3 0/2] git-p4: shelved change update with move/copy Junio C Hamano 2019-01-22 18:16 ` Mazo, Andrey 2 siblings, 1 reply; 5+ messages in thread From: Luke Diamand @ 2019-01-18 9:36 UTC (permalink / raw) To: git Cc: Junio C Hamano, Andrew Oakley, Romain Merland, SZEDER Gábor, Vitor Antunes, Andrey Mazo, Luke Diamand Updating a shelved P4 changelist where one or more files have been moved or copied does not work. Add a test for this. The problem is that P4 requires a complete list of the files being changed, and move/copy only includes the _source_ in the case of updating a shelved changelist. This results in errors from Perforce such as: //depot/src - needs tofile //depot/dst Submit aborted -- fix problems then use 'p4 submit -c 1234' Signed-off-by: Luke Diamand <luke@diamand.org> Acked-by: Andrey Mazo <amazo@checkvideo.com> --- t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh index 2325599ee6..2ad3d801cc 100755 --- a/t/t9807-git-p4-submit.sh +++ b/t/t9807-git-p4-submit.sh @@ -500,6 +500,10 @@ test_expect_success 'submit --shelve' ' ) ' +last_shelve() { + p4 -G changes -s shelved -m 1 //depot/... | marshal_dump change +} + make_shelved_cl() { test_commit "$1" >/dev/null && git p4 submit --origin HEAD^ --shelve >/dev/null && @@ -533,12 +537,59 @@ test_expect_success 'submit --update-shelve' ' ) && ( cd "$cli" && - change=$(p4 -G changes -s shelved -m 1 //depot/... | \ - marshal_dump change) && + change=$(last_shelve) && p4 unshelve -c $change -s $change && grep -q updated-line shelf.t && p4 describe -S $change | grep added-file.t && - test_path_is_missing shelved-change-1.t + test_path_is_missing shelved-change-1.t && + p4 revert ... + ) +' + +test_expect_failure 'update a shelve involving moved and copied files' ' + test_when_finished cleanup_git && + ( + cd "$cli" && + : >file_to_move && + p4 add file_to_move && + p4 submit -d "change1" && + p4 edit file_to_move && + echo change >>file_to_move && + p4 submit -d "change2" && + p4 opened + ) && + git p4 clone --dest="$git" //depot && + ( + cd "$git" && + git config git-p4.detectCopies true && + git config git-p4.detectRenames true && + git config git-p4.skipSubmitEdit true && + mkdir moved && + cp file_to_move copy_of_file && + git add copy_of_file && + git mv file_to_move moved/ && + git commit -m "rename a file" && + git p4 submit -M --shelve --origin HEAD^ && + : >new_file && + git add new_file && + git commit --amend && + git show --stat HEAD && + change=$(last_shelve) && + git p4 submit -M --update-shelve $change --commit HEAD + ) && + ( + cd "$cli" && + change=$(last_shelve) && + echo change=$change && + p4 unshelve -s $change && + p4 submit -d "Testing update-shelve" && + test_path_is_file copy_of_file && + test_path_is_file moved/file_to_move && + test_path_is_missing file_to_move && + test_path_is_file new_file && + echo "unshelved and submitted change $change" && + p4 changes moved/file_to_move | grep "Testing update-shelve" && + p4 changes copy_of_file | grep "Testing update-shelve" ) ' -- 2.20.1.100.g9ee79a14a8 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCHv3 2/2] git-p4: handle update of moved/copied files when updating a shelve 2019-01-18 9:36 ` [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy Luke Diamand @ 2019-01-18 9:36 ` Luke Diamand 0 siblings, 0 replies; 5+ messages in thread From: Luke Diamand @ 2019-01-18 9:36 UTC (permalink / raw) To: git Cc: Junio C Hamano, Andrew Oakley, Romain Merland, SZEDER Gábor, Vitor Antunes, Andrey Mazo, Luke Diamand Perforce requires a complete list of files being operated on. If git is updating an existing shelved changelist, then any files which are moved or copied were not being added to this list. Signed-off-by: Luke Diamand <luke@diamand.org> Acked-by: Andrey Mazo <amazo@checkvideo.com> --- git-p4.py | 2 ++ t/t9807-git-p4-submit.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/git-p4.py b/git-p4.py index 1998c3e141..b1c262e13d 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1859,6 +1859,7 @@ def applyCommit(self, id): filesToAdd.remove(path) elif modifier == "C": src, dest = diff['src'], diff['dst'] + all_files.append(dest) p4_integrate(src, dest) pureRenameCopy.add(dest) if diff['src_sha1'] != diff['dst_sha1']: @@ -1875,6 +1876,7 @@ def applyCommit(self, id): editedFiles.add(dest) elif modifier == "R": src, dest = diff['src'], diff['dst'] + all_files.append(dest) if self.p4HasMoveCommand: p4_edit(src) # src must be open before move p4_move(src, dest) # opens for (move/delete, move/add) diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh index 2ad3d801cc..099e5e079d 100755 --- a/t/t9807-git-p4-submit.sh +++ b/t/t9807-git-p4-submit.sh @@ -546,7 +546,7 @@ test_expect_success 'submit --update-shelve' ' ) ' -test_expect_failure 'update a shelve involving moved and copied files' ' +test_expect_success 'update a shelve involving moved and copied files' ' test_when_finished cleanup_git && ( cd "$cli" && -- 2.20.1.100.g9ee79a14a8 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCHv3 0/2] git-p4: shelved change update with move/copy 2019-01-18 9:36 [PATCHv3 0/2] git-p4: shelved change update with move/copy Luke Diamand 2019-01-18 9:36 ` [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy Luke Diamand @ 2019-01-18 17:46 ` Junio C Hamano 2019-01-22 18:16 ` Mazo, Andrey 2 siblings, 0 replies; 5+ messages in thread From: Junio C Hamano @ 2019-01-18 17:46 UTC (permalink / raw) To: Luke Diamand Cc: git, Andrew Oakley, Romain Merland, SZEDER Gábor, Vitor Antunes, Andrey Mazo Luke Diamand <luke@diamand.org> writes: > This updates the patchset to support copy, as suggested by Andrey. > > Luke Diamand (2): > git-p4: add failing test for shelved CL update involving move/copy > git-p4: handle update of moved/copied files when updating a shelve > > git-p4.py | 2 ++ > t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++--- > 2 files changed, 56 insertions(+), 3 deletions(-) Thanks. This has been listed among those that have been planned to be merged down to 'next', which I wanted to do today. I'll replace it with this round and merge it in a few days. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCHv3 0/2] git-p4: shelved change update with move/copy 2019-01-18 9:36 [PATCHv3 0/2] git-p4: shelved change update with move/copy Luke Diamand 2019-01-18 9:36 ` [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy Luke Diamand 2019-01-18 17:46 ` [PATCHv3 0/2] git-p4: shelved change update with move/copy Junio C Hamano @ 2019-01-22 18:16 ` Mazo, Andrey 2 siblings, 0 replies; 5+ messages in thread From: Mazo, Andrey @ 2019-01-22 18:16 UTC (permalink / raw) To: luke@diamand.org Cc: Mazo, Andrey, aoakley@roku.com, git@vger.kernel.org, gitster@pobox.com, merlorom@yahoo.fr, szeder.dev@gmail.com, vitor.hda@gmail.com > This updates the patchset to support copy, as suggested by Andrey. > > Luke Diamand (2): > git-p4: add failing test for shelved CL update involving move/copy > git-p4: handle update of moved/copied files when updating a shelve > > git-p4.py | 2 ++ > t/t9807-git-p4-submit.sh | 57 +++++++++++++++++++++++++++++++++++++--- > 2 files changed, 56 insertions(+), 3 deletions(-) Thank you for addressing my comments! The updated patchset looks good to me: Acked-by: Andrey Mazo <amazo@checkvideo.com> Thank you, Andrey ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-22 18:16 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-01-18 9:36 [PATCHv3 0/2] git-p4: shelved change update with move/copy Luke Diamand 2019-01-18 9:36 ` [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy Luke Diamand 2019-01-18 9:36 ` [PATCHv3 2/2] git-p4: handle update of moved/copied files when updating a shelve Luke Diamand 2019-01-18 17:46 ` [PATCHv3 0/2] git-p4: shelved change update with move/copy Junio C Hamano 2019-01-22 18:16 ` Mazo, Andrey
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).