view tests/crashgetbundler.py @ 32451:bce5ebe72859

bookmarks: warn about bookmark names that unambiguously resolve to a node (BC) I just burned myself on this today because I left out the -r in my `hg bookmark` command, which then left me confused because I didn't notice the bookmark I created in the wrong place that was silently shadowing the revision I was trying to check out. Let's warn the user. This patch only enforces the check on bookmark names 4 characters long or longer. We can tweak that if we'd like, I selected that since that's the fewest characters shortest will use in the templater output. A previous version of this patch rejected such bookmarks. It was proposed during review (and I agree) that the behavior change for a bookmark named "cafe" or similar as history accumulated was a little too weird, but that the warning definitely has merit.
author Augie Fackler <augie@google.com>
date Mon, 22 May 2017 19:18:12 -0400
parents f3807a135e43
children 2372284d9457
line wrap: on
line source

from __future__ import absolute_import

from mercurial.i18n import _
from mercurial import (
        changegroup,
        error,
        extensions
    )

def abort(orig, *args, **kwargs):
    raise error.Abort(_('this is an exercise'))

def uisetup(ui):
    extensions.wrapfunction(changegroup, 'getbundler', abort)