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

Re: [PATCHv1 4/6] git-p4: create helper function importRevisions()

From
Luke Diamand <luke@diamand.org>
Date
Jan 29, 2020, 18:36 UTC
Message-ID
<CAE5ih785Nv584RU-xEQSqrcuGiUU2zmjRrJ=ghtFX7_7EuiDnw@mail.gmail.com>
In-Reply-To
<CAPig+cRx3hG64nuDie69o_gdX39F=sR6D8LyA7J1rCErgu0aMA@mail.gmail.com>
On Wed, 29 Jan 2020 at 15:00, Eric Sunshine <sunshine@sunshineco.com> wrote:
Show 20 quoted lines
>
> On Wed, Jan 29, 2020 at 6:13 AM Luke Diamand <luke@diamand.org> wrote:
> > This makes it easier to try/catch around this block of code to ensure
> > cleanup following p4 failures is handled properly.
> >
> > Signed-off-by: Luke Diamand <luke@diamand.org>
> > ---
> > diff --git a/git-p4.py b/git-p4.py
> > @@ -3555,6 +3555,73 @@ def importHeadRevision(self, revision):
> > +    def importRevisions(self, args, branch_arg_given):
> > +        if len(self.changesFile) > 0:
> > +            output = open(self.changesFile).readlines()
>
> Not a new problem (since this code is merely being relocated), but is
> this leaking the open file? Should there be an accompanying close()
> somewhere?
>
>     f = open(self.changesFile)
>     output = f.readlines()
>     close(f)
with open(self.changesFile) as f:
    output = f.readlines()
I can put something like that in either as a followup, or the next re-roll.
>
> or something.
Previous: Eric SunshineNext: Junio C Hamano
Message 9 of 13 in “[PATCHv1 0/6] git-p4: wait() for child processes better”
  1. Luke DiamandJan 29, 2020
  2. 1/6 git-p4: make closeStreams() idempotentLuke Diamand, Jan 29, 2020
  3. 2/6 git-p4: add P4CommandException to report errors talking to PerforceLuke Diamand, Jan 29, 2020
  4. 3/6 git-p4: disable some pylint warnings, to get pylint output to something manageableLuke Diamand, Jan 29, 2020
  5. 4/6 git-p4: create helper function importRevisions()Luke Diamand, Jan 29, 2020
  6. 5/6 git-p4: cleanup better on error exitLuke Diamand, Jan 29, 2020
  7. 6/6 git-p4: check for access to remote host earlierLuke Diamand, Jan 29, 2020
  8. Eric SunshineJan 29, 2020
  9. Luke DiamandJan 29, 2020
  10. Junio C HamanoJan 30, 2020
  11. Luke DiamandJan 31, 2020
  12. Johannes SchindelinJan 30, 2020
  13. Luke DiamandJan 30, 2020

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.