From patchwork Wed May 22 06:21:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Williams X-Patchwork-Id: 10955183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1221C924 for ; Wed, 22 May 2019 06:21:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0203028B1F for ; Wed, 22 May 2019 06:21:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7F8028B21; Wed, 22 May 2019 06:21:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81ED828B1F for ; Wed, 22 May 2019 06:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726480AbfEVGVV (ORCPT ); Wed, 22 May 2019 02:21:21 -0400 Received: from buzz.no-dns-yet.org.uk ([81.187.49.251]:36248 "EHLO buzz.no-dns-yet.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbfEVGVV (ORCPT ); Wed, 22 May 2019 02:21:21 -0400 Received: from simon by buzz.no-dns-yet.org.uk with local (Exim 4.90_1) (envelope-from ) id 1hTKcq-0001PI-M8; Wed, 22 May 2019 07:21:20 +0100 Date: Wed, 22 May 2019 07:21:20 +0100 From: Simon Williams To: git@vger.kernel.org Cc: Luke Diamand , Junio C Hamano Subject: [PATCH v2] git-p4: Allow unshelving of branched files Message-ID: <20190522062120.GB5224@buzz.no-dns-yet.org.uk> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When unshelving a changelist, git-p4 tries to work out the appropriate parent commit in a given branch (default: HEAD). To do this, it looks at the state of any pre-existing files in the target Perforce branch, omitting files added in the shelved changelist. Currently, only files added (or move targets) are classed as new. However, files integrated from other branches (i.e. a 'branch' action) also need to be considered as added, for this purpose. Signed-off-by: Simon Williams Signed-off-by: Luke Diamand --- git-p4.py | 2 +- t/t9832-unshelve.sh | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/git-p4.py b/git-p4.py index 5b79920f46..81a525858b 100755 --- a/git-p4.py +++ b/git-p4.py @@ -1309,7 +1309,7 @@ def processContent(self, git_mode, relPath, contents): class Command: delete_actions = ( "delete", "move/delete", "purge" ) - add_actions = ( "add", "move/add" ) + add_actions = ( "add", "branch", "move/add" ) def __init__(self): self.usage = "usage: %prog [options]" diff --git a/t/t9832-unshelve.sh b/t/t9832-unshelve.sh index 41c09f11f4..cde9f86cd6 100755 --- a/t/t9832-unshelve.sh +++ b/t/t9832-unshelve.sh @@ -22,7 +22,10 @@ test_expect_success 'init depot' ' : >file_to_move && p4 add file_to_delete && p4 add file_to_move && - p4 submit -d "add files to delete" + p4 submit -d "add files to delete" && + echo file_to_integrate >file_to_integrate && + p4 add file_to_integrate && + p4 submit -d "add file to integrate" ) ' @@ -40,6 +43,7 @@ test_expect_success 'create shelved changelist' ' p4 delete file_to_delete && p4 edit file_to_move && p4 move file_to_move moved_file && + p4 integrate file_to_integrate integrated_file && p4 opened && p4 shelve -i <