Patchwork [1,of,4] rebase: rename variable "keepbranch" to "keepbranchchange"

login
register
mail settings
Submitter Manuel Jacob
Date July 1, 2020, 9:39 p.m.
Message ID <ee204ca1c4d68d004d4f.1593639540@tmp>
Download mbox | patch
Permalink /patch/46606/
State New
Headers show

Comments

Manuel Jacob - July 1, 2020, 9:39 p.m.
# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1593579865 -7200
#      Wed Jul 01 07:04:25 2020 +0200
# Node ID ee204ca1c4d68d004d4f90b5fc9edf66c9db6bae
# Parent  24b1a8eb73aa8203c94f0a168cb7ec27ea26cef9
# EXP-Topic keepbranchchange
rebase: rename variable "keepbranch" to "keepbranchchange"

When looking at the use of the "keepbranch" variable, I was confused because it
sounded like the variable is True iff --keepbranches is passed. Only after
looking at the variable definition, I realized that the variable is True iff
the new changeset will change the branch name. The new name "keepbranchchange"
clarifies that.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -529,10 +529,12 @@ 
         extra = {b'rebase_source': ctx.hex()}
         for c in self.extrafns:
             c(ctx, extra)
-        keepbranch = self.keepbranchesf and repo[p1].branch() != ctx.branch()
+        keepbranchchange = (
+            self.keepbranchesf and repo[p1].branch() != ctx.branch()
+        )
         destphase = max(ctx.phase(), phases.draft)
         overrides = {(b'phases', b'new-commit'): destphase}
-        if keepbranch:
+        if keepbranchchange:
             overrides[(b'ui', b'allowemptycommit')] = True
         with repo.ui.configoverride(overrides, b'rebase'):
             if self.inmemory: