From 05c9e6653351bb3c2c2ae822ace38f190288d70d Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Thu, 22 Dec 2005 22:17:39 +0000 Subject: [PATCH] X-Gmail-Received: cccbb3cdc84ae431fe07356861cbfa18540eab00 Delivered-To: catalin.marinas@gmail.com Received: by 10.70.27.12 with SMTP id a12cs9199wxa; Thu, 22 Dec 2005 06:26:44 -0800 (PST) Received: by 10.67.27.6 with SMTP id e6mr472488ugj; Thu, 22 Dec 2005 06:26:43 -0800 (PST) Return-Path: Received: from cam-admin0.cambridge.arm.com (cam-admin0.cambridge.arm.com [193.131.176.58]) by mx.gmail.com with ESMTP id y1si659917uge.2005.12.22.06.26.43; Thu, 22 Dec 2005 06:26:43 -0800 (PST) Received-SPF: pass (gmail.com: best guess record for domain of Catalin.Marinas@arm.com designates 193.131.176.58 as permitted sender) Received: from cam-owa2.Emea.Arm.com (cam-owa2.emea.arm.com [10.1.255.63]) by cam-admin0.cambridge.arm.com (8.12.10/8.12.10) with ESMTP id jBMEQ4JH025197 for ; Thu, 22 Dec 2005 14:26:04 GMT Received: from localhost.localdomain ([10.1.255.211]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 22 Dec 2005 14:26:42 +0000 From: Catalin Marinas Subject: [PATCH] "status --reset" does not restore the deleted files Date: Thu, 22 Dec 2005 14:26:42 +0000 To: catalin.marinas@gmail.com Message-Id: <20051222142642.21281.82698.stgit@localhost.localdomain> X-OriginalArrivalTime: 22 Dec 2005 14:26:42.0831 (UTC) FILETIME=[BAE209F0:01C60703] X-Evolution-Source: pop://catalin.marinas@pop.gmail.com/ Mime-Version: 1.0 From: Catalin Marinas Actually, the broken code was restoring but deleting them. This was because git.reset() command was used in the past instead of git.switch(). This patch fixed it. Signed-off-by: Catalin Marinas --- stgit/git.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/stgit/git.py b/stgit/git.py index dd7821e..a7b1c3f 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -603,18 +603,10 @@ def reset(files = None, tree_id = None): """Revert the tree changes relative to the given tree_id. It removes any local changes """ - if not tree_id: - tree_id = get_head() - - cache_files = __tree_status(files, tree_id) - rm_files = [x[1] for x in cache_files if x[0] in ['D']] - checkout(files, tree_id, True) - # checkout doesn't remove files - map(os.remove, rm_files) # if the reset refers to the whole tree, switch the HEAD as well - if not files: + if tree_id and not files: __set_head(tree_id) def pull(repository = 'origin', refspec = None): -- 2.11.0