[PATCH] histedit: improve documentation and behaviour of dates (issue4820)
Augie Fackler
raf at durin42.com
Mon Feb 20 00:06:54 EST 2017
> On Feb 20, 2017, at 12:00 AM, timeless <timeless at gmail.com> wrote:
>
> Fwiw, recently someone identified that if's are roughly as expensive
> as method calls.
>
> I /think/ that means it'd be better for:
> + if self.firstdate():
> + commitopts['date'] = ctx.date()
> + else:
> + commitopts['date'] = max(ctx.date(), oldctx.date())
>
> to be managed as:
>
> def date(self, ctx, oldctx):
> return ctx.date()
>
> def date(self, ctx, oldctx):
> return max(ctx.date(), oldctx.date())
Maybe. I’d do whatever’s architecturally more readable without concern for performance here, since it’s histedit and we’ll be doing this computation ~once a commit. The overhead of an extra function call is minor compared to the disk IO that implies.
AF
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list