Patchwork [STABLE] shelve: remove unused variable assignment

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 1, 2013, 8:02 p.m.
Message ID <b5d627ef2061865a2423.1383336129@feefifofum>
Download mbox | patch
Permalink /patch/2835/
State Accepted
Commit 065e6f1c92593af8ca85708cee083f2999c5eb1a
Headers show

Comments

Katsunori FUJIWARA - Nov. 1, 2013, 8:02 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1383335382 -32400
#      Sat Nov 02 04:49:42 2013 +0900
# Branch stable
# Node ID b5d627ef2061865a2423a1621e9c20f7add4e840
# Parent  1d7a36ff2615e6e12ce65681db4e07622e7b60d1
shelve: remove unused variable assignment

Fix test-check-pyflakes.t error after 1d7a36ff2615.

This patch replaces "readshelvedfiles()" invocation by
"shelvedfile().exists()" check and aborting, because it is required
only to ensure that shelved changes corresponded to specified name
exist after invocation.

This patch also remove definition of "readshelvedfiles()" itself,
because it is invoked only from the line removed by this patch.
Matt Mackall - Nov. 1, 2013, 9:23 p.m.
On Sat, 2013-11-02 at 05:02 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
> # Date 1383335382 -32400
> #      Sat Nov 02 04:49:42 2013 +0900
> # Branch stable
> # Node ID b5d627ef2061865a2423a1621e9c20f7add4e840
> # Parent  1d7a36ff2615e6e12ce65681db4e07622e7b60d1
> shelve: remove unused variable assignment

Queued for stable, thanks.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -358,11 +358,6 @@ 
         finally:
             fp.close()
 
-def readshelvedfiles(repo, basename):
-    """return the list of files touched in a shelve"""
-    fp = shelvedfile(repo, basename, 'files').opener()
-    return fp.read().split('\0')
-
 def checkparents(repo, state):
     """check parent while resuming an unshelve"""
     if state.parents != repo.dirstate.parents():
@@ -532,7 +527,8 @@ 
     else:
         basename = shelved[0]
 
-    shelvedfiles = readshelvedfiles(repo, basename)
+    if not shelvedfile(repo, basename, 'files').exists():
+        raise util.Abort(_("shelved change '%s' not found") % basename)
 
     wlock = lock = tr = None
     try: