<div dir="ltr">On Mon, Oct 8, 2012 at 11:48 AM, Thomas Arendsen Hein <<a href="mailto:thomas@intevation.de">thomas@intevation.de</a>> wrote:<br>><br>> * Pierre-Yves David <<a href="mailto:pierre-yves.david@logilab.fr">pierre-yves.david@logilab.fr</a>> [20121008 10:58]:<br>
> > On Mon, Oct 08, 2012 at 12:24:08AM +0200, Idan Kamara wrote:<br>> > > # HG changeset patch<br>> > > # User Idan Kamara <<a href="mailto:idankk86@gmail.com">idankk86@gmail.com</a>><br>> > > # Date 1349648370 -7200<br>
> > > # Branch stable<br>> > > # Node ID 67f7906491d804423d16cb151e7add017ca1138d<br>> > > # Parent  6647ac9b9044023b4947e890b07d6dfef30ea9b3<br>> > > bookmarks: deactivate current bookmark if no name is given<br>
> > ><br>> > > f57f891eb88e added this help text to hg bookmark:<br>> > ><br>> > >   If no NAME is given, the current active bookmark will be marked<br>> > > inactive.<br>> > ><br>
> > > But that never actually seemed to be the case.<br>> > ><br>> > > diff --git a/mercurial/commands.py b/mercurial/commands.py<br>> > > --- a/mercurial/commands.py<br>> > > +++ b/mercurial/commands.py<br>
> > > @@ -847,6 +847,12 @@<br>> > >          if len(marks) == 0:<br>> > >              ui.status(_("no bookmarks set\n"))<br>> > >          else:<br>> > > +            if inactive:<br>
> > > +                if not repo._bookmarkcurrent:<br>> > > +                    raise util.Abort(_("no active bookmark to<br>> > > deactivate"))<br>> > > +                bookmarks.setcurrent(repo, None)<br>
> > > +                return<br>> > > +<br>> ><br>> > I feel like the use of Abort here is a bit abusive.<br>> > What about a simple ui.write_err call + a return <some-error> code.<br>
><br>> Good point, I would even suggest ui.status and no error code, so<br>> scripts can use "hg bookmark -i -q" to deactivate a possibly active<br>> bookmark without printing a message before doing things.<br>
><br>> The result is that no bookmark is active, so no need to abort or set<br>> an error code.<br><div><br></div><div>Yeah I wasn't sure it constitutes as an error but couldn't</div><div>remember if there's some thumb rule for this based on how</div>
<div>other commands behave. If no one thinks otherwise, I'll resend.</div><div><br></div><div>But regarding the script use case, it's just as easy to check</div><div>the existence of '.hg/bookmarks.current' and only then call hg.</div>
</div>