{"thread":{"id":"51150","subject":"[PATCH v2] git-p4: Allow unshelving of branched files","startedAt":"2019-05-22T06:21:22Z","lastAt":"2019-05-28T17:55:37Z","messageCount":2,"participants":["Simon Williams","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"376054","messageId":"20190522062120.GB5224@buzz.no-dns-yet.org.uk","threadId":"51150","inReplyTo":null,"subject":"[PATCH v2] git-p4: Allow unshelving of branched files","fromName":"Simon Williams","fromEmail":"simon@no-dns-yet.org.uk","sentAt":"2019-05-22T06:21:20Z","receivedAt":"2019-05-22T06:21:22Z","isPatch":true,"sender":{"key":"simon@no-dns-yet.org.uk","avatar":"https://avatars.githubusercontent.com/u/3449452?v=4"},"body":"When unshelving a changelist, git-p4 tries to work out the appropriate\nparent commit in a given branch (default: HEAD).  To do this, it looks\nat the state of any pre-existing files in the target Perforce branch,\nomitting files added in the shelved changelist.  Currently, only files\nadded (or move targets) are classed as new.  However, files integrated\nfrom other branches (i.e. a 'branch' action) also need to be considered\nas added, for this purpose.\n\nSigned-off-by: Simon Williams <simon@no-dns-yet.org.uk>\nSigned-off-by: Luke Diamand <luke@diamand.org>\n---\n git-p4.py           | 2 +-\n t/t9832-unshelve.sh | 8 +++++++-\n 2 files changed, 8 insertions(+), 2 deletions(-)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex 5b79920f46..81a525858b 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -1309,7 +1309,7 @@ def processContent(self, git_mode, relPath, contents):\n \n class Command:\n     delete_actions = ( \"delete\", \"move/delete\", \"purge\" )\n-    add_actions = ( \"add\", \"move/add\" )\n+    add_actions = ( \"add\", \"branch\", \"move/add\" )\n \n     def __init__(self):\n         self.usage = \"usage: %prog [options]\"\ndiff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh\nindex 41c09f11f4..cde9f86cd6 100755\n--- a/t/t9832-unshelve.sh\n+++ b/t/t9832-unshelve.sh\n@@ -22,7 +22,10 @@ test_expect_success 'init depot' '\n \t\t: >file_to_move &&\n \t\tp4 add file_to_delete &&\n \t\tp4 add file_to_move &&\n-\t\tp4 submit -d \"add files to delete\"\n+\t\tp4 submit -d \"add files to delete\" &&\n+\t\techo file_to_integrate >file_to_integrate &&\n+\t\tp4 add file_to_integrate &&\n+\t\tp4 submit -d \"add file to integrate\"\n \t)\n '\n \n@@ -40,6 +43,7 @@ test_expect_success 'create shelved changelist' '\n \t\tp4 delete file_to_delete &&\n \t\tp4 edit file_to_move &&\n \t\tp4 move file_to_move moved_file &&\n+\t\tp4 integrate file_to_integrate integrated_file &&\n \t\tp4 opened &&\n \t\tp4 shelve -i <<EOF\n Change: new\n@@ -53,6 +57,7 @@ Files:\n \t//depot/file_to_delete\n \t//depot/file_to_move\n \t//depot/moved_file\n+\t//depot/integrated_file\n EOF\n \n \t) &&\n@@ -65,6 +70,7 @@ EOF\n \t\ttest_path_is_file file2 &&\n \t\ttest_cmp file1 \"$cli\"/file1 &&\n \t\ttest_cmp file2 \"$cli\"/file2 &&\n+\t\ttest_cmp file_to_integrate \"$cli\"/integrated_file &&\n \t\ttest_path_is_missing file_to_delete &&\n \t\ttest_path_is_missing file_to_move &&\n \t\ttest_path_is_file moved_file\n-- \n2.17.1\n\n\nRegards,\n-- \nSimon Williams <simon@no-dns-yet.org.uk>\nPGP Key ID: 0xF4A23C69\n\n"},{"id":"376326","messageId":"xmqqr28i31m6.fsf@gitster-ct.c.googlers.com","threadId":"51150","inReplyTo":"20190522062120.GB5224@buzz.no-dns-yet.org.uk","subject":"Re: [PATCH v2] git-p4: Allow unshelving of branched files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-05-28T17:55:29Z","receivedAt":"2019-05-28T17:55:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Simon Williams <simon@no-dns-yet.org.uk> writes:\n\n> When unshelving a changelist, git-p4 tries to work out the appropriate\n> parent commit in a given branch (default: HEAD).  To do this, it looks\n> at the state of any pre-existing files in the target Perforce branch,\n> omitting files added in the shelved changelist.  Currently, only files\n> added (or move targets) are classed as new.  However, files integrated\n> from other branches (i.e. a 'branch' action) also need to be considered\n> as added, for this purpose.\n>\n> Signed-off-by: Simon Williams <simon@no-dns-yet.org.uk>\n> Signed-off-by: Luke Diamand <luke@diamand.org>\n\nI'll tweak the last one from \"S-o-b\" to \"Acked-by\" while queuing.\nThanks, both.\n\n> ---\n>  git-p4.py           | 2 +-\n>  t/t9832-unshelve.sh | 8 +++++++-\n>  2 files changed, 8 insertions(+), 2 deletions(-)\n>\n> diff --git a/git-p4.py b/git-p4.py\n> index 5b79920f46..81a525858b 100755\n> --- a/git-p4.py\n> +++ b/git-p4.py\n> @@ -1309,7 +1309,7 @@ def processContent(self, git_mode, relPath, contents):\n>  \n>  class Command:\n>      delete_actions = ( \"delete\", \"move/delete\", \"purge\" )\n> -    add_actions = ( \"add\", \"move/add\" )\n> +    add_actions = ( \"add\", \"branch\", \"move/add\" )\n>  \n>      def __init__(self):\n>          self.usage = \"usage: %prog [options]\"\n> diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh\n> index 41c09f11f4..cde9f86cd6 100755\n> --- a/t/t9832-unshelve.sh\n> +++ b/t/t9832-unshelve.sh\n> @@ -22,7 +22,10 @@ test_expect_success 'init depot' '\n>  \t\t: >file_to_move &&\n>  \t\tp4 add file_to_delete &&\n>  \t\tp4 add file_to_move &&\n> -\t\tp4 submit -d \"add files to delete\"\n> +\t\tp4 submit -d \"add files to delete\" &&\n> +\t\techo file_to_integrate >file_to_integrate &&\n> +\t\tp4 add file_to_integrate &&\n> +\t\tp4 submit -d \"add file to integrate\"\n>  \t)\n>  '\n>  \n> @@ -40,6 +43,7 @@ test_expect_success 'create shelved changelist' '\n>  \t\tp4 delete file_to_delete &&\n>  \t\tp4 edit file_to_move &&\n>  \t\tp4 move file_to_move moved_file &&\n> +\t\tp4 integrate file_to_integrate integrated_file &&\n>  \t\tp4 opened &&\n>  \t\tp4 shelve -i <<EOF\n>  Change: new\n> @@ -53,6 +57,7 @@ Files:\n>  \t//depot/file_to_delete\n>  \t//depot/file_to_move\n>  \t//depot/moved_file\n> +\t//depot/integrated_file\n>  EOF\n>  \n>  \t) &&\n> @@ -65,6 +70,7 @@ EOF\n>  \t\ttest_path_is_file file2 &&\n>  \t\ttest_cmp file1 \"$cli\"/file1 &&\n>  \t\ttest_cmp file2 \"$cli\"/file2 &&\n> +\t\ttest_cmp file_to_integrate \"$cli\"/integrated_file &&\n>  \t\ttest_path_is_missing file_to_delete &&\n>  \t\ttest_path_is_missing file_to_move &&\n>  \t\ttest_path_is_file moved_file\n> -- \n> 2.17.1\n>\n>\n> Regards,\n"}]}