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 341B26DE0FE6 for ; Tue, 10 Oct 2017 15:56:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.212 X-Spam-Level: X-Spam-Status: No, score=-0.212 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.211, SPF_PASS=-0.001] 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 3UihS_jEZ1Dn for ; Tue, 10 Oct 2017 15:56:14 -0700 (PDT) Received: from resqmta-po-11v.sys.comcast.net (resqmta-po-11v.sys.comcast.net [96.114.154.170]) by arlo.cworth.org (Postfix) with ESMTPS id 7C9F36DE0C67 for ; Tue, 10 Oct 2017 15:56:14 -0700 (PDT) Received: from resomta-po-13v.sys.comcast.net ([96.114.154.237]) by resqmta-po-11v.sys.comcast.net with ESMTP id 23J2eOrfTEkUB23JjeBw9n; Tue, 10 Oct 2017 22:48:03 +0000 Received: from mail.tremily.us ([IPv6:2001:558:600a:ce:480b:3bd8:dc5a:403a]) by resomta-po-13v.sys.comcast.net with SMTP id 23Jheseljq4Ru23JiefQDL; Tue, 10 Oct 2017 22:48:03 +0000 Received: from ullr.tremily.us (ullr.tremily.us [192.168.10.7]) by mail.tremily.us (Postfix) with SMTP id 57F26F57AF4; Tue, 10 Oct 2017 15:48:26 -0700 (PDT) Received: (nullmailer pid 4994 invoked by uid 1000); Tue, 10 Oct 2017 22:49:55 -0000 From: "W. Trevor King" To: notmuch@notmuchmail.org Cc: Daniel Kahn Gillmor , David Bremner , "W. Trevor King" Subject: [PATCH 3/4] nmbug: Auto-checkout in clone if it wouldn't clobber Date: Tue, 10 Oct 2017 15:49:51 -0700 Message-Id: <342f60354749e779c30725ad16060b3f1ec2ed38.1507675236.git.wking@tremily.us> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: X-CMAE-Envelope: MS4wfCTvE7sveMPfn7rFhz5VOjXFcnnskSYpiJMblQD+lpEM2kVlxMxSxUUn+w9duUpQEmUwsj9ze3LGpavCkKWKWfhDClDlG4KTggeP8hoT/lOBjGeklueh h6W3If6p0o26p2OHiw5QX9MG3s/9I5Ox3/4MpylpNX5/0ILZuSjRaSRAGCNt5QyJ8l6R8ALUnrHkczONkGvyfu2Ovm4g1A7gQLw= X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Tue, 10 Oct 2017 22:56:15 -0000 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