Submitter | Jun Wu |
---|---|
Date | March 16, 2017, 9:57 p.m. |
Message ID | <8f87b407da24ee802e27.1489701422@localhost.localdomain> |
Download | mbox | patch |
Permalink | /patch/19411/ |
State | Accepted |
Headers | show |
Comments
On Thu, Mar 16, 2017 at 2:57 PM, Jun Wu <quark@fb.com> wrote: > # HG changeset patch > # User Jun Wu <quark@fb.com> > # Date 1489700434 25200 > # Thu Mar 16 14:40:34 2017 -0700 > # Node ID 8f87b407da24ee802e271f517dbc96ad32f21779 > # Parent 8b086a28d1b605d6c0726d77c21f8d13188691fa > # Available At https://bitbucket.org/quark-zju/hg-draft > # hg pull https://bitbucket.org/quark-zju/hg-draft -r 8f87b407da24 > rebase: get rid of ui.backupconfig > > diff --git a/hgext/rebase.py b/hgext/rebase.py > --- a/hgext/rebase.py > +++ b/hgext/rebase.py > @@ -851,8 +851,7 @@ def concludenode(repo, rev, p1, p2, comm > extrafn(ctx, extra) > > - backup = repo.ui.backupconfig('phases', 'new-commit') > - try: > - targetphase = max(ctx.phase(), phases.draft) > - repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') > + targetphase = max(ctx.phase(), phases.draft) > + override = {('phases', 'new-commit'): targetphase} > + with repo.ui.configoverride(override, 'rebase'): > if keepbranch: > repo.ui.setconfig('ui', 'allowemptycommit', True) I *think* this is unrelated to this patch, but should this line also be restored (i.e. part of the overrides)? > @@ -862,6 +861,4 @@ def concludenode(repo, rev, p1, p2, comm > newnode = repo.commit(text=commitmsg, user=ctx.user(), > date=date, extra=extra, editor=editor) > - finally: > - repo.ui.restoreconfig(backup) > > repo.dirstate.setbranch(repo[newnode].branch()) > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Excerpts from Martin von Zweigbergk's message of 2017-03-16 17:14:33 -0700: > On Thu, Mar 16, 2017 at 2:57 PM, Jun Wu <quark@fb.com> wrote: > > # HG changeset patch > > # User Jun Wu <quark@fb.com> > > # Date 1489700434 25200 > > # Thu Mar 16 14:40:34 2017 -0700 > > # Node ID 8f87b407da24ee802e271f517dbc96ad32f21779 > > # Parent 8b086a28d1b605d6c0726d77c21f8d13188691fa > > # Available At https://bitbucket.org/quark-zju/hg-draft > > # hg pull https://bitbucket.org/quark-zju/hg-draft -r 8f87b407da24 > > rebase: get rid of ui.backupconfig > > > > diff --git a/hgext/rebase.py b/hgext/rebase.py > > --- a/hgext/rebase.py > > +++ b/hgext/rebase.py > > @@ -851,8 +851,7 @@ def concludenode(repo, rev, p1, p2, comm > > extrafn(ctx, extra) > > > > - backup = repo.ui.backupconfig('phases', 'new-commit') > > - try: > > - targetphase = max(ctx.phase(), phases.draft) > > - repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') > > + targetphase = max(ctx.phase(), phases.draft) > > + override = {('phases', 'new-commit'): targetphase} > > + with repo.ui.configoverride(override, 'rebase'): > > if keepbranch: > > repo.ui.setconfig('ui', 'allowemptycommit', True) > > I *think* this is unrelated to this patch, but should this line also > be restored (i.e. part of the overrides)? Good catch. I think it should. It looks like a bug. > > > @@ -862,6 +861,4 @@ def concludenode(repo, rev, p1, p2, comm > > newnode = repo.commit(text=commitmsg, user=ctx.user(), > > date=date, extra=extra, editor=editor) > > - finally: > > - repo.ui.restoreconfig(backup) > > > > repo.dirstate.setbranch(repo[newnode].branch()) > > _______________________________________________ > > Mercurial-devel mailing list > > Mercurial-devel@mercurial-scm.org > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Patch
diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -851,8 +851,7 @@ def concludenode(repo, rev, p1, p2, comm extrafn(ctx, extra) - backup = repo.ui.backupconfig('phases', 'new-commit') - try: - targetphase = max(ctx.phase(), phases.draft) - repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase') + targetphase = max(ctx.phase(), phases.draft) + override = {('phases', 'new-commit'): targetphase} + with repo.ui.configoverride(override, 'rebase'): if keepbranch: repo.ui.setconfig('ui', 'allowemptycommit', True) @@ -862,6 +861,4 @@ def concludenode(repo, rev, p1, p2, comm newnode = repo.commit(text=commitmsg, user=ctx.user(), date=date, extra=extra, editor=editor) - finally: - repo.ui.restoreconfig(backup) repo.dirstate.setbranch(repo[newnode].branch())