[PATCH 6 of 9] record extension: removed 'has_key' usage

Renato Cunha renatoc at gmail.com
Thu Jul 1 17:27:59 CDT 2010


 hgext/record.py |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)


# HG changeset patch
# User Renato Cunha <renatoc at gmail.com>
# Date 1278023223 10800
# Node ID b16f77a9ba30bc5053d35926d1fd1a8066d018a6
# Parent  be82e9c22659856bfe041391f9ebe15f4c79e939
record extension: removed 'has_key' usage.

Py3k has removed the dictionary has_key method. This patch implements a one
argument function that can be used as a callback by hg.revert in the record
extension.

diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -486,7 +486,10 @@
 
             # 3a. apply filtered patch to clean repo  (clean)
             if backups:
-                hg.revert(repo, repo.dirstate.parents()[0], backups.has_key)
+                def has_key(key):
+                    return key in has_key.backups
+                has_key.backups = backups
+                hg.revert(repo, repo.dirstate.parents()[0], has_key)
 
             # 3b. (apply)
             if dopatch:


More information about the Mercurial-devel mailing list