git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/4] git-p4: importing labels should cope with missing owner

From
PWPete Wyckoff <pw@padd.com>
Date
Nov 7, 2011, 22:34 UTC
Message-ID
<20111107223423.GA19362@arf.padd.com>
In-Reply-To
<1320701799-26071-4-git-send-email-luke@diamand.org>
luke@diamand.org wrote on Mon, 07 Nov 2011 21:36 +0000:
> In p4, the Owner field is optional. If it is missing,
> construct something sensible rather than crashing.
Nice.  One question:
Show 9 quoted lines
>                      owner = labelDetails["Owner"]
>                      tagger = ""
> -                    if author in self.users:
> +                    if not owner:
> +                        tagger = "%s <a@b> %s %s" % (self.p4UserId(), epoch, self.tz)
> +                    elif author in self.users:
>                          tagger = "%s %s %s" % (self.users[owner], epoch, self.tz)
>                      else:
>                          tagger = "%s <a@b> %s %s" % (owner, epoch, self.tz)

We trust p4 always returns a key "Owner", but it could be an empty string? I'm okay with that, if that's how it works.

Should be "author in self.users"? I'm looking at the creation of the committer string above, and guessing that we try to use owner, and if that doesn't exist, try to use author just like as above, so something like:

    if owner:
	if owner in self.users:
	    email = self.users[owner]
	else:
	    email = "%s <a@b>" % owner
    else:
	if author in self.users:
	    email = self.users[author]
	else:
	    email = "%s <a@b>" % author
I could misunderstand this.

Maybe that lookup in self.users[] and <a@b> default wants to have a function since it will be repeated three times now.

Ack to the whole series.
		-- Pete
Previous: Luke DiamandNext: Luke Diamand
Message 5 of 6 in “git-p4: small fixes to branches and labels; tests”
  1. 0/4 git-p4: small fixes to branches and labels; testsLuke Diamand, Nov 7, 2011
  2. 1/4 git-p4: handle p4 branches and labels containing shell charsLuke Diamand, Nov 7, 2011
  3. 2/4 git-p4: cope with labels with empty descriptionsLuke Diamand, Nov 7, 2011
  4. 3/4 git-p4: importing labels should cope with missing ownerLuke Diamand, Nov 7, 2011
  5. Pete WyckoffNov 7, 2011
  6. 4/4 git-p4: add test for p4 labelsLuke Diamand, Nov 7, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.