From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 096E96DE1CE3 for ; Mon, 6 Mar 2017 08:37:46 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.147 X-Spam-Level: X-Spam-Status: No, score=-0.147 tagged_above=-999 required=5 tests=[AWL=-0.127, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bZBPlCxLIfZx for ; Mon, 6 Mar 2017 08:37:45 -0800 (PST) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by arlo.cworth.org (Postfix) with ESMTPS id F24946DE1C50 for ; Mon, 6 Mar 2017 08:37:44 -0800 (PST) Received: by mail-lf0-f53.google.com with SMTP id j90so38275416lfk.2 for ; Mon, 06 Mar 2017 08:37:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaute-vetsj-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=234lztTC7AYHFdNLcQ94OA+LqHneYQwEjJG3hsVhxTQ=; b=hdmgWiOVTi0690uIA4Bry02WnGwE3cs1u8o24eE9yn6hQNnLLCvZOJgHSsuDH45FHh FADEO43upR0JouOAE+3H1CkfzM0rRsQngY0F2P0D7NUVbIv0vRG2hE387Fv21HyvKHLh qt8PTwzygAVsuVoRaYUz6qTaWapXCPbAss+UqvlAFkxRksSmeNSgWfDvBTz6v1YGQ8k4 tHqZHuDbTgqOAer5m665rXe16oe9Xjww9znyBHEQpevD6aNosvoQIh+/goGSk7fB4zwW 4IAB+OMKPhAw80VPBQ84qsMVMVDGr1T/WjuKhbX7Ve0Dgn3WXpseRrqvNdKtJrPiZzEe 31Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=234lztTC7AYHFdNLcQ94OA+LqHneYQwEjJG3hsVhxTQ=; b=gfQL1BFmyZiIKTNiJh9qUAOKEGYJ6gsqkj/wn+iXCZ0of6Zhrq8k56MMnf/Tvu726M g7yVioMhzZtUBwN4ljrmOwG/2aSbE8vdoPesrtS4zcxzgduU1eA3TzQSxIAXR5Xo77dh 9fO+tANcNXhpOtOVhreO4U6UimilDL0sP+29W+z/LdZtwcla4FFGQZmRpoi3LnYWqxQq AZdZ91TpNh6lbAneIfFvqpcFxW3TKq8oM6bSLk6tj84rWzuLFuUvdr83ZYHiRdHJq/Xi bZTVXViIO6NOauUA75k7FvOZ1g1TWxo1ky5Pq8aARm1pcKVIOQWmehLjT9DJv5pDi+AH 4K4g== X-Gm-Message-State: AMke39lH3NcJn7i78soUdz7fmg2/cekW4nceyqvxAsus7QEldcUX6M0hopXLo1vJ4r3hlg== X-Received: by 10.25.206.135 with SMTP id e129mr4593802lfg.112.1488818261599; Mon, 06 Mar 2017 08:37:41 -0800 (PST) Received: from localhost ([128.39.46.106]) by smtp.gmail.com with ESMTPSA id g3sm4209503lfe.34.2017.03.06.08.37.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Mar 2017 08:37:40 -0800 (PST) From: Gaute Hope To: notmuch@notmuchmail.org Subject: [PATCH] bindings/python: add bindings for notmuch_database_get_revision Date: Mon, 6 Mar 2017 17:37:34 +0100 Message-Id: <20170306163734.17350-1-eg@gaute.vetsj.com> X-Mailer: git-send-email 2.11.1 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 16:37:46 -0000 Database.get_revision () returns a tuple with the current database revision and the UUID string representing the database. --- bindings/python/notmuch/database.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py index 67fb1c41..8f918069 100644 --- a/bindings/python/notmuch/database.py +++ b/bindings/python/notmuch/database.py @@ -86,6 +86,11 @@ class Database(object): _get_version.argtypes = [NotmuchDatabaseP] _get_version.restype = c_uint + """notmuch_database_get_revision""" + _get_revision = nmlib.notmuch_database_get_revision + _get_revision.argtypes = [NotmuchDatabaseP, POINTER(c_char_p)] + _get_revision.restype = c_uint + """notmuch_database_open""" _open = nmlib.notmuch_database_open _open.argtypes = [c_char_p, c_uint, POINTER(NotmuchDatabaseP)] @@ -261,6 +266,17 @@ class Database(object): self._assert_db_is_initialized() return Database._get_version(self._db) + def get_revision (self): + """Returns the committed database revison and UUID + + :returns: (revison, uuid) The database revision as a positive integer + and the UUID of the database. + """ + self._assert_db_is_initialized() + uuid = c_char_p () + revision = Database._get_revision(self._db, byref (uuid)) + return (revision, uuid.value.decode ('utf-8')) + _needs_upgrade = nmlib.notmuch_database_needs_upgrade _needs_upgrade.argtypes = [NotmuchDatabaseP] _needs_upgrade.restype = bool -- 2.11.1