Re: [PATCHv1 4/6] git-p4: create helper function importRevisions()
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jan 29, 2020, 15:00 UTC
- Message-ID
- <CAPig+cRx3hG64nuDie69o_gdX39F=sR6D8LyA7J1rCErgu0aMA@mail.gmail.com>
- In-Reply-To
- <20200129111246.12196-5-luke@diamand.org>
On Wed, Jan 29, 2020 at 6:13 AM Luke Diamand <luke@diamand.org> wrote:
Show 10 quoted lines
> 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)or something.