unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: "W. Trevor King" <wking@tremily.us>
To: notmuch@notmuchmail.org
Cc: David Bremner <bremner@debian.org>
Subject: Re: [PATCH v3] nmbug: Translate to Python
Date: Sun, 20 Jul 2014 16:34:02 -0700	[thread overview]
Message-ID: <20140720233402.GU8744@odin> (raw)
In-Reply-To: <84447a0ed48412e1587761d560d18cb5affd4f66.1405897133.git.wking@tremily.us>

[-- Attachment #1: Type: text/plain, Size: 2420 bytes --]

On Sun, Jul 20, 2014 at 03:59:49PM -0700, W. Trevor King wrote:
> +def pull(repository=None, refspecs=None):
> +    """
> +    Pull (merge) remote repository changes to notmuch.
> +
> +    'pull' is equivalent to 'fetch' followed by 'merge'.  We use the
> +    Git-configured repository for your current branch
> +    (branch.<name>.repository, likely 'origin', and
> +    branch.<name>.merge, likely 'master').
> +    """
> +    _insist_committed()
> +    if refspecs and not repository:
> +        repository = _get_remote()
> +    args = ['pull']
> +    if repository:
> +        args.append(repository)
> +    if refspecs:
> +        args.extend(refspecs)
> +    with _tempfile.TemporaryDirectory(prefix='nmbug-merge.') as workdir:
> +        _git(args=args, additional_env={'GIT_WORK_TREE': workdir}, wait=True)
> +    checkout()

The TemporaryDirectory prefix should probably be 'nmbug-pull.'.
Queued for v4.

> +def log(args=()):
> +    """
> +    A simple wrapper for 'git log'.
> +
> +    After running 'nmbug fetch', you can inspect the changes with
> +    'nmbug log HEAD..@{upstream}'.
> +    """
> +    # we don't want output trapping here, because we want the pager.
> +    args = ['git', '--git-dir', NMBGIT, 'log', '--name-status'] + list(args)
> +    _LOG.debug('exec {args}'.format(args=args))
> +    _os.execvp('git', args)

I don't exec any other commands.  Maybe we want '_git(args=args,
wait=True)' here (with the appropriate args adjustments)?

> +def _diff_index(index, filter):
> +    """Get an {id: {tag, ...}} dict for a given filter.
> +
> +    For example, use 'A' to find added tags, and 'D' to find deleted tags.
> +    """

I'll shift the summary onto the next line here to match the pattern
set by the command functions (e.g. archive()).  They *need* the
summary to be on the line after the opening triple-quote to support
the textwrap.dedent() help used for the argument parser.

There were also a few docstrings missing the trailing period
recommended by PEP 257 [1] (for _hex_quote, get_tags, _read_tree,
fetch, _index_tags, and _unpack_diff_lines).  I'll add those periods
in v4.

Cheers,
Trevor

[1]: http://legacy.python.org/dev/peps/pep-0257/#one-line-docstrings

-- 
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-07-20 23:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-20 22:59 [PATCH v3] nmbug: Translate to Python W. Trevor King
2014-07-20 23:11 ` W. Trevor King
2014-07-20 23:34 ` W. Trevor King [this message]
2014-07-21  0:21 ` W. Trevor King
2014-08-05  0:14 ` David Bremner
2014-08-06  1:16   ` David Bremner
2014-08-06 23:28     ` W. Trevor King
2014-08-24 20:02       ` David Bremner
2014-08-06  1:24   ` David Bremner
2014-08-06 23:38     ` W. Trevor King
2014-08-24 20:07       ` David Bremner
2014-08-06 23:21   ` W. Trevor King
2014-08-24 20:39     ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140720233402.GU8744@odin \
    --to=wking@tremily.us \
    --cc=bremner@debian.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).