<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Oct 17, 2012, at 2:15 PM, Adrian Buehlmann wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>On 2012-10-17 19:21, Kevin Bullock wrote:<br><blockquote type="cite"># HG changeset patch<br></blockquote><blockquote type="cite"># User Kevin Bullock <<a href="mailto:kbullock@ringworld.org">kbullock@ringworld.org</a>><br></blockquote><blockquote type="cite"># Date 1350494123 18000<br></blockquote><blockquote type="cite"># Node ID 4dc03350b9e8e0e6e25e3796465d0d65463d16da<br></blockquote><blockquote type="cite"># Parent  9469bbd2f3a1e39c086383f3fe1543b801991b6f<br></blockquote><blockquote type="cite">bookmarks: simplify code<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Remove some unnecessary return statements and collect some checks into<br></blockquote><blockquote type="cite">one place. As requested by Thomas Arendsen Hein <<a href="mailto:thomas@intevation.de">thomas@intevation.de</a>>.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">diff --git a/mercurial/commands.py b/mercurial/commands.py<br></blockquote><blockquote type="cite">--- a/mercurial/commands.py<br></blockquote><blockquote type="cite">+++ b/mercurial/commands.py<br></blockquote><blockquote type="cite">@@ -813,19 +813,18 @@ def bookmark(ui, repo, mark=None, rev=No<br></blockquote><blockquote type="cite">         raise util.Abort(_("--rev is incompatible with --delete"))<br></blockquote><blockquote type="cite">     if rename and rev:<br></blockquote><blockquote type="cite">         raise util.Abort(_("--rev is incompatible with --rename"))<br></blockquote><blockquote type="cite">+    if mark is None and (delete or rev):<br></blockquote><blockquote type="cite">+        raise util.Abort(_("bookmark name required"))<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">     if delete:<br></blockquote><blockquote type="cite">-        if mark is None:<br></blockquote><blockquote type="cite">-            raise util.Abort(_("bookmark name required"))<br></blockquote><blockquote type="cite">         if mark not in marks:<br></blockquote><blockquote type="cite">             raise util.Abort(_("bookmark '%s' does not exist") % mark)<br></blockquote><blockquote type="cite">         if mark == repo._bookmarkcurrent:<br></blockquote><blockquote type="cite">             bookmarks.setcurrent(repo, None)<br></blockquote><blockquote type="cite">         del marks[mark]<br></blockquote><blockquote type="cite">         bookmarks.write(repo)<br></blockquote><blockquote type="cite">-        return<br></blockquote><blockquote type="cite">-<br></blockquote><blockquote type="cite">-    if rename:<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+    elif rename:<br></blockquote><blockquote type="cite">         if mark is None:<br></blockquote><blockquote type="cite">             raise util.Abort(_("new bookmark name required"))<br></blockquote><blockquote type="cite">         mark = checkformat(mark)<br></blockquote><blockquote type="cite">@@ -837,9 +836,8 @@ def bookmark(ui, repo, mark=None, rev=No<br></blockquote><blockquote type="cite">             bookmarks.setcurrent(repo, mark)<br></blockquote><blockquote type="cite">         del marks[rename]<br></blockquote><blockquote type="cite">         bookmarks.write(repo)<br></blockquote><blockquote type="cite">-        return<br></blockquote><blockquote type="cite">-<br></blockquote><blockquote type="cite">-    if mark is not None:<br></blockquote><blockquote type="cite">+<br></blockquote><blockquote type="cite">+    elif mark is not None:<br></blockquote><blockquote type="cite">         mark = checkformat(mark)<br></blockquote><blockquote type="cite">         if inactive and mark == repo._bookmarkcurrent:<br></blockquote><blockquote type="cite">             bookmarks.setcurrent(repo, None)<br></blockquote><blockquote type="cite">@@ -854,17 +852,14 @@ def bookmark(ui, repo, mark=None, rev=No<br></blockquote><blockquote type="cite">         bookmarks.write(repo)<br></blockquote><blockquote type="cite">         return<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-    if mark is None:<br></blockquote><blockquote type="cite">-        if rev:<br></blockquote><blockquote type="cite">-            raise util.Abort(_("bookmark name required"))<br></blockquote><blockquote type="cite">+    else: # mark is None<br></blockquote><br>IMHO, this is an example of a bad comment. Don't describe in different<br>words what the code is already doing. The comment may be a lie (perhaps<br>not today, but in the future).<br></div></blockquote><div><br></div><div>If it were anywhere except on a bare 'else' that's a goodly distance removed from the other corresponding clauses, I'd agree. If the comment becomes a lie, then the code within the 'else' clause also becomes invalid. That being said, the 'else' isn't *so* far from the prior 'elif' that I'd be upset if the comment disappeared.</div><br></div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="orphans: 2; text-align: -webkit-auto; text-indent: 0px; widows: 2; -webkit-text-decorations-in-effect: none; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和</div><div style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Kevin R. Bullock<br></div></span></span>
</div>
<br></body></html>