Patchwork [1,of,2] shelve: use the class constant in the clear method

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 14, 2013, 4:33 p.m.
Message ID <af5270c0547ec771b2f3.1381768387@vulgaris>
Download mbox | patch
Permalink /patch/2768/
State Accepted
Commit 07ee5c8867ca68d9fe1035417b51c5dd3748cfed
Headers show

Comments

Pierre-Yves David - Oct. 14, 2013, 4:33 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1381765607 -7200
#      Mon Oct 14 17:46:47 2013 +0200
# Node ID af5270c0547ec771b2f3ad3f04ebf2f782e0aac9
# Parent  1b2f9d36953e6ed384a044c1e73cb3a1aa072004
shelve: use the class constant in the clear method

This class attribut is used everywhere else. Not using it in clear will get us
in trouble sooner or later.

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -107,13 +107,13 @@  class shelvedstate(object):
         pickle.dump((cls._version, name,
                      repo.dirstate.parents(),
                      stripnodes), fp)
         fp.close()
 
-    @staticmethod
-    def clear(repo):
-        util.unlinkpath(repo.join('shelvedstate'), ignoremissing=True)
+    @classmethod
+    def clear(cls, repo):
+        util.unlinkpath(repo.join(cls._filename), ignoremissing=True)
 
 def createcmd(ui, repo, pats, opts):
     def publicancestors(ctx):
         """Compute the heads of the public ancestors of a commit.