X-Gmail-Received: cccbb3cdc84ae431fe07356861cbfa18540eab00
authorCatalin Marinas <catalin.marinas@gmail.com>
Thu, 22 Dec 2005 22:17:39 +0000 (22:17 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 22 Dec 2005 22:17:39 +0000 (22:17 +0000)
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: <Catalin.Marinas@arm.com>
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 <catalin.marinas@gmail.com>; 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 <catalin.marinas@arm.com>
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 <catalin.marinas@gmail.com>

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 <catalin.marinas@gmail.com>
stgit/git.py

index dd7821e..a7b1c3f 100644 (file)
@@ -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):