{"thread":{"id":"51148","subject":"[PATCH] git-p4: Allow unshelving of branched files","startedAt":"2019-05-21T23:22:22Z","lastAt":"2019-05-22T06:19:37Z","messageCount":3,"participants":["Simon Williams","Luke Diamand"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"376022","messageId":"20190521225016.GA32526@buzz.no-dns-yet.org.uk","threadId":"51148","inReplyTo":null,"subject":"[PATCH] git-p4: Allow unshelving of branched files","fromName":"Simon Williams","fromEmail":"simon@no-dns-yet.org.uk","sentAt":"2019-05-21T22:50:16Z","receivedAt":"2019-05-21T23:22: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,\nomiting 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>\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\n-- \nSimon Williams <simon@no-dns-yet.org.uk>\nPGP Key ID: 0xF4A23C69\n\n"},{"id":"376052","messageId":"CAE5ih7_FMCY9ZLyYoY2XmmaaSTQAiXSMMwC_j+kLzdKY4M=hRw@mail.gmail.com","threadId":"51148","inReplyTo":"20190521225016.GA32526@buzz.no-dns-yet.org.uk","subject":"Re: [PATCH] git-p4: Allow unshelving of branched files","fromName":"Luke Diamand","fromEmail":"luke@diamand.org","sentAt":"2019-05-22T05:49:38Z","receivedAt":"2019-05-22T05:49:51Z","isPatch":true,"sender":{"key":"luke@diamand.org","avatar":"https://avatars.githubusercontent.com/u/5330967?v=4"},"body":"On Tue, 21 May 2019 at 23:50, Simon Williams <simon@no-dns-yet.org.uk> wrote:\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> omiting 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\nLooks good to me!\n\n\"omiting\" in the comment should perhaps be \"omitting\".\n\n>\n> Signed-off-by: Simon Williams <simon@no-dns-yet.org.uk>\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>                 : >file_to_move &&\n>                 p4 add file_to_delete &&\n>                 p4 add file_to_move &&\n> -               p4 submit -d \"add files to delete\"\n> +               p4 submit -d \"add files to delete\" &&\n> +               echo file_to_integrate >file_to_integrate &&\n> +               p4 add file_to_integrate &&\n> +               p4 submit -d \"add file to integrate\"\n>         )\n>  '\n>\n> @@ -40,6 +43,7 @@ test_expect_success 'create shelved changelist' '\n>                 p4 delete file_to_delete &&\n>                 p4 edit file_to_move &&\n>                 p4 move file_to_move moved_file &&\n> +               p4 integrate file_to_integrate integrated_file &&\n>                 p4 opened &&\n>                 p4 shelve -i <<EOF\n>  Change: new\n> @@ -53,6 +57,7 @@ Files:\n>         //depot/file_to_delete\n>         //depot/file_to_move\n>         //depot/moved_file\n> +       //depot/integrated_file\n>  EOF\n>\n>         ) &&\n> @@ -65,6 +70,7 @@ EOF\n>                 test_path_is_file file2 &&\n>                 test_cmp file1 \"$cli\"/file1 &&\n>                 test_cmp file2 \"$cli\"/file2 &&\n> +               test_cmp file_to_integrate \"$cli\"/integrated_file &&\n>                 test_path_is_missing file_to_delete &&\n>                 test_path_is_missing file_to_move &&\n>                 test_path_is_file moved_file\n> --\n> 2.17.1\n>\n>\n> --\n> Simon Williams <simon@no-dns-yet.org.uk>\n> PGP Key ID: 0xF4A23C69\n>\n"},{"id":"376053","messageId":"20190522061933.GA5224@buzz.no-dns-yet.org.uk","threadId":"51148","inReplyTo":"CAE5ih7_FMCY9ZLyYoY2XmmaaSTQAiXSMMwC_j+kLzdKY4M=hRw@mail.gmail.com","subject":"Re: [PATCH] git-p4: Allow unshelving of branched files","fromName":"Simon Williams","fromEmail":"simon@no-dns-yet.org.uk","sentAt":"2019-05-22T06:19:33Z","receivedAt":"2019-05-22T06:19:37Z","isPatch":true,"sender":{"key":"simon@no-dns-yet.org.uk","avatar":"https://avatars.githubusercontent.com/u/3449452?v=4"},"body":"On Wed, May 22, 2019 at 06:49:38AM +0100, Luke Diamand wrote:\n> On Tue, 21 May 2019 at 23:50, Simon Williams <simon@no-dns-yet.org.uk> wrote:\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> > omiting 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> Looks good to me!\n> \n> \"omiting\" in the comment should perhaps be \"omitting\".\n\nThanks and good point.  I'll send the revised patch.\n\n\nRegards,\n-- \nSimon Williams <simon@no-dns-yet.org.uk>\nPGP Key ID: 0xF4A23C69\n\n"}]}