zsh-workers
 help / color / mirror / code / Atom feed
From: Seth House <seth@eseth.com>
To: zsh-workers@zsh.org
Subject: Re: PATCH: vcs_info Mercurial backend branch name display
Date: Mon, 24 May 2010 17:55:35 +0000 (UTC)	[thread overview]
Message-ID: <loom.20100524T194317-568@post.gmane.org> (raw)
In-Reply-To: <m3iq6d2qqz.fsf@klanderman.net>

Greg Klanderman <gak <at> klanderman.net> writes:
> Looks like you have a spurious 'if' there..

No, that is correct. It initially tries to obtain the branch name by
invoking hg (line 54) -- only if the user has opted to allow invoking
hg. If it still doesn't know the branch name and a file containing the
name is readable, it will pull it from the file (line 59). Finally, if
we still don't know the branch it defaults to "default" (line 64).

It could be refactored to the following if you feel this is more
readable:

# If the user doesn't opt to invoke hg we can still get the current branch
if [[ -z ${r_branch} ]] ; then
    if [[ -r ${branchfile} ]] ; then
        r_branch=$(< ${branchfile})
    else
        # If we still don't know the branch it's safe to assume default
        r_branch="default"
    fi
fi


  reply	other threads:[~2010-05-24 17:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-24 15:48 Seth House
2010-05-24 16:45 ` PATCH: =?utf-8?b?dmNzX2luZm8=?= " Greg Klanderman
2010-05-24 17:55   ` Seth House [this message]
2010-05-24 18:30   ` PATCH: vcs_info " Seth House

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20100524T194317-568@post.gmane.org \
    --to=seth@eseth.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).