* [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve
@ 2019-01-13 13:58 Luke Diamand
2019-01-13 13:58 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Luke Diamand
2019-01-14 18:56 ` [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Junio C Hamano
0 siblings, 2 replies; 6+ messages in thread
From: Luke Diamand @ 2019-01-13 13:58 UTC (permalink / raw)
To: git, viniciusalexandre, Romain Merland, SZEDER Gábor,
Vitor Antunes, amazo, aoakley
Cc: Luke Diamand
I found this bug recently in git-p4 - updating a shelved changelist where files
are being moved doesn't work. The destination of any moves needs to be
added to the list of files passed to P4.
Luke Diamand (2):
git-p4: add failing test for shelved CL update involving move
git-p4: handle update of moved files when updating a shelve
git-p4.py | 1 +
t/t9807-git-p4-submit.sh | 53 +++++++++++++++++++++++++++++++++++++---
2 files changed, 51 insertions(+), 3 deletions(-)
--
2.20.1.100.g9ee79a14a8
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] git-p4: add failing test for shelved CL update involving move
2019-01-13 13:58 [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Luke Diamand
@ 2019-01-13 13:58 ` Luke Diamand
2019-01-13 13:58 ` [PATCH 2/2] git-p4: handle update of moved files when updating a shelve Luke Diamand
2019-01-13 21:57 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Eric Sunshine
2019-01-14 18:56 ` [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Junio C Hamano
1 sibling, 2 replies; 6+ messages in thread
From: Luke Diamand @ 2019-01-13 13:58 UTC (permalink / raw)
To: git, viniciusalexandre, Romain Merland, SZEDER Gábor,
Vitor Antunes, amazo, aoakley
Cc: Luke Diamand
Updating a shelved P4 changelist where one or more of the files have
been moved does not work. Add a test for this.
Signed-off-by: Luke Diamand <luke@diamand.org>
---
t/t9807-git-p4-submit.sh | 53 +++++++++++++++++++++++++++++++++++++---
1 file changed, 50 insertions(+), 3 deletions(-)
diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
index 2325599ee6..08dc8d2caf 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -500,6 +500,12 @@ test_expect_success 'submit --shelve' '
)
'
+last_shelve() {
+ change=$(p4 -G changes -s shelved -m 1 //depot/... | \
+ marshal_dump change)
+ echo $change
+}
+
make_shelved_cl() {
test_commit "$1" >/dev/null &&
git p4 submit --origin HEAD^ --shelve >/dev/null &&
@@ -533,12 +539,53 @@ 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 a moved file' '
+ 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.skipSubmitEdit true &&
+ mkdir moved &&
+ 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 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"
)
'
--
2.20.1.100.g9ee79a14a8
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] git-p4: handle update of moved files when updating a shelve
2019-01-13 13:58 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Luke Diamand
@ 2019-01-13 13:58 ` Luke Diamand
2019-01-13 21:57 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Eric Sunshine
1 sibling, 0 replies; 6+ messages in thread
From: Luke Diamand @ 2019-01-13 13:58 UTC (permalink / raw)
To: git, viniciusalexandre, Romain Merland, SZEDER Gábor,
Vitor Antunes, amazo, aoakley
Cc: 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 were not being added to this list.
Signed-off-by: Luke Diamand <luke@diamand.org>
---
git-p4.py | 1 +
t/t9807-git-p4-submit.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/git-p4.py b/git-p4.py
index 1998c3e141..20c5ce9903 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -1875,6 +1875,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 08dc8d2caf..4d5ea9e64c 100755
--- a/t/t9807-git-p4-submit.sh
+++ b/t/t9807-git-p4-submit.sh
@@ -548,7 +548,7 @@ test_expect_success 'submit --update-shelve' '
)
'
-test_expect_failure 'update a shelve involving a moved file' '
+test_expect_success 'update a shelve involving a moved file' '
test_when_finished cleanup_git &&
(
cd "$cli" &&
--
2.20.1.100.g9ee79a14a8
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] git-p4: add failing test for shelved CL update involving move
2019-01-13 13:58 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Luke Diamand
2019-01-13 13:58 ` [PATCH 2/2] git-p4: handle update of moved files when updating a shelve Luke Diamand
@ 2019-01-13 21:57 ` Eric Sunshine
2019-01-14 19:03 ` Junio C Hamano
1 sibling, 1 reply; 6+ messages in thread
From: Eric Sunshine @ 2019-01-13 21:57 UTC (permalink / raw)
To: Luke Diamand
Cc: Git List, vin ku, Romain Merland, SZEDER Gábor,
Vitor Antunes, amazo, aoakley
On Sun, Jan 13, 2019 at 8:58 AM Luke Diamand <luke@diamand.org> wrote:
> Updating a shelved P4 changelist where one or more of the files have
> been moved does not work. Add a test for this.
Perhaps this message could give more detail about the actual problem
than the generic "does not work" which provides no useful information.
> Signed-off-by: Luke Diamand <luke@diamand.org>
> ---
> diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
> @@ -500,6 +500,12 @@ test_expect_success 'submit --shelve' '
> +last_shelve() {
> + change=$(p4 -G changes -s shelved -m 1 //depot/... | \
> + marshal_dump change)
> + echo $change
> +}
A simpler definition for this function would be:
last_shelve () {
p4 -G changes -s shelved -m 1 //depot/... | marshal_dump change
}
which will give the same result when you later capture its output with:
change=$(last_shelve) &&
> @@ -533,12 +539,53 @@ 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 ...
> + )
> +'
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] git-p4: add failing test for shelved CL update involving move
2019-01-13 21:57 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Eric Sunshine
@ 2019-01-14 19:03 ` Junio C Hamano
0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2019-01-14 19:03 UTC (permalink / raw)
To: Eric Sunshine
Cc: Luke Diamand, Git List, vin ku, Romain Merland, SZEDER Gábor,
Vitor Antunes, amazo, aoakley
Eric Sunshine <sunshine@sunshineco.com> writes:
> On Sun, Jan 13, 2019 at 8:58 AM Luke Diamand <luke@diamand.org> wrote:
>> Updating a shelved P4 changelist where one or more of the files have
>> been moved does not work. Add a test for this.
>
> Perhaps this message could give more detail about the actual problem
> than the generic "does not work" which provides no useful information.
>
>> Signed-off-by: Luke Diamand <luke@diamand.org>
>> ---
>> diff --git a/t/t9807-git-p4-submit.sh b/t/t9807-git-p4-submit.sh
>> @@ -500,6 +500,12 @@ test_expect_success 'submit --shelve' '
>> +last_shelve() {
>> + change=$(p4 -G changes -s shelved -m 1 //depot/... | \
>> + marshal_dump change)
>> + echo $change
>> +}
>
> A simpler definition for this function would be:
>
> last_shelve () {
> p4 -G changes -s shelved -m 1 //depot/... | marshal_dump change
> }
Indeed, and it will work better even when the output from marshal_dump
has $IFS and other traits that do not survive "echo $change" intact.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve
2019-01-13 13:58 [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Luke Diamand
2019-01-13 13:58 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Luke Diamand
@ 2019-01-14 18:56 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2019-01-14 18:56 UTC (permalink / raw)
To: Luke Diamand
Cc: git, viniciusalexandre, Romain Merland, SZEDER Gábor,
Vitor Antunes, amazo, aoakley
Luke Diamand <luke@diamand.org> writes:
> I found this bug recently in git-p4 - updating a shelved changelist where files
> are being moved doesn't work. The destination of any moves needs to be
> added to the list of files passed to P4.
Thanks.
>
> Luke Diamand (2):
> git-p4: add failing test for shelved CL update involving move
> git-p4: handle update of moved files when updating a shelve
>
> git-p4.py | 1 +
> t/t9807-git-p4-submit.sh | 53 +++++++++++++++++++++++++++++++++++++---
> 2 files changed, 51 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-01-14 19:03 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-13 13:58 [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Luke Diamand
2019-01-13 13:58 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Luke Diamand
2019-01-13 13:58 ` [PATCH 2/2] git-p4: handle update of moved files when updating a shelve Luke Diamand
2019-01-13 21:57 ` [PATCH 1/2] git-p4: add failing test for shelved CL update involving move Eric Sunshine
2019-01-14 19:03 ` Junio C Hamano
2019-01-14 18:56 ` [PATCH 0/2] git-p4: handle moved files when updating a P4 shelve Junio C Hamano
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).