Re: [PATCH v3] nmbug: Translate to Python
authorW. Trevor King <wking@tremily.us>
Sun, 20 Jul 2014 23:34:02 +0000 (16:34 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:03:48 +0000 (10:03 -0800)
39/fef4d8bf46a70a2f44122908f0176d347e53b3 [new file with mode: 0644]

diff --git a/39/fef4d8bf46a70a2f44122908f0176d347e53b3 b/39/fef4d8bf46a70a2f44122908f0176d347e53b3
new file mode 100644 (file)
index 0000000..abe2ee2
--- /dev/null
@@ -0,0 +1,175 @@
+Return-Path: <wking@tremily.us>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0D23A431FC3\r
+       for <notmuch@notmuchmail.org>; Sun, 20 Jul 2014 16:34:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.1\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id vCuJ-QNsLVki for <notmuch@notmuchmail.org>;\r
+       Sun, 20 Jul 2014 16:34:05 -0700 (PDT)\r
+Received: from qmta08.emeryville.ca.mail.comcast.net\r
+       (qmta08.emeryville.ca.mail.comcast.net [76.96.30.80])\r
+       by olra.theworths.org (Postfix) with ESMTP id F080C431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 20 Jul 2014 16:34:04 -0700 (PDT)\r
+Received: from omta04.emeryville.ca.mail.comcast.net ([76.96.30.35])\r
+       by qmta08.emeryville.ca.mail.comcast.net with comcast\r
+       id UnYP1o0040lTkoCA8na4Zo; Sun, 20 Jul 2014 23:34:04 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta04.emeryville.ca.mail.comcast.net with comcast\r
+       id Una31o00A152l3L8Qna39o; Sun, 20 Jul 2014 23:34:04 +0000\r
+Received: by odin.tremily.us (Postfix, from userid 1000)\r
+       id 0EF6E12AB0D1; Sun, 20 Jul 2014 16:34:02 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tremily.us; s=odin;\r
+       t=1405899243; bh=ZJ6FrWJErCCe/vlY8Il+/Fl01xBjSSh/r8JMqzRXmA0=;\r
+       h=Date:From:To:Cc:Subject:References:In-Reply-To;\r
+       b=hKW2UgH4d71DQFj5OpHxhu1TJj/gm/VWURKURX0rIinb8ourdnF7wMyvULiZrcSyV\r
+       pOg4BKmJVfvPXEE/1HIL4Ub3jCSgjeL/+65yD6L3bND+9MLMDSuEx/Ql56pEkDLbfx\r
+       7fOqnHyij/qL9lqCe+P5TCg13m4wEhFcdWXSISM4=\r
+Date: Sun, 20 Jul 2014 16:34:02 -0700\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3] nmbug: Translate to Python\r
+Message-ID: <20140720233402.GU8744@odin>\r
+References:\r
+ <84447a0ed48412e1587761d560d18cb5affd4f66.1405897133.git.wking@tremily.us>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; micalg=pgp-sha1;\r
+       protocol="application/pgp-signature"; boundary="EyuBRJR0MsVMWKTf"\r
+Content-Disposition: inline\r
+In-Reply-To:\r
+ <84447a0ed48412e1587761d560d18cb5affd4f66.1405897133.git.wking@tremily.us>\r
+OpenPGP: id=39A2F3FA2AB17E5D8764F388FC29BDCDF15F5BE8;\r
+       url=http://tremily.us/pubkey.txt\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20140121; t=1405899244;\r
+       bh=rMMuk6dSK2dYfTx0qDsnAgXQ0++7O8xqUZ6ednmkggM=;\r
+       h=Received:Received:Received:Date:From:To:Subject:Message-ID:\r
+       MIME-Version:Content-Type;\r
+       b=r0ssCPKZlKPZojh6cjNQT4k38WSUdOo0cf1YkDDV2MeuBrkEUFPOm7RYsDNOLgmJI\r
+       1UEH+bNRwu/JilIEYSN9S4H88/fZTWM9kGUQoueos3IwF6v/dUWpNQ4bM4MMljcDjk\r
+       6ssJgyCFXGMxla1T/YIpS9cwLwPniOxbcEclcJEhvoMiueCiSwkVJ5O7VNBECW70gt\r
+       kwQjjRmd9otGchkwVuZdpvU1snU0+VuXHAoXfewDLC8Hhx0CZ9hK3MS4iKYz9S2XUV\r
+       Bv8Ua1ZZq7iMHNVCNp6xTAhWFIIumohvObRwjy2pgImhGV3nUyNCA7IIWdSt4XGxMY\r
+       ev7OGViclFWaQ==\r
+Cc: David Bremner <bremner@debian.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 20 Jul 2014 23:34:09 -0000\r
+\r
+\r
+--EyuBRJR0MsVMWKTf\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Sun, Jul 20, 2014 at 03:59:49PM -0700, W. Trevor King wrote:\r
+> +def pull(repository=3DNone, refspecs=3DNone):\r
+> +    """\r
+> +    Pull (merge) remote repository changes to notmuch.\r
+> +\r
+> +    'pull' is equivalent to 'fetch' followed by 'merge'.  We use the\r
+> +    Git-configured repository for your current branch\r
+> +    (branch.<name>.repository, likely 'origin', and\r
+> +    branch.<name>.merge, likely 'master').\r
+> +    """\r
+> +    _insist_committed()\r
+> +    if refspecs and not repository:\r
+> +        repository =3D _get_remote()\r
+> +    args =3D ['pull']\r
+> +    if repository:\r
+> +        args.append(repository)\r
+> +    if refspecs:\r
+> +        args.extend(refspecs)\r
+> +    with _tempfile.TemporaryDirectory(prefix=3D'nmbug-merge.') as workdi=\r
+r:\r
+> +        _git(args=3Dargs, additional_env=3D{'GIT_WORK_TREE': workdir}, w=\r
+ait=3DTrue)\r
+> +    checkout()\r
+\r
+The TemporaryDirectory prefix should probably be 'nmbug-pull.'.\r
+Queued for v4.\r
+\r
+> +def log(args=3D()):\r
+> +    """\r
+> +    A simple wrapper for 'git log'.\r
+> +\r
+> +    After running 'nmbug fetch', you can inspect the changes with\r
+> +    'nmbug log HEAD..@{upstream}'.\r
+> +    """\r
+> +    # we don't want output trapping here, because we want the pager.\r
+> +    args =3D ['git', '--git-dir', NMBGIT, 'log', '--name-status'] + list=\r
+(args)\r
+> +    _LOG.debug('exec {args}'.format(args=3Dargs))\r
+> +    _os.execvp('git', args)\r
+\r
+I don't exec any other commands.  Maybe we want '_git(args=3Dargs,\r
+wait=3DTrue)' here (with the appropriate args adjustments)?\r
+\r
+> +def _diff_index(index, filter):\r
+> +    """Get an {id: {tag, ...}} dict for a given filter.\r
+> +\r
+> +    For example, use 'A' to find added tags, and 'D' to find deleted tag=\r
+s.\r
+> +    """\r
+\r
+I'll shift the summary onto the next line here to match the pattern\r
+set by the command functions (e.g. archive()).  They *need* the\r
+summary to be on the line after the opening triple-quote to support\r
+the textwrap.dedent() help used for the argument parser.\r
+\r
+There were also a few docstrings missing the trailing period\r
+recommended by PEP 257 [1] (for _hex_quote, get_tags, _read_tree,\r
+fetch, _index_tags, and _unpack_diff_lines).  I'll add those periods\r
+in v4.\r
+\r
+Cheers,\r
+Trevor\r
+\r
+[1]: http://legacy.python.org/dev/peps/pep-0257/#one-line-docstrings\r
+\r
+--=20\r
+This email may be signed or encrypted with GnuPG (http://www.gnupg.org).\r
+For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy\r
+\r
+--EyuBRJR0MsVMWKTf\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+Content-Description: OpenPGP digital signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v2\r
+\r
+iQIcBAEBAgAGBQJTzFHoAAoJEG8/JgBt8ol8ojwQANRlzEOwwEk/7JDlujBTlkAI\r
+KvNZOgFOukk+znjPd2ui+cLKvvsdx+Ph2NRPPOLNL6tXVgYfNOVre4IuHmH/VSPt\r
+eQLR4jHS5TN46NsjbuqyvXY+O0mJ4h8HsXG50iPoS4WZ6hPCUMbWmtgMbkJ0APDQ\r
+uIVjsvoTs1QYjZsiERUOCwcwiFk/kiHxWuRAe5jfwSgtCcPiSXVv4Zx2g9MxS1tQ\r
+X+PU0wDRtmeI4Kj6z7jPe3uexb/775zwhfZj2dVBS/+rrMwZEGSJ6xRTQDTOZp/O\r
+RNSBjJLdiEeSOKDSLvo2p1syLp86o89W0FZoecqHsLiDUEbHCi0zk7zXmJAKyXno\r
+NsAxferOd8Tg70VCJHzqi7UqP3/T3S6PYQJnjZq+bJrTwzzonKYJmZqvuClvK/fn\r
+XEiioAR55ELxfLU5Cm9vOjci7l3TIhdH9OCvEULk7+tUc3zNJPk2Wv/wHF9nq63f\r
+wAoEfELG1+c4KRVXnB9u3EtjSy9OhATz60hZzDKD+8NggJf1N6EuCjGHPS5uY4Gu\r
+YCSogMpYboy18WFHFJlOjgdc/P/MU/NuzsBPo2VZ1Jn4UWdpPs3egrRD6uRJDZ6i\r
+8GUcoHMtVx3U9U3Ba6OcMSMuHfBDFKFKY0KfeM+gRklJuTQH64Kd31z/kB98ULVq\r
+ZdokQXzxf7hlFDeBvEZG\r
+=ZCO6\r
+-----END PGP SIGNATURE-----\r
+\r
+--EyuBRJR0MsVMWKTf--\r