From: "W. Trevor King" <wking@tremily.us>
To: notmuch@notmuchmail.org
Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,
David Bremner <david@tethera.net>,
"W. Trevor King" <wking@tremily.us>
Subject: [PATCH 3/4] nmbug: Auto-checkout in clone if it wouldn't clobber
Date: Tue, 10 Oct 2017 15:49:51 -0700 [thread overview]
Message-ID: <342f60354749e779c30725ad16060b3f1ec2ed38.1507675236.git.wking@tremily.us> (raw)
In-Reply-To: <cover.1507675236.git.wking@tremily.us>
In-Reply-To: <cover.1507675236.git.wking@tremily.us>
We currently auto-checkout after pull and merge to make those more
convenient. They're guarded against data-loss with a leading
_insist_committed(). This commit adds the same convenience to clone,
since in most cases users will have no NMBPREFIX-prefixed tags in
their database when they clone. Users that *do* have
NMBPREFIX-prefixed tags will get a warning (and I've bumped the
default log level to warning so folks who don't set --log-level will
see it) like:
$ nmbug clone http://nmbug.notmuchmail.org/git/nmbug-tags.git
Cloning into '/tmp/nmbug-clone.g9dvd0tv'...
Checking connectivity: 16674, done.
Branch config set up to track remote branch config from origin.
Not checking out to avoid clobbering existing tags: notmuch::0.25, ...
---
devel/nmbug/nmbug | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index c0e7c3c6..0cd91148 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -54,7 +54,7 @@ except ImportError: # Python 2
__version__ = '0.2'
_LOG = _logging.getLogger('nmbug')
-_LOG.setLevel(_logging.ERROR)
+_LOG.setLevel(_logging.WARNING)
_LOG.addHandler(_logging.StreamHandler())
NMBGIT = _os.path.expanduser(
@@ -311,6 +311,13 @@ def clone(repository):
_git(args=['config', '--unset', 'core.worktree'], wait=True, expect=(0, 5))
_git(args=['config', 'core.bare', 'true'], wait=True)
_git(args=['branch', 'config', 'origin/config'], wait=True)
+ existing_tags = get_tags()
+ if existing_tags:
+ _LOG.warning(
+ 'Not checking out to avoid clobbering existing tags: {}'.format(
+ ', '.join(existing_tags)))
+ else:
+ checkout()
def _is_committed(status):
--
2.13.6
next prev parent reply other threads:[~2017-10-10 22:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 22:49 [PATCH 0/3] nmbug: W. Trevor King
2017-10-10 22:49 ` [PATCH 1/4] nmbug: Respect 'expect' in _spawn(..., wait=True) W. Trevor King
2017-10-10 22:49 ` [PATCH 2/4] nmbug: Accept failures to unset core.worktree in clone W. Trevor King
2017-10-10 22:49 ` W. Trevor King [this message]
2017-12-11 13:10 ` [PATCH 3/4] nmbug: Auto-checkout in clone if it wouldn't clobber David Bremner
2017-12-11 17:47 ` W. Trevor King
2017-12-11 20:51 ` David Bremner
2017-10-10 23:15 ` [PATCH 0/3] nmbug: Daniel Kahn Gillmor
2017-10-14 12:51 ` Jani Nikula
2017-10-16 17:05 ` [PATCH 0/3] nmbug: clone core.worktree and auto-checkout (was: [PATCH 0/3] nmbug:) W. Trevor King
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=342f60354749e779c30725ad16060b3f1ec2ed38.1507675236.git.wking@tremily.us \
--to=wking@tremily.us \
--cc=david@tethera.net \
--cc=dkg@fifthhorseman.net \
--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).