From patchwork Fri Jan 18 09:36:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Diamand X-Patchwork-Id: 10769609 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 8779D13BF for ; Fri, 18 Jan 2019 09:37:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 764872E354 for ; Fri, 18 Jan 2019 09:37:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6A5672E363; Fri, 18 Jan 2019 09:37:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 E12632E354 for ; Fri, 18 Jan 2019 09:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbfARJhH (ORCPT ); Fri, 18 Jan 2019 04:37:07 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:44036 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfARJhG (ORCPT ); Fri, 18 Jan 2019 04:37:06 -0500 Received: by mail-wr1-f68.google.com with SMTP id z5so14152563wrt.11 for ; Fri, 18 Jan 2019 01:37:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diamand.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LsDK8LmcVBHf9NabS0oPyUSkiDSZnKhW9HInYec0TVQ=; b=BXGLZhi84dmGZy00H6IR1ioejkr0EtA+12+KZMTxsi/SomjOayA7ScpwLOiHd2/Fm6 UY7I3OIUvAF8uoMCqo2AQQtqvl0T8zdYlt68qGARxQBOCfx4Yki5lBRDiQVu3NjSYNjR e05mz6MbipA+TfsMErBWV+utuLRSE4gcPXEOQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LsDK8LmcVBHf9NabS0oPyUSkiDSZnKhW9HInYec0TVQ=; b=Zus8fVS8fqpJnysZgkC8uaP7ZsZH4nWNc25A+mBqypvBuM2VNrM3PJqpfGhSB8FA5V RfNW7Zv/34Bdij5s0PVLpOvdkv8hA7cIh7s5ghylO3YIdVihLGcX5YvyRIU+8v7Wa52H a5xrax3WT8aWUEweSvfYYXrQLUJ2GILUHDK8iwk3LS4q1ONDVHiI6yc5Ld4oTB+uYMIW fqn5N4lh3o8EWEBonsU8/XzahjzHhK3GYV8sHaTEP6peNFFY+ogh3LNriFR3mUinyMOa 62ydVrJ6ZFJEHXBIhx/AmL7hJ20tWoKvbbAiuLJqd79+i+WleiRY/xs3G3BnHASq77CL OqJQ== X-Gm-Message-State: AJcUukenUbMGDxyOHbNr6RB078orSacJLARYtDMmcCIPoloW9eKI2098 n1grqXlYUuKZsntBD7oyGkc24bUbcto= X-Google-Smtp-Source: ALg8bN4+igO6dP4QubGsUO2nQZJArhYRJcLEMlGQe7oRL5Rwa3H5GFZFkifZ/SrlYX4VpUE84Y195Q== X-Received: by 2002:adf:82f1:: with SMTP id 104mr16439202wrc.131.1547804224883; Fri, 18 Jan 2019 01:37:04 -0800 (PST) Received: from ethel.local.diamand.org (cpc92728-cmbg20-2-0-cust351.5-4.cable.virginm.net. [82.29.15.96]) by smtp.gmail.com with ESMTPSA id x10sm103962059wrn.29.2019.01.18.01.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 01:37:04 -0800 (PST) From: Luke Diamand To: git@vger.kernel.org Cc: Junio C Hamano , Andrew Oakley , Romain Merland , =?utf-8?q?SZEDER_G=C3=A1bor?= , Vitor Antunes , Andrey Mazo , Luke Diamand Subject: [PATCHv3 1/2] git-p4: add failing test for shelved CL update involving move/copy Date: Fri, 18 Jan 2019 09:36:55 +0000 Message-Id: <20190118093656.16521-2-luke@diamand.org> X-Mailer: git-send-email 2.20.1.100.g9ee79a14a8 In-Reply-To: <20190118093656.16521-1-luke@diamand.org> References: <20190118093656.16521-1-luke@diamand.org> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Andrey Mazo --- 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" ) ' From patchwork Fri Jan 18 09:36:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luke Diamand X-Patchwork-Id: 10769611 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 605B413BF for ; Fri, 18 Jan 2019 09:37:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F5E12A54B for ; Fri, 18 Jan 2019 09:37:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43FAC2E359; Fri, 18 Jan 2019 09:37:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 EFD372A54B for ; Fri, 18 Jan 2019 09:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726398AbfARJhI (ORCPT ); Fri, 18 Jan 2019 04:37:08 -0500 Received: from mail-wr1-f53.google.com ([209.85.221.53]:38377 "EHLO mail-wr1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725784AbfARJhH (ORCPT ); Fri, 18 Jan 2019 04:37:07 -0500 Received: by mail-wr1-f53.google.com with SMTP id v13so14199160wrw.5 for ; Fri, 18 Jan 2019 01:37:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=diamand.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l0TzGOQ+kXoJiWzp1jWGaF02bOOhv0DrgAuLfLNfTLI=; b=U0KJm6MnBmtaIWwC6O0yn6puq9kSjzzv1nN1cKdAiBaCwIcHYTYC1zgpcoYAAI+msJ fwWza2K/VJXXU+yzZp6SK/7FCs7aglW1RhOeNcBxtyQrN2XC0JFJAam/t7bsg32NlojW Luc5g4qNwAY9JnB/IOddSc5+bCmy6xIF7aVhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=l0TzGOQ+kXoJiWzp1jWGaF02bOOhv0DrgAuLfLNfTLI=; b=jwYWVRMNfWRbBjA0oZRAA/i9w+kM26GfkBKGydQOzULazZBCsS/qZUQbq+q2OmU5Da DGP1gOq9M5j4xeGmUQ9hwSgtbmi3t1uITtzqzt8m04olIvIBsISn6zMLF1Nw+x6zBRSw eeUsyq5VfbAhb4qS/AlAND8TEmQyf7U8Q1lozBabo0r9djtPtuzkjHkwjLZ7c1WIriaj GtNR/N4NO2oX4DPHDMH4fcxfFx0nZkq7ErQYeaHXh1gXR+dGuAyp2gtKo15SGZEJYk9R /8UGCix+tyZMeoIFoM0uL3uTrdTphPT/Z0hxLONZ864/z1OEjqb84yWPkWo/CJBUzDcd YdYA== X-Gm-Message-State: AJcUukf61eBsx25u8ALJk8Banu6bBdv7BbpSthfMoNlD0ssIgZSnS/Al KwyLzzGQAtuZGzjWJMgoj8wyChymgjI= X-Google-Smtp-Source: ALg8bN7Q2LoGfoe41KJxT/tSRt/EiZ5O8oOi22oQVCsJ4Rp6Ra4zF2FQVRgyIxzL2cuxM6PWFVgaUw== X-Received: by 2002:adf:f903:: with SMTP id b3mr16314590wrr.82.1547804225612; Fri, 18 Jan 2019 01:37:05 -0800 (PST) Received: from ethel.local.diamand.org (cpc92728-cmbg20-2-0-cust351.5-4.cable.virginm.net. [82.29.15.96]) by smtp.gmail.com with ESMTPSA id x10sm103962059wrn.29.2019.01.18.01.37.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 01:37:05 -0800 (PST) From: Luke Diamand To: git@vger.kernel.org Cc: Junio C Hamano , Andrew Oakley , Romain Merland , =?utf-8?q?SZEDER_G=C3=A1bor?= , Vitor Antunes , Andrey Mazo , Luke Diamand Subject: [PATCHv3 2/2] git-p4: handle update of moved/copied files when updating a shelve Date: Fri, 18 Jan 2019 09:36:56 +0000 Message-Id: <20190118093656.16521-3-luke@diamand.org> X-Mailer: git-send-email 2.20.1.100.g9ee79a14a8 In-Reply-To: <20190118093656.16521-2-luke@diamand.org> References: <20190118093656.16521-1-luke@diamand.org> <20190118093656.16521-2-luke@diamand.org> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Andrey Mazo --- 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" &&