mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 09:24:54 +01:00
nmbug: Auto-checkout in clone if it wouldn't clobber
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, ...
This commit is contained in:
parent
0a1558471f
commit
7ef3b65376
1 changed files with 8 additions and 1 deletions
|
@ -54,7 +54,7 @@ except ImportError: # Python 2
|
||||||
__version__ = '0.2'
|
__version__ = '0.2'
|
||||||
|
|
||||||
_LOG = _logging.getLogger('nmbug')
|
_LOG = _logging.getLogger('nmbug')
|
||||||
_LOG.setLevel(_logging.ERROR)
|
_LOG.setLevel(_logging.WARNING)
|
||||||
_LOG.addHandler(_logging.StreamHandler())
|
_LOG.addHandler(_logging.StreamHandler())
|
||||||
|
|
||||||
NMBGIT = _os.path.expanduser(
|
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', '--unset', 'core.worktree'], wait=True, expect=(0, 5))
|
||||||
_git(args=['config', 'core.bare', 'true'], wait=True)
|
_git(args=['config', 'core.bare', 'true'], wait=True)
|
||||||
_git(args=['branch', 'config', 'origin/config'], 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):
|
def _is_committed(status):
|
||||||
|
|
Loading…
Reference in a new issue