[PATCH STABLE] shelve: remove unused variable assignment

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Nov 1 15:02:09 CDT 2013


# HG changeset patch
# User FUJIWARA Katsunori <foozy at 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.

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:


More information about the Mercurial-devel mailing list