2019-11-01 23:24:22 +03:00
|
|
|
# Portions Copyright (c) Facebook, Inc. and its affiliates.
|
|
|
|
#
|
|
|
|
# This software may be used and distributed according to the terms of the
|
|
|
|
# GNU General Public License version 2.
|
|
|
|
|
2008-08-18 23:16:31 +04:00
|
|
|
# rebase.py - rebasing feature for mercurial
|
|
|
|
#
|
|
|
|
# Copyright 2008 Stefano Tortarolo <stefano.tortarolo at gmail dot com>
|
|
|
|
#
|
2009-04-26 03:08:54 +04:00
|
|
|
# This software may be used and distributed according to the terms of the
|
2010-01-20 07:20:08 +03:00
|
|
|
# GNU General Public License version 2 or any later version.
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"""command to move sets of revisions to a different ancestor
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2009-07-26 03:59:59 +04:00
|
|
|
This extension lets you rebase changesets in an existing Mercurial
|
|
|
|
repository.
|
2008-08-18 23:16:31 +04:00
|
|
|
|
|
|
|
For more information:
|
2015-09-30 23:43:49 +03:00
|
|
|
https://mercurial-scm.org/wiki/RebaseExtension
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"""
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2016-05-06 19:51:32 +03:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
|
|
import errno
|
|
|
|
import os
|
2016-05-14 08:03:12 +03:00
|
|
|
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial import (
|
2016-05-06 19:51:32 +03:00
|
|
|
bookmarks,
|
|
|
|
cmdutil,
|
|
|
|
commands,
|
|
|
|
copies,
|
|
|
|
destutil,
|
2016-11-22 05:27:12 +03:00
|
|
|
dirstateguard,
|
2016-05-06 19:51:32 +03:00
|
|
|
error,
|
|
|
|
extensions,
|
|
|
|
hg,
|
2018-09-21 03:06:51 +03:00
|
|
|
i18n,
|
2016-05-06 19:51:32 +03:00
|
|
|
lock,
|
2016-11-02 21:56:07 +03:00
|
|
|
merge as mergemod,
|
2016-11-22 05:32:39 +03:00
|
|
|
mergeutil,
|
2018-12-13 21:41:51 +03:00
|
|
|
mutation,
|
2016-05-06 19:51:32 +03:00
|
|
|
obsolete,
|
2017-06-27 02:36:20 +03:00
|
|
|
obsutil,
|
2016-05-06 19:51:32 +03:00
|
|
|
patch,
|
2019-03-26 05:22:16 +03:00
|
|
|
perftrace,
|
2016-05-06 19:51:32 +03:00
|
|
|
phases,
|
2018-03-21 23:49:39 +03:00
|
|
|
progress,
|
2017-10-22 21:34:47 +03:00
|
|
|
pycompat,
|
2016-05-06 19:51:32 +03:00
|
|
|
registrar,
|
|
|
|
repair,
|
|
|
|
revset,
|
2017-08-30 03:27:37 +03:00
|
|
|
revsetlang,
|
2016-05-06 19:51:32 +03:00
|
|
|
scmutil,
|
2017-02-19 12:16:09 +03:00
|
|
|
smartset,
|
2018-04-02 22:11:53 +03:00
|
|
|
templatefilters,
|
2016-05-06 19:51:32 +03:00
|
|
|
util,
|
2019-03-08 14:01:10 +03:00
|
|
|
visibility,
|
2016-05-06 19:51:32 +03:00
|
|
|
)
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial.i18n import _
|
|
|
|
from edenscm.mercurial.node import nullid, nullrev, short
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-05-06 19:51:32 +03:00
|
|
|
|
|
|
|
release = lock.release
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2015-10-14 00:17:15 +03:00
|
|
|
# The following constants are used throughout the rebase module. The ordering of
|
|
|
|
# their values must be maintained.
|
|
|
|
|
|
|
|
# Indicates that a revision needs to be rebased
|
2014-12-02 20:46:20 +03:00
|
|
|
revtodo = -1
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
revtodostr = "-1"
|
2017-07-09 06:38:34 +03:00
|
|
|
|
|
|
|
# legacy revstates no longer needed in current code
|
2017-07-10 22:18:32 +03:00
|
|
|
# -2: nullmerge, -3: revignored, -4: revprecursor, -5: revpruned
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
legacystates = {"-2", "-3", "-4", "-5"}
|
2010-02-06 12:51:50 +03:00
|
|
|
|
2011-05-12 19:09:56 +04:00
|
|
|
cmdtable = {}
|
2016-01-09 17:07:20 +03:00
|
|
|
command = registrar.command(cmdtable)
|
2016-08-23 18:26:08 +03:00
|
|
|
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
|
2015-04-28 23:44:37 +03:00
|
|
|
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
|
|
|
|
# be specifying the version(s) of Mercurial they are tested with, or
|
|
|
|
# leave the attribute unspecified.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
testedwith = "ships-with-hg-core"
|
|
|
|
|
|
|
|
colortable = {"rebase.manual.update": "yellow"}
|
2011-05-12 19:09:56 +04:00
|
|
|
|
2018-04-02 22:11:53 +03:00
|
|
|
|
2016-02-03 20:24:47 +03:00
|
|
|
def _savegraft(ctx, extra):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
s = ctx.extra().get("source", None)
|
2016-02-03 20:24:47 +03:00
|
|
|
if s is not None:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
extra["source"] = s
|
|
|
|
s = ctx.extra().get("intermediate-source", None)
|
2016-02-03 20:24:47 +03:00
|
|
|
if s is not None:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
extra["intermediate-source"] = s
|
|
|
|
|
2016-02-03 20:24:47 +03:00
|
|
|
|
|
|
|
def _savebranch(ctx, extra):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
extra["branch"] = ctx.branch()
|
|
|
|
|
2016-02-03 20:24:47 +03:00
|
|
|
|
2013-10-01 22:28:18 +04:00
|
|
|
def _makeextrafn(copiers):
|
|
|
|
"""make an extrafn out of the given copy-functions.
|
|
|
|
|
|
|
|
A copy function takes a context and an extra dict, and mutates the
|
|
|
|
extra dict as needed based on the given context.
|
|
|
|
"""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2013-10-01 22:28:18 +04:00
|
|
|
def extrafn(ctx, extra):
|
|
|
|
for c in copiers:
|
|
|
|
c(ctx, extra)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2013-10-01 22:28:18 +04:00
|
|
|
return extrafn
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-04-30 19:41:08 +03:00
|
|
|
def _destrebase(repo, sourceset, destspace=None):
|
2016-02-14 16:25:59 +03:00
|
|
|
"""small wrapper around destmerge to pass the right extra args
|
|
|
|
|
|
|
|
Please wrap destutil.destmerge instead."""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
return destutil.destmerge(
|
|
|
|
repo,
|
|
|
|
action="rebase",
|
|
|
|
sourceset=sourceset,
|
|
|
|
onheadcheck=False,
|
|
|
|
destspace=destspace,
|
|
|
|
)
|
|
|
|
|
2015-10-15 03:50:31 +03:00
|
|
|
|
2016-03-08 17:04:53 +03:00
|
|
|
revsetpredicate = registrar.revsetpredicate()
|
2015-12-29 17:58:30 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
@revsetpredicate("_destrebase")
|
2015-10-15 03:56:03 +03:00
|
|
|
def _revsetdestrebase(repo, subset, x):
|
2015-09-17 20:59:52 +03:00
|
|
|
# ``_rebasedefaultdest()``
|
|
|
|
|
|
|
|
# default destination for rebase.
|
|
|
|
# # XXX: Currently private because I expect the signature to change.
|
|
|
|
# # XXX: - bailing out in case of ambiguity vs returning all data.
|
|
|
|
# i18n: "_rebasedefaultdest" is a keyword
|
2016-02-14 16:25:59 +03:00
|
|
|
sourceset = None
|
|
|
|
if x is not None:
|
2017-02-19 12:16:09 +03:00
|
|
|
sourceset = revset.getset(repo, smartset.fullreposet(repo), x)
|
|
|
|
return subset & smartset.baseset([_destrebase(repo, sourceset)])
|
2015-09-17 20:59:52 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-07-09 06:05:52 +03:00
|
|
|
def _ctxdesc(ctx):
|
|
|
|
"""short description for a context"""
|
2019-10-16 02:28:01 +03:00
|
|
|
desc = '%s "%s"' % (ctx, ctx.description().split("\n", 1)[0])
|
2017-07-09 06:05:52 +03:00
|
|
|
repo = ctx.repo()
|
2017-09-20 08:06:26 +03:00
|
|
|
names = []
|
|
|
|
for nsname, ns in repo.names.iteritems():
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if nsname == "branches":
|
2017-09-20 08:06:26 +03:00
|
|
|
continue
|
|
|
|
names.extend(ns.names(repo, ctx.node()))
|
2017-07-09 06:05:52 +03:00
|
|
|
if names:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
desc += " (%s)" % " ".join(names)
|
2017-07-09 06:05:52 +03:00
|
|
|
return desc
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-06-14 00:36:13 +03:00
|
|
|
class rebaseruntime(object):
|
|
|
|
"""This class is a container for rebase runtime state"""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2018-06-07 01:21:34 +03:00
|
|
|
def __init__(self, repo, ui, templ, inmemory=False, opts=None):
|
2016-06-21 17:22:49 +03:00
|
|
|
if opts is None:
|
|
|
|
opts = {}
|
|
|
|
|
2017-09-07 02:13:04 +03:00
|
|
|
# prepared: whether we have rebasestate prepared or not. Currently it
|
|
|
|
# decides whether "self.repo" is unfiltered or not.
|
|
|
|
# The rebasestate has explicit hash to hash instructions not depending
|
|
|
|
# on visibility. If rebasestate exists (in-memory or on-disk), use
|
|
|
|
# unfiltered repo to avoid visibility issues.
|
|
|
|
# Before knowing rebasestate (i.e. when starting a new rebase (not
|
|
|
|
# --continue or --abort)), the original repo should be used so
|
|
|
|
# visibility-dependent revsets are correct.
|
|
|
|
self.prepared = False
|
|
|
|
self._repo = repo
|
|
|
|
|
2016-06-21 17:22:49 +03:00
|
|
|
self.ui = ui
|
2018-06-07 01:21:34 +03:00
|
|
|
self.templ = templ
|
2016-06-21 17:22:49 +03:00
|
|
|
self.opts = opts
|
2016-06-14 00:36:13 +03:00
|
|
|
self.originalwd = None
|
|
|
|
self.external = nullrev
|
|
|
|
# Mapping between the old revision id and either what is the new rebased
|
|
|
|
# revision or what needs to be done with the old revision. The state
|
|
|
|
# dict will be what contains most of the rebase progress state.
|
|
|
|
self.state = {}
|
|
|
|
self.activebookmark = None
|
2017-08-11 10:32:19 +03:00
|
|
|
self.destmap = {}
|
2018-12-13 21:41:51 +03:00
|
|
|
self.predmap = {}
|
2016-06-14 00:40:59 +03:00
|
|
|
self.skipped = set()
|
2016-06-14 00:36:13 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.collapsef = opts.get("collapse", False)
|
2019-09-05 02:58:40 +03:00
|
|
|
self.collapsemsg = cmdutil.logmessage(repo, opts)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.date = opts.get("date", None)
|
2016-06-21 16:29:23 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
e = opts.get("extrafn") # internal, used by e.g. hgsubversion
|
2016-06-21 16:29:23 +03:00
|
|
|
self.extrafns = [_savegraft]
|
|
|
|
if e:
|
|
|
|
self.extrafns = [e]
|
2016-06-21 16:29:23 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.keepf = opts.get("keep", False)
|
2016-06-21 16:29:23 +03:00
|
|
|
self.obsoletenotrebased = {}
|
2017-11-15 00:46:10 +03:00
|
|
|
self.obsoletewithoutsuccessorindestination = set()
|
2017-12-12 09:16:13 +03:00
|
|
|
self.inmemory = inmemory
|
2016-06-21 16:29:23 +03:00
|
|
|
|
2017-09-07 02:13:04 +03:00
|
|
|
@property
|
|
|
|
def repo(self):
|
|
|
|
if self.prepared:
|
|
|
|
return self._repo.unfiltered()
|
|
|
|
else:
|
|
|
|
return self._repo
|
|
|
|
|
2017-03-08 01:04:29 +03:00
|
|
|
def storestatus(self, tr=None):
|
2017-03-08 01:11:44 +03:00
|
|
|
"""Store the current status to allow recovery"""
|
2017-03-08 01:04:29 +03:00
|
|
|
if tr:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
tr.addfilegenerator(
|
2018-09-28 17:08:40 +03:00
|
|
|
"rebasestate", ("rebasestate",), self._writestatus, location="local"
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2017-03-08 01:04:29 +03:00
|
|
|
else:
|
2018-09-28 17:08:56 +03:00
|
|
|
with self.repo.localvfs("rebasestate", "w") as f:
|
2017-03-08 01:04:29 +03:00
|
|
|
self._writestatus(f)
|
|
|
|
|
|
|
|
def _writestatus(self, f):
|
2017-09-07 02:17:04 +03:00
|
|
|
repo = self.repo
|
|
|
|
assert repo.filtername is None
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
f.write(repo[self.originalwd].hex() + "\n")
|
2017-08-11 10:32:19 +03:00
|
|
|
# was "dest". we now write dest per src root below.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
f.write("\n")
|
|
|
|
f.write(repo[self.external].hex() + "\n")
|
|
|
|
f.write("%d\n" % int(self.collapsef))
|
|
|
|
f.write("%d\n" % int(self.keepf))
|
2019-02-13 08:39:24 +03:00
|
|
|
f.write("0\n") # used to be the "keepbranches" flag.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
f.write("%s\n" % (self.activebookmark or ""))
|
2017-08-11 10:32:19 +03:00
|
|
|
destmap = self.destmap
|
2017-03-08 01:11:44 +03:00
|
|
|
for d, v in self.state.iteritems():
|
|
|
|
oldrev = repo[d].hex()
|
|
|
|
if v >= 0:
|
|
|
|
newrev = repo[v].hex()
|
|
|
|
else:
|
|
|
|
newrev = v
|
2017-08-11 10:32:19 +03:00
|
|
|
destnode = repo[destmap[d]].hex()
|
|
|
|
f.write("%s:%s:%s\n" % (oldrev, newrev, destnode))
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.debug("rebase status stored\n")
|
2017-03-08 01:11:44 +03:00
|
|
|
|
2016-06-21 16:29:23 +03:00
|
|
|
def restorestatus(self):
|
|
|
|
"""Restore a previously stored status"""
|
2017-09-07 02:13:04 +03:00
|
|
|
self.prepared = True
|
2017-09-07 02:17:04 +03:00
|
|
|
repo = self.repo
|
|
|
|
assert repo.filtername is None
|
2017-08-11 10:32:19 +03:00
|
|
|
legacydest = None
|
2016-06-21 16:29:23 +03:00
|
|
|
collapse = False
|
|
|
|
external = nullrev
|
|
|
|
activebookmark = None
|
|
|
|
state = {}
|
2017-08-11 10:32:19 +03:00
|
|
|
destmap = {}
|
2019-02-13 08:39:24 +03:00
|
|
|
originalwd = None
|
2016-06-21 16:29:23 +03:00
|
|
|
|
|
|
|
try:
|
2018-09-28 17:08:56 +03:00
|
|
|
f = repo.localvfs("rebasestate")
|
2016-06-21 16:29:23 +03:00
|
|
|
for i, l in enumerate(f.read().splitlines()):
|
|
|
|
if i == 0:
|
|
|
|
originalwd = repo[l].rev()
|
|
|
|
elif i == 1:
|
2017-08-11 10:32:19 +03:00
|
|
|
# this line should be empty in newer version. but legacy
|
|
|
|
# clients may still use it
|
|
|
|
if l:
|
|
|
|
legacydest = repo[l].rev()
|
2016-06-21 16:29:23 +03:00
|
|
|
elif i == 2:
|
|
|
|
external = repo[l].rev()
|
|
|
|
elif i == 3:
|
|
|
|
collapse = bool(int(l))
|
|
|
|
elif i == 4:
|
|
|
|
keep = bool(int(l))
|
|
|
|
elif i == 5:
|
2019-02-13 08:39:24 +03:00
|
|
|
# used to be the "keepbranches" flag
|
|
|
|
pass
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
elif i == 6 and not (len(l) == 81 and ":" in l):
|
2016-06-21 16:29:23 +03:00
|
|
|
# line 6 is a recent addition, so for backwards
|
|
|
|
# compatibility check that the line doesn't look like the
|
|
|
|
# oldrev:newrev lines
|
|
|
|
activebookmark = l
|
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
args = l.split(":")
|
2017-08-11 10:32:19 +03:00
|
|
|
oldrev = args[0]
|
|
|
|
newrev = args[1]
|
2017-07-09 06:38:34 +03:00
|
|
|
if newrev in legacystates:
|
|
|
|
continue
|
2017-08-11 10:32:19 +03:00
|
|
|
if len(args) > 2:
|
|
|
|
destnode = args[2]
|
|
|
|
else:
|
|
|
|
destnode = legacydest
|
|
|
|
destmap[repo[oldrev].rev()] = repo[destnode].rev()
|
|
|
|
if newrev in (nullid, revtodostr):
|
2016-06-21 16:29:23 +03:00
|
|
|
state[repo[oldrev].rev()] = revtodo
|
|
|
|
# Legacy compat special case
|
|
|
|
else:
|
|
|
|
state[repo[oldrev].rev()] = repo[newrev].rev()
|
|
|
|
|
|
|
|
except IOError as err:
|
|
|
|
if err.errno != errno.ENOENT:
|
|
|
|
raise
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
cmdutil.wrongtooltocontinue(repo, _("rebase"))
|
2016-06-21 16:29:23 +03:00
|
|
|
|
2019-02-13 08:39:24 +03:00
|
|
|
if originalwd is None:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_(".hg/rebasestate is incomplete"))
|
2016-06-21 16:29:23 +03:00
|
|
|
|
2018-12-13 21:41:51 +03:00
|
|
|
# recompute the predecessor map
|
|
|
|
predmap = _definepredmap(repo, destmap.keys())
|
|
|
|
|
2016-06-21 16:29:23 +03:00
|
|
|
skipped = set()
|
|
|
|
# recompute the set of skipped revs
|
|
|
|
if not collapse:
|
2017-08-11 10:32:19 +03:00
|
|
|
seen = set(destmap.values())
|
2016-06-21 16:29:23 +03:00
|
|
|
for old, new in sorted(state.items()):
|
|
|
|
if new != revtodo and new in seen:
|
|
|
|
skipped.add(old)
|
|
|
|
seen.add(new)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.debug(
|
|
|
|
"computed skipped revs: %s\n"
|
|
|
|
% (" ".join(str(r) for r in sorted(skipped)) or None)
|
|
|
|
)
|
|
|
|
repo.ui.debug("rebase status resumed\n")
|
2016-06-21 16:29:23 +03:00
|
|
|
|
|
|
|
self.originalwd = originalwd
|
2017-08-11 10:32:19 +03:00
|
|
|
self.destmap = destmap
|
2018-12-13 21:41:51 +03:00
|
|
|
self.predmap = predmap
|
2016-06-21 16:29:23 +03:00
|
|
|
self.state = state
|
|
|
|
self.skipped = skipped
|
|
|
|
self.collapsef = collapse
|
|
|
|
self.keepf = keep
|
|
|
|
self.external = external
|
|
|
|
self.activebookmark = activebookmark
|
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
def _handleskippingobsolete(self, obsoleterevs, destmap):
|
2016-07-01 15:09:53 +03:00
|
|
|
"""Compute structures necessary for skipping obsolete revisions
|
|
|
|
|
|
|
|
obsoleterevs: iterable of all obsolete revisions in rebaseset
|
2017-08-11 10:32:19 +03:00
|
|
|
destmap: {srcrev: destrev} destination revisions
|
2016-07-01 15:09:53 +03:00
|
|
|
"""
|
|
|
|
self.obsoletenotrebased = {}
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if not self.ui.configbool("experimental", "rebaseskipobsolete"):
|
2016-07-01 15:09:53 +03:00
|
|
|
return
|
|
|
|
obsoleteset = set(obsoleterevs)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.obsoletenotrebased, self.obsoletewithoutsuccessorindestination = _computeobsoletenotrebased(
|
|
|
|
self.repo, obsoleteset, destmap
|
|
|
|
)
|
2016-07-01 15:09:53 +03:00
|
|
|
skippedset = set(self.obsoletenotrebased)
|
2017-11-15 00:46:10 +03:00
|
|
|
skippedset.update(self.obsoletewithoutsuccessorindestination)
|
2019-09-02 13:12:07 +03:00
|
|
|
if not mutation.enabled(self.repo):
|
|
|
|
_checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2016-07-01 15:09:53 +03:00
|
|
|
def _prepareabortorcontinue(self, isabort):
|
|
|
|
try:
|
|
|
|
self.restorestatus()
|
2018-03-30 00:32:37 +03:00
|
|
|
if self.collapsef:
|
|
|
|
self.collapsemsg = restorecollapsemsg(self.repo, isabort)
|
2016-07-01 15:09:53 +03:00
|
|
|
except error.RepoLookupError:
|
|
|
|
if isabort:
|
|
|
|
clearstatus(self.repo)
|
|
|
|
clearcollapsemsg(self.repo)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.repo.ui.warn(
|
|
|
|
_(
|
|
|
|
"rebase aborted (no revision is removed,"
|
|
|
|
" only broken state is cleared)\n"
|
|
|
|
)
|
|
|
|
)
|
2016-07-01 15:09:53 +03:00
|
|
|
return 0
|
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = _("cannot continue inconsistent rebase")
|
2016-07-01 15:09:53 +03:00
|
|
|
hint = _('use "hg rebase --abort" to clear broken state')
|
|
|
|
raise error.Abort(msg, hint=hint)
|
|
|
|
if isabort:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
return abort(
|
|
|
|
self.repo,
|
|
|
|
self.originalwd,
|
|
|
|
self.destmap,
|
|
|
|
self.state,
|
|
|
|
activebookmark=self.activebookmark,
|
|
|
|
)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
def _preparenewrebase(self, destmap):
|
|
|
|
if not destmap:
|
2018-11-14 03:32:44 +03:00
|
|
|
return 0
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
rebaseset = destmap.keys()
|
2019-03-08 14:01:10 +03:00
|
|
|
allowunstable = visibility.tracking(self.repo) or obsolete.isenabled(
|
|
|
|
self.repo, obsolete.allowunstableopt
|
|
|
|
)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if not (self.keepf or allowunstable) and self.repo.revs(
|
|
|
|
"first(children(%ld) - %ld)", rebaseset, rebaseset
|
|
|
|
):
|
2016-07-01 15:09:53 +03:00
|
|
|
raise error.Abort(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
_("can't remove original changesets with" " unrebased descendants"),
|
|
|
|
hint=_("use --keep to keep original changesets"),
|
|
|
|
)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2018-12-13 21:41:51 +03:00
|
|
|
self.predmap = _definepredmap(self.repo, rebaseset)
|
|
|
|
|
2017-08-27 12:47:47 +03:00
|
|
|
result = buildstate(self.repo, destmap, self.collapsef)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
|
|
|
if not result:
|
|
|
|
# Empty state built, nothing to rebase
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.ui.status(_("nothing to rebase\n"))
|
2018-11-14 03:32:44 +03:00
|
|
|
return 0
|
2016-07-01 15:09:53 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
for root in self.repo.set("roots(%ld)", rebaseset):
|
2017-03-11 21:35:44 +03:00
|
|
|
if not self.keepf and not root.mutable():
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(
|
|
|
|
_("can't rebase public changeset %s") % root,
|
|
|
|
hint=_("see 'hg help phases' for details"),
|
|
|
|
)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
(self.originalwd, self.destmap, self.state) = result
|
2016-07-01 15:09:53 +03:00
|
|
|
if self.collapsef:
|
2017-08-11 10:32:19 +03:00
|
|
|
dests = set(self.destmap.values())
|
|
|
|
if len(dests) != 1:
|
|
|
|
raise error.Abort(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
_("--collapse does not work with multiple destinations")
|
|
|
|
)
|
2017-08-11 10:32:19 +03:00
|
|
|
destrev = next(iter(dests))
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
destancestors = self.repo.changelog.ancestors([destrev], inclusive=True)
|
2017-08-11 11:05:47 +03:00
|
|
|
self.external = externalparent(self.repo, self.state, destancestors)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
for destrev in sorted(set(destmap.values())):
|
|
|
|
dest = self.repo[destrev]
|
2019-02-13 08:39:24 +03:00
|
|
|
if dest.closesbranch():
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.ui.status(_("reopening closed branch head %s\n") % dest)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-09-07 02:13:04 +03:00
|
|
|
self.prepared = True
|
2018-10-17 22:00:50 +03:00
|
|
|
self._logrebasesize(destmap)
|
|
|
|
|
|
|
|
def _logrebasesize(self, destmap):
|
|
|
|
"""Log metrics about the rebase size and distance"""
|
|
|
|
repo = self.repo
|
|
|
|
|
|
|
|
# internal config: rebase.logsizemetrics
|
|
|
|
if not repo.ui.configbool("rebase", "logsizemetrics", default=True):
|
|
|
|
return
|
|
|
|
|
|
|
|
# The code assumes the rebase source is roughly a linear stack within a
|
|
|
|
# single feature branch, and there is only one destination. If that is not
|
|
|
|
# the case, the distance might be not accurate.
|
|
|
|
destrev = max(destmap.values())
|
|
|
|
rebaseset = destmap.keys()
|
|
|
|
commitcount = len(rebaseset)
|
|
|
|
distance = len(
|
|
|
|
repo.revs(
|
|
|
|
"(%ld %% %d) + (%d %% %ld)", rebaseset, destrev, destrev, rebaseset
|
|
|
|
)
|
|
|
|
)
|
|
|
|
# 'distance' includes the commits being rebased, so subtract them to get the
|
|
|
|
# actual distance being traveled. Even though we log update_distance above,
|
|
|
|
# a rebase may run multiple updates, so that value might be not be accurate.
|
|
|
|
repo.ui.log(
|
|
|
|
"rebase_size",
|
|
|
|
rebase_commitcount=commitcount,
|
|
|
|
rebase_distance=distance - commitcount,
|
|
|
|
)
|
2017-09-07 02:13:04 +03:00
|
|
|
|
2017-12-08 23:44:27 +03:00
|
|
|
def _assignworkingcopy(self):
|
2017-12-08 00:25:23 +03:00
|
|
|
if self.inmemory:
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial.context import overlayworkingctx
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-12-08 00:25:23 +03:00
|
|
|
self.wctx = overlayworkingctx(self.repo)
|
2017-12-11 09:39:46 +03:00
|
|
|
self.repo.ui.debug("rebasing in-memory\n")
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = self.repo.ui.config("rebase", "experimental.inmemorywarning")
|
2018-01-03 16:35:56 +03:00
|
|
|
if msg:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.repo.ui.warn(msg + "\n")
|
2017-12-08 00:25:23 +03:00
|
|
|
else:
|
|
|
|
self.wctx = self.repo[None]
|
2017-12-11 09:39:46 +03:00
|
|
|
self.repo.ui.debug("rebasing on disk\n")
|
2019-04-23 12:45:38 +03:00
|
|
|
self.repo.ui.log("rebase", rebase_imm_used=str(self.wctx.isinmemory()).lower())
|
2017-12-08 23:44:27 +03:00
|
|
|
|
|
|
|
def _performrebase(self, tr):
|
|
|
|
self._assignworkingcopy()
|
|
|
|
repo, ui = self.repo, self.ui
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-08-27 12:47:47 +03:00
|
|
|
# Calculate self.obsoletenotrebased
|
|
|
|
obsrevs = _filterobsoleterevs(self.repo, self.state)
|
|
|
|
self._handleskippingobsolete(obsrevs, self.destmap)
|
|
|
|
|
2017-07-08 04:51:46 +03:00
|
|
|
# Keep track of the active bookmarks in order to reset them later
|
2016-07-01 15:09:53 +03:00
|
|
|
self.activebookmark = self.activebookmark or repo._activebookmark
|
|
|
|
if self.activebookmark:
|
|
|
|
bookmarks.deactivate(repo)
|
|
|
|
|
2017-03-08 03:30:31 +03:00
|
|
|
# Store the state before we begin so users can run 'hg rebase --abort'
|
|
|
|
# if we fail before the transaction closes.
|
|
|
|
self.storestatus()
|
|
|
|
|
2016-08-26 03:16:51 +03:00
|
|
|
cands = [k for k, v in self.state.iteritems() if v == revtodo]
|
|
|
|
total = len(cands)
|
2016-07-01 15:09:53 +03:00
|
|
|
pos = 0
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
with progress.bar(ui, _("rebasing"), _("changesets"), total) as prog:
|
2018-03-21 23:49:39 +03:00
|
|
|
for subset in sortsource(self.destmap):
|
|
|
|
pos = self._performrebasesubset(tr, subset, pos, prog)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.note(_("rebase merging completed\n"))
|
2017-08-22 06:22:07 +03:00
|
|
|
|
2018-03-21 23:49:39 +03:00
|
|
|
def _performrebasesubset(self, tr, subset, pos, prog):
|
2018-06-14 21:18:26 +03:00
|
|
|
repo, ui = self.repo, self.ui
|
2018-12-13 21:41:51 +03:00
|
|
|
if mutation.enabled(repo):
|
|
|
|
# We must traverse mutation edges, too - topo sort is not enough.
|
2019-09-02 13:12:07 +03:00
|
|
|
sortedrevs = smartset.baseset(
|
|
|
|
mutation.toposortrevs(repo, subset, self.predmap)
|
|
|
|
)
|
2018-12-13 21:41:51 +03:00
|
|
|
else:
|
|
|
|
sortedrevs = repo.revs("sort(%ld, -topo)", subset)
|
2017-11-15 00:46:10 +03:00
|
|
|
allowdivergence = self.ui.configbool(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"experimental", "evolution.allowdivergence"
|
2019-09-02 13:12:07 +03:00
|
|
|
)
|
2017-11-15 00:46:10 +03:00
|
|
|
if not allowdivergence:
|
|
|
|
sortedrevs -= repo.revs(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"descendants(%ld) and not %ld",
|
2017-11-15 00:46:10 +03:00
|
|
|
self.obsoletewithoutsuccessorindestination,
|
|
|
|
self.obsoletewithoutsuccessorindestination,
|
|
|
|
)
|
2016-07-14 13:12:09 +03:00
|
|
|
for rev in sortedrevs:
|
2017-08-11 10:32:19 +03:00
|
|
|
dest = self.destmap[rev]
|
2016-07-01 15:09:53 +03:00
|
|
|
ctx = repo[rev]
|
2017-07-09 06:05:52 +03:00
|
|
|
desc = _ctxdesc(ctx)
|
2017-05-11 21:37:18 +03:00
|
|
|
if self.state[rev] == rev:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(_("already rebased %s\n") % desc)
|
|
|
|
elif (
|
|
|
|
not allowdivergence
|
|
|
|
and rev in self.obsoletewithoutsuccessorindestination
|
|
|
|
):
|
|
|
|
msg = (
|
|
|
|
_(
|
|
|
|
"note: not rebasing %s and its descendants as "
|
|
|
|
"this would cause divergence\n"
|
|
|
|
)
|
|
|
|
% desc
|
|
|
|
)
|
2017-11-15 00:46:10 +03:00
|
|
|
repo.ui.status(msg)
|
|
|
|
self.skipped.add(rev)
|
2017-08-27 12:47:47 +03:00
|
|
|
elif rev in self.obsoletenotrebased:
|
|
|
|
succ = self.obsoletenotrebased[rev]
|
|
|
|
if succ is None:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = _("note: not rebasing %s, it has no " "successor\n") % desc
|
2017-08-27 12:47:47 +03:00
|
|
|
else:
|
2017-08-30 03:51:54 +03:00
|
|
|
succdesc = _ctxdesc(repo[succ])
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = _(
|
|
|
|
"note: not rebasing %s, already in " "destination as %s\n"
|
|
|
|
) % (desc, succdesc)
|
2017-08-27 12:47:47 +03:00
|
|
|
repo.ui.status(msg)
|
|
|
|
# Make clearrebased aware state[rev] is not a true successor
|
|
|
|
self.skipped.add(rev)
|
|
|
|
# Record rev as moved to its desired destination in self.state.
|
|
|
|
# This helps bookmark and working parent movement.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
dest = max(
|
|
|
|
adjustdest(repo, rev, self.destmap, self.state, self.skipped)
|
|
|
|
)
|
2017-08-27 12:47:47 +03:00
|
|
|
self.state[rev] = dest
|
2017-05-11 21:37:18 +03:00
|
|
|
elif self.state[rev] == revtodo:
|
2016-08-26 03:16:51 +03:00
|
|
|
pos += 1
|
2018-03-21 23:49:39 +03:00
|
|
|
prog.value = (pos, "%d:%s" % (rev, ctx))
|
2018-06-14 21:18:27 +03:00
|
|
|
try:
|
|
|
|
self._performrebaseone(rev, ctx, desc, tr, dest)
|
|
|
|
except error.InMemoryMergeConflictsError as e:
|
2019-03-26 05:22:16 +03:00
|
|
|
perftrace.traceflag("disk-fallback")
|
2018-07-02 20:28:50 +03:00
|
|
|
# in-memory merge doesn't support conflicts, so if we hit any, abort
|
|
|
|
# and re-run as an on-disk merge.
|
|
|
|
clearstatus(repo)
|
|
|
|
mergemod.mergestate.clean(repo)
|
2018-07-02 21:24:57 +03:00
|
|
|
|
2018-09-21 03:06:51 +03:00
|
|
|
pathstr = ", ".join(i18n.limititems(e.paths, maxitems=3))
|
2018-07-02 21:24:57 +03:00
|
|
|
if e.type == error.InMemoryMergeConflictsError.TYPE_FILE_CONFLICTS:
|
|
|
|
kindstr = _("hit merge conflicts")
|
|
|
|
else:
|
|
|
|
kindstr = _("artifact rebuild required")
|
|
|
|
|
2018-07-04 03:47:06 +03:00
|
|
|
if self.opts.get("noconflict"):
|
2018-07-20 01:57:29 +03:00
|
|
|
# internal config: rebase.noconflictmsg
|
|
|
|
msg = ui.config(
|
|
|
|
"rebase",
|
|
|
|
"noconflictmsg",
|
|
|
|
_("%s (in %s) and --noconflict passed; exiting"),
|
2018-07-02 21:24:59 +03:00
|
|
|
)
|
2018-07-20 01:57:29 +03:00
|
|
|
raise error.AbortMergeToolError(msg % (kindstr, pathstr))
|
2018-07-02 21:24:59 +03:00
|
|
|
elif cmdutil.uncommittedchanges(repo):
|
2018-07-02 20:28:50 +03:00
|
|
|
raise error.UncommitedChangesAbort(
|
|
|
|
_(
|
2018-07-02 21:24:57 +03:00
|
|
|
"must use on-disk merge for this rebase (%s in %s), but you have working copy changes"
|
2018-06-14 21:18:27 +03:00
|
|
|
)
|
2018-07-02 21:24:57 +03:00
|
|
|
% (kindstr, pathstr),
|
2018-07-02 20:28:50 +03:00
|
|
|
hint=_("commit, revert, or shelve them"),
|
2018-06-14 21:18:27 +03:00
|
|
|
)
|
|
|
|
else:
|
2018-07-02 20:28:50 +03:00
|
|
|
ui.warn(
|
2018-07-02 21:24:57 +03:00
|
|
|
_("%s (in %s); switching to on-disk merge\n")
|
|
|
|
% (kindstr, pathstr)
|
2018-07-02 20:28:50 +03:00
|
|
|
)
|
|
|
|
ui.log(
|
|
|
|
"rebase",
|
|
|
|
rebase_imm_new_restart=str(True).lower(),
|
|
|
|
rebase_imm_restart=str(True).lower(),
|
|
|
|
)
|
|
|
|
self.inmemory = False
|
|
|
|
self._assignworkingcopy()
|
|
|
|
self._performrebaseone(rev, ctx, desc, tr, dest)
|
2018-06-14 21:18:26 +03:00
|
|
|
else:
|
|
|
|
ui.status(
|
|
|
|
_("already rebased %s as %s\n") % (desc, repo[self.state[rev]])
|
|
|
|
)
|
|
|
|
return pos
|
|
|
|
|
|
|
|
def _performrebaseone(self, rev, ctx, desc, tr, dest):
|
|
|
|
repo, ui, opts = self.repo, self.ui, self.opts
|
2018-06-14 21:18:27 +03:00
|
|
|
ui.status(_("rebasing %s\n") % desc)
|
2018-06-14 21:18:26 +03:00
|
|
|
p1, p2, base = defineparents(
|
|
|
|
repo, rev, self.destmap, self.state, self.skipped, self.obsoletenotrebased
|
|
|
|
)
|
2018-12-13 21:41:51 +03:00
|
|
|
copypreds = [self.state[p] for p in self.predmap[rev]]
|
2018-06-14 21:18:26 +03:00
|
|
|
self.storestatus(tr=tr)
|
|
|
|
storecollapsemsg(repo, self.collapsemsg)
|
|
|
|
if len(repo[None].parents()) == 2:
|
|
|
|
repo.ui.debug("resuming interrupted rebase\n")
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
ui.setconfig("ui", "forcemerge", opts.get("tool", ""), "rebase")
|
|
|
|
stats = rebasenode(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo,
|
|
|
|
rev,
|
2018-06-14 21:18:26 +03:00
|
|
|
p1,
|
|
|
|
base,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.state,
|
2018-06-14 21:18:26 +03:00
|
|
|
self.collapsef,
|
|
|
|
dest,
|
|
|
|
wctx=self.wctx,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2018-06-14 21:18:26 +03:00
|
|
|
if stats and stats[3] > 0:
|
2017-12-08 09:35:43 +03:00
|
|
|
if self.wctx.isinmemory():
|
2018-07-18 23:01:52 +03:00
|
|
|
# This is a fallback in case the merge itself did not raise
|
|
|
|
# this exception (which, in general, it should).
|
|
|
|
raise error.InMemoryMergeConflictsError(
|
|
|
|
_("merge returned conflicts"),
|
|
|
|
type=error.InMemoryMergeConflictsError.TYPE_FILE_CONFLICTS,
|
|
|
|
# We don't have access to the paths here, so fake it:
|
|
|
|
paths=["%d files" % stats[3]],
|
|
|
|
)
|
2017-12-08 09:35:43 +03:00
|
|
|
else:
|
2018-06-14 21:18:26 +03:00
|
|
|
raise error.InterventionRequired(
|
|
|
|
_(
|
|
|
|
"unresolved conflicts (see hg "
|
|
|
|
"resolve, then hg rebase --continue)"
|
|
|
|
)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2018-06-14 21:18:26 +03:00
|
|
|
finally:
|
|
|
|
ui.setconfig("ui", "forcemerge", "", "rebase")
|
|
|
|
if not self.collapsef:
|
|
|
|
merging = p2 != nullrev
|
|
|
|
editform = cmdutil.mergeeditform(merging, "rebase")
|
|
|
|
editor = cmdutil.getcommiteditor(editform=editform, **opts)
|
|
|
|
if self.wctx.isinmemory():
|
|
|
|
newnode = concludememorynode(
|
|
|
|
repo,
|
|
|
|
rev,
|
|
|
|
p1,
|
|
|
|
p2,
|
2019-11-14 07:18:00 +03:00
|
|
|
self.keepf,
|
2018-06-14 21:18:26 +03:00
|
|
|
wctx=self.wctx,
|
|
|
|
extrafn=_makeextrafn(self.extrafns),
|
|
|
|
editor=editor,
|
|
|
|
date=self.date,
|
2018-12-13 21:41:51 +03:00
|
|
|
copypreds=copypreds,
|
2018-06-14 21:18:26 +03:00
|
|
|
)
|
|
|
|
mergemod.mergestate.clean(repo)
|
|
|
|
else:
|
|
|
|
newnode = concludenode(
|
|
|
|
repo,
|
|
|
|
rev,
|
|
|
|
p1,
|
|
|
|
p2,
|
2019-11-14 07:18:00 +03:00
|
|
|
self.keepf,
|
2018-06-14 21:18:26 +03:00
|
|
|
extrafn=_makeextrafn(self.extrafns),
|
|
|
|
editor=editor,
|
|
|
|
date=self.date,
|
2018-12-13 21:41:51 +03:00
|
|
|
copypreds=copypreds,
|
2018-06-14 21:18:26 +03:00
|
|
|
)
|
2017-12-08 09:35:43 +03:00
|
|
|
|
2018-06-14 21:18:26 +03:00
|
|
|
if newnode is None:
|
|
|
|
# If it ended up being a no-op commit, then the normal
|
|
|
|
# merge state clean-up path doesn't happen, so do it
|
|
|
|
# here. Fix issue5494
|
|
|
|
mergemod.mergestate.clean(repo)
|
|
|
|
else:
|
|
|
|
# Skip commit if we are collapsing
|
|
|
|
if self.wctx.isinmemory():
|
|
|
|
self.wctx.setbase(repo[p1])
|
2016-07-01 15:09:53 +03:00
|
|
|
else:
|
2018-06-14 21:18:26 +03:00
|
|
|
repo.setparents(repo[p1].node())
|
|
|
|
newnode = None
|
|
|
|
# Update the state
|
|
|
|
if newnode is not None:
|
|
|
|
self.state[rev] = repo[newnode].rev()
|
|
|
|
ui.debug("rebased as %s\n" % short(newnode))
|
|
|
|
else:
|
|
|
|
if not self.collapsef:
|
|
|
|
ui.warn(
|
|
|
|
_("note: rebase of %d:%s created no changes " "to commit\n")
|
|
|
|
% (rev, ctx)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2018-06-14 21:18:26 +03:00
|
|
|
self.skipped.add(rev)
|
|
|
|
self.state[rev] = p1
|
|
|
|
ui.debug("next revision set to %s\n" % p1)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2016-07-01 15:09:53 +03:00
|
|
|
def _finishrebase(self):
|
|
|
|
repo, ui, opts = self.repo, self.ui, self.opts
|
2019-02-13 08:39:24 +03:00
|
|
|
if self.collapsef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
p1, p2, _base = defineparents(
|
|
|
|
repo,
|
|
|
|
min(self.state),
|
|
|
|
self.destmap,
|
|
|
|
self.state,
|
|
|
|
self.skipped,
|
|
|
|
self.obsoletenotrebased,
|
|
|
|
)
|
|
|
|
editopt = opts.get("edit")
|
|
|
|
editform = "rebase.collapse"
|
2016-07-01 15:09:53 +03:00
|
|
|
if self.collapsemsg:
|
|
|
|
commitmsg = self.collapsemsg
|
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
commitmsg = "Collapsed revision"
|
2017-08-02 15:52:22 +03:00
|
|
|
for rebased in sorted(self.state):
|
2017-08-11 11:36:59 +03:00
|
|
|
if rebased not in self.skipped:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
commitmsg += "\n* %s" % repo[rebased].description()
|
2016-07-01 15:09:53 +03:00
|
|
|
editopt = True
|
|
|
|
editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
|
2016-07-14 13:12:09 +03:00
|
|
|
revtoreuse = max(self.state)
|
2017-07-20 11:30:41 +03:00
|
|
|
|
|
|
|
dsguard = None
|
2017-12-08 09:35:43 +03:00
|
|
|
if self.inmemory:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
newnode = concludememorynode(
|
|
|
|
repo,
|
|
|
|
revtoreuse,
|
|
|
|
p1,
|
2017-12-08 09:35:43 +03:00
|
|
|
self.external,
|
2019-11-14 07:18:00 +03:00
|
|
|
self.keepf,
|
2017-12-08 09:35:43 +03:00
|
|
|
commitmsg=commitmsg,
|
|
|
|
extrafn=_makeextrafn(self.extrafns),
|
|
|
|
editor=editor,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
date=self.date,
|
|
|
|
wctx=self.wctx,
|
|
|
|
)
|
2017-12-08 09:35:43 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if ui.configbool("rebase", "singletransaction"):
|
|
|
|
dsguard = dirstateguard.dirstateguard(repo, "rebase")
|
2017-12-08 09:35:43 +03:00
|
|
|
with util.acceptintervention(dsguard):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
newnode = concludenode(
|
|
|
|
repo,
|
|
|
|
revtoreuse,
|
|
|
|
p1,
|
|
|
|
self.external,
|
2019-11-14 07:18:00 +03:00
|
|
|
self.keepf,
|
2017-12-08 09:35:43 +03:00
|
|
|
commitmsg=commitmsg,
|
|
|
|
extrafn=_makeextrafn(self.extrafns),
|
|
|
|
editor=editor,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
date=self.date,
|
|
|
|
)
|
2017-08-11 11:34:11 +03:00
|
|
|
if newnode is not None:
|
2016-07-01 15:09:53 +03:00
|
|
|
newrev = repo[newnode].rev()
|
2017-08-11 11:34:11 +03:00
|
|
|
for oldrev in self.state.iterkeys():
|
|
|
|
self.state[oldrev] = newrev
|
2016-07-01 15:09:53 +03:00
|
|
|
|
|
|
|
# restore original working directory
|
|
|
|
# (we do this before stripping)
|
|
|
|
newwd = self.state.get(self.originalwd, self.originalwd)
|
2017-07-09 06:38:34 +03:00
|
|
|
if newwd < 0:
|
2016-07-01 15:09:53 +03:00
|
|
|
# original directory is a parent of rebase set root or ignored
|
|
|
|
newwd = self.originalwd
|
2018-04-02 22:11:53 +03:00
|
|
|
|
|
|
|
if newwd not in [c.rev() for c in repo[None].parents()]:
|
2016-07-01 15:09:53 +03:00
|
|
|
ui.note(_("update back to initial working directory parent\n"))
|
2018-04-02 22:11:53 +03:00
|
|
|
try:
|
|
|
|
hg.updaterepo(repo, newwd, False)
|
|
|
|
except error.UpdateAbort:
|
|
|
|
if self.inmemory:
|
|
|
|
# Print a nice message rather than aborting/restarting.
|
|
|
|
newctx = repo[newwd]
|
|
|
|
firstline = templatefilters.firstline(newctx.description())
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.warn(
|
|
|
|
_(
|
|
|
|
"important: run `hg up %s` to get the new "
|
|
|
|
'version of your current commit ("%s")\n'
|
|
|
|
"(this was not done automatically because you "
|
|
|
|
"made working copy changes during the "
|
|
|
|
"rebase)\n"
|
|
|
|
)
|
|
|
|
% (short(newctx.node()), firstline),
|
|
|
|
label="rebase.manual.update",
|
|
|
|
)
|
2018-04-02 22:11:53 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise # Keep old behavior
|
2016-07-01 15:09:53 +03:00
|
|
|
|
2017-09-18 20:54:00 +03:00
|
|
|
collapsedas = None
|
2016-07-01 15:09:53 +03:00
|
|
|
if not self.keepf:
|
|
|
|
if self.collapsef:
|
|
|
|
collapsedas = newnode
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
clearrebased(
|
|
|
|
ui,
|
|
|
|
repo,
|
2018-06-07 01:21:34 +03:00
|
|
|
self.templ,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
self.destmap,
|
|
|
|
self.state,
|
|
|
|
self.skipped,
|
|
|
|
collapsedas,
|
|
|
|
self.keepf,
|
|
|
|
)
|
2016-07-01 15:09:53 +03:00
|
|
|
|
|
|
|
clearstatus(repo)
|
|
|
|
clearcollapsemsg(repo)
|
|
|
|
|
|
|
|
ui.note(_("rebase completed\n"))
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
util.unlinkpath(repo.sjoin("undo"), ignoremissing=True)
|
2016-07-01 15:09:53 +03:00
|
|
|
if self.skipped:
|
|
|
|
skippedlen = len(self.skipped)
|
|
|
|
ui.note(_("%d revisions have been skipped\n") % skippedlen)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if (
|
|
|
|
self.activebookmark
|
|
|
|
and self.activebookmark in repo._bookmarks
|
|
|
|
and repo["."].node() == repo._bookmarks[self.activebookmark]
|
|
|
|
):
|
|
|
|
bookmarks.activate(repo, self.activebookmark)
|
|
|
|
|
|
|
|
|
|
|
|
@command(
|
commands: define prefixes as aliases
Summary:
At a recent team meeting we've decided to remove the command prefix matching
behavior, as it can be really annoying for the Rust parser (since it needs to
know all the names, but it wants to avoid spinning up Python). It's even more
annoying for subcommand support. FWIW git does not have prefix matching.
This diff adds various aliases to "roughly" keep the command prefix matching
behavior.
The list of aliases are obtained by this script in `hg dbsh`:
def unique(prefix, names):
m = __import__('edenscm.mercurial').mercurial
try:
return m.cmdutil.findcmd(prefix, m.commands.table, False)[0][0] in names
except:
return False
nameslist=sorted([i.replace('^','') for i in m.commands.table])
aliases = {}
for names in nameslist:
names = names.split('|')
for name in names:
if name.startswith('debug'):
continue
for prefix in [name[:i] for i in xrange(1, len(name))]:
if unique(prefix, names):
aliases.setdefault(name, []).append(prefix)
Debug commands, and commands that are rarely used are not changed, including:
'backfillmanifestrevlog': ['backfillm', 'backfillma', 'backfillman', 'backfillmani', 'backfillmanif', 'backfillmanife', 'backfillmanifes', 'backfillmanifest', 'backfillmanifestr', 'backfillmanifestre', 'backfillmanifestrev', 'backfillmanifestrevl', 'backfillmanifestrevlo'],
'backfilltree': ['backfillt', 'backfilltr', 'backfilltre']}
'blackbox': ['blac', 'black', 'blackb', 'blackbo'],
'cachemanifest': ['cac', 'cach', 'cache', 'cachem', 'cachema', 'cacheman', 'cachemani', 'cachemanif', 'cachemanife', 'cachemanifes'],
'chistedit': ['chi', 'chis', 'chist', 'chiste', 'chisted', 'chistedi'],
'clone': ['clon'],
'cloud': ['clou'],
'convert': ['conv', 'conve', 'conver'],
'copy': ['cop'],
'fastannotate': ['fa', 'fas', 'fast', 'fasta', 'fastan', 'fastann', 'fastanno', 'fastannot', 'fastannota', 'fastannotat'],
'fold': ['fol'],
'githelp': ['gi', 'git', 'gith', 'githe', 'githel'],
'histgrep': ['histg', 'histgr', 'histgre'],
'incoming': ['in', 'inc', 'inco', 'incom', 'incomi', 'incomin'],
'isbackedup': ['is', 'isb', 'isba', 'isbac', 'isback', 'isbacke', 'isbacked', 'isbackedu'],
'manifest': ['ma', 'man', 'mani', 'manif', 'manife', 'manifes'],
'outgoing': ['o', 'ou', 'out', 'outg', 'outgo', 'outgoi', 'outgoin'],
'prefetch': ['pref', 'prefe', 'prefet', 'prefetc'],
'prune': ['pru', 'prun'],
'pushbackup': ['pushb', 'pushba', 'pushbac', 'pushback', 'pushbacku'],
'rage': ['ra', 'rag'],
'record': ['recor'],
'recover': ['recov', 'recove'],
'redo': ['red'],
'repack': ['rep', 'repa', 'repac'],
'reset': ['rese'],
'rollback': ['rol', 'roll', 'rollb', 'rollba', 'rollbac'],
'root': ['roo'],
'serve': ['se', 'ser', 'serv'],
'share': ['sha', 'shar'],
'sparse': ['spa', 'spar', 'spars'],
'svn': ['sv'],
'undo': ['und'],
'unshare': ['unsha', 'unshar'],
'verifyremotefilelog': ['verifyr', 'verifyre', 'verifyrem', 'verifyremo', 'verifyremot', 'verifyremote', 'verifyremotef', 'verifyremotefi', 'verifyremotefil', 'verifyremotefile', 'verifyremotefilel', 'verifyremotefilelo'],
Reviewed By: sfilipco
Differential Revision: D17644676
fbshipit-source-id: f60f5e6810279b52f9a4a1e048eeb529a96bd735
2019-10-08 19:44:04 +03:00
|
|
|
"rebase|reb|reba|rebas",
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
[
|
|
|
|
(
|
|
|
|
"s",
|
|
|
|
"source",
|
|
|
|
"",
|
|
|
|
_("rebase the specified changeset and descendants"),
|
|
|
|
_("REV"),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"b",
|
|
|
|
"base",
|
|
|
|
"",
|
|
|
|
_("rebase everything from branching point of specified changeset"),
|
|
|
|
_("REV"),
|
|
|
|
),
|
|
|
|
("r", "rev", [], _("rebase these revisions"), _("REV")),
|
|
|
|
("d", "dest", "", _("rebase onto the specified changeset"), _("REV")),
|
|
|
|
("", "collapse", False, _("collapse the rebased changesets")),
|
|
|
|
("m", "message", "", _("use text as collapse commit message"), _("TEXT")),
|
|
|
|
("e", "edit", False, _("invoke editor on commit messages")),
|
|
|
|
("l", "logfile", "", _("read collapse commit message from file"), _("FILE")),
|
|
|
|
("k", "keep", False, _("keep original changesets")),
|
|
|
|
("D", "detach", False, _("(DEPRECATED)")),
|
|
|
|
("i", "interactive", False, _("(DEPRECATED)")),
|
|
|
|
("t", "tool", "", _("specify merge tool")),
|
|
|
|
("c", "continue", False, _("continue an interrupted rebase")),
|
|
|
|
("a", "abort", False, _("abort an interrupted rebase")),
|
2018-07-02 21:24:59 +03:00
|
|
|
(
|
|
|
|
"",
|
|
|
|
"noconflict",
|
|
|
|
False,
|
|
|
|
_("cancel the rebase if there are conflicts (EXPERIMENTAL)"),
|
|
|
|
),
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
]
|
|
|
|
+ cmdutil.formatteropts,
|
|
|
|
_("[-s REV | -b REV] [-d REV] [OPTION]"),
|
2018-06-07 01:21:34 +03:00
|
|
|
cmdtemplate=True,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2018-06-07 01:21:34 +03:00
|
|
|
def rebase(ui, repo, templ=None, **opts):
|
2018-10-15 19:35:15 +03:00
|
|
|
"""move commits from one location to another
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Rebase moves commits from one part of the commit graph to another. It
|
|
|
|
does this by creating a copy of the commit at the destination and hiding
|
|
|
|
the original commit.
|
2010-03-10 05:53:16 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
To create copies of your commits instead of moving them, use ``--keep``
|
|
|
|
(``-k``) to keep the original commits rather than hiding them.
|
2013-02-01 06:01:26 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
If the commits being rebased have bookmarks, rebase moves the bookmarks
|
|
|
|
onto the new versions of the commits. Bookmarks are moved even if ``--keep``
|
|
|
|
is specified.
|
2010-03-10 05:53:16 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Public commits cannot be rebased unless you use the ``-k`` option to copy
|
|
|
|
them.
|
2015-12-18 21:24:41 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Use the following options to select the commits you want to rebase:
|
2015-12-18 21:24:41 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
1. ``--rev`` to explicitly select commits
|
2015-12-18 21:24:41 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
2. ``--source`` to select a root commit and include all of its
|
|
|
|
descendants
|
2013-02-01 05:01:11 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
3. ``--base`` to select a commit and its ancestors and descendants
|
2016-01-22 23:32:47 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
If no option is specified to select commits, ``-b .`` is used by default.
|
2017-10-14 00:08:14 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
.. container:: verbose
|
2015-12-18 21:22:03 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
If ``--source`` or ``--rev`` is used, special names ``SRC`` and ``ALLSRC``
|
|
|
|
can be used in ``--dest``. Destination would be calculated per source
|
|
|
|
revision with ``SRC`` substituted by that single source revision and
|
|
|
|
``ALLSRC`` substituted by all source revisions.
|
2010-03-10 05:53:16 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
If commits that you are rebasing consist entirely of changes that are
|
|
|
|
already present in the destination, those commits are not moved (in
|
|
|
|
other words, they are rebased out).
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Sometimes conflicts can occur when you rebase. When this happens, by
|
|
|
|
default, Mercurial launches an editor for every conflict. Conflict markers
|
|
|
|
are inserted into affected files, like::
|
2016-02-05 01:14:53 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
<<<<
|
|
|
|
dest
|
|
|
|
====
|
|
|
|
source
|
|
|
|
>>>>
|
2010-05-21 00:58:16 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
To fix the conflicts, for each file, remove the markers and replace the
|
|
|
|
whole block of code with the correctly merged code.
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
If you close the editor without resolving the conflict, the rebase is
|
|
|
|
interrupted and you are returned to the command line. At this point, you
|
|
|
|
can resolve conflicts in manual resolution mode. See :hg:`help resolve` for
|
|
|
|
details.
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
After manually resolving conflicts, resume the rebase with ``hg rebase
|
|
|
|
--continue`` (``-c``). If you are not able to successfully resolve all
|
|
|
|
conflicts, run ``hg rebase --abort`` (``-a``) to abort the
|
|
|
|
rebase.
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Alternatively, you can use a custom merge tool to automate conflict
|
|
|
|
resolution. To specify a custom merge tool, use the ``--tool`` flag. See
|
|
|
|
:hg:`help merge-tools` for a list of available tools and for information
|
|
|
|
about configuring the default merge behavior.
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
.. container:: verbose
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Examples:
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
- Move a single commit to master::
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
hg rebase -r 5f493448 -d master
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2019-01-31 01:24:55 +03:00
|
|
|
- Move a commit and all its descendants to another part of the commit graph::
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
hg rebase --source c0c3 --dest 4cf9
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
- Rebase everything on a local branch marked by a bookmark to master::
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
hg rebase --base myfeature --dest master
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
- Rebase orphaned commits onto the latest version of their parents::
|
2017-10-14 00:08:14 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
hg rebase --restack
|
2017-10-14 00:08:14 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Configuration Options:
|
2017-03-15 03:43:44 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
You can make rebase require a destination if you set the following config
|
|
|
|
option::
|
2017-03-15 03:43:44 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
[commands]
|
|
|
|
rebase.requiredest = True
|
2017-03-15 03:43:44 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
By default, rebase will close the transaction after each commit. For
|
|
|
|
performance purposes, you can configure rebase to use a single transaction
|
|
|
|
across the entire rebase. WARNING: This setting introduces a significant
|
|
|
|
risk of losing the work you've done in a rebase if the rebase aborts
|
|
|
|
unexpectedly::
|
2017-07-18 17:47:28 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
[rebase]
|
|
|
|
singletransaction = True
|
2017-07-18 17:47:28 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
By default, rebase writes to the current checkout, but you can configure it
|
|
|
|
to run in-memory for for better performance, and to allow it to run if the
|
|
|
|
current checkout is dirty::
|
2017-12-12 09:16:13 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
[rebase]
|
|
|
|
experimental.inmemory = True
|
2017-12-12 09:16:13 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
It will also print a configurable warning::
|
2018-01-03 16:35:56 +03:00
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
[rebase]
|
|
|
|
experimental.inmemorywarning = Using experimental in-memory rebase
|
2018-01-03 16:35:56 +03:00
|
|
|
|
2017-03-15 03:43:44 +03:00
|
|
|
Return Values:
|
|
|
|
|
2018-10-23 21:38:42 +03:00
|
|
|
Returns 0 on success, 1 if nothing to rebase or if there are
|
2013-10-26 19:24:25 +04:00
|
|
|
unresolved conflicts.
|
2014-10-08 23:03:07 +04:00
|
|
|
|
2008-08-18 23:16:31 +04:00
|
|
|
"""
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
inmemory = ui.configbool("rebase", "experimental.inmemory")
|
2018-01-03 16:35:56 +03:00
|
|
|
|
|
|
|
# Check for conditions that disable in-memory merge if it was requested.
|
|
|
|
if inmemory:
|
|
|
|
whynotimm = None
|
|
|
|
|
2017-12-08 23:14:38 +03:00
|
|
|
# in-memory rebase is not compatible with resuming rebases.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if opts.get("continue") or opts.get("abort"):
|
2018-01-03 16:35:56 +03:00
|
|
|
whynotimm = "--continue or --abort passed"
|
|
|
|
|
|
|
|
# in-memory rebase cannot currently run within a parent transaction,
|
|
|
|
# since the restarting logic will fail the entire transaction.
|
|
|
|
elif repo.currenttransaction() is not None:
|
|
|
|
whynotimm = "rebase run inside a transaction"
|
|
|
|
|
|
|
|
if whynotimm:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.log(
|
|
|
|
"rebase", "disabling IMM because: %s" % whynotimm, why_not_imm=whynotimm
|
|
|
|
)
|
2018-01-03 16:35:56 +03:00
|
|
|
inmemory = False
|
2017-12-08 23:14:38 +03:00
|
|
|
|
2018-07-02 21:24:59 +03:00
|
|
|
if opts.get("noconflict") and not inmemory:
|
|
|
|
raise error.Abort("--noconflict requires in-memory merge")
|
|
|
|
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
opts = pycompat.byteskwargs(opts)
|
2018-06-07 01:21:34 +03:00
|
|
|
rbsrt = rebaseruntime(repo, ui, templ, inmemory, opts)
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
|
|
|
|
if rbsrt.inmemory:
|
2017-12-08 23:14:38 +03:00
|
|
|
try:
|
2018-02-23 23:16:06 +03:00
|
|
|
overrides = {
|
|
|
|
# It's important to check for path conflicts with IMM to
|
|
|
|
# prevent commits with path<>file conflicts from being created
|
|
|
|
# (if you rebase on disk the filesystem prevents you from doing
|
|
|
|
# this).
|
|
|
|
("experimental", "merge.checkpathconflicts"): True
|
|
|
|
}
|
|
|
|
with ui.configoverride(overrides):
|
|
|
|
return _origrebase(ui, repo, rbsrt, **opts)
|
2018-06-20 06:13:13 +03:00
|
|
|
except error.AbortMergeToolError as e:
|
2018-07-20 01:57:29 +03:00
|
|
|
ui.status(_("%s\n") % e)
|
2018-06-20 06:13:13 +03:00
|
|
|
clearstatus(repo)
|
|
|
|
mergemod.mergestate.clean(repo)
|
|
|
|
if repo.currenttransaction():
|
|
|
|
repo.currenttransaction().abort()
|
2017-12-08 23:14:38 +03:00
|
|
|
else:
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
return _origrebase(ui, repo, rbsrt, **opts)
|
2011-10-11 08:01:25 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2019-03-26 05:22:16 +03:00
|
|
|
@perftrace.tracefunc("Rebase")
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
def _origrebase(ui, repo, rbsrt, **opts):
|
2017-06-19 21:18:05 +03:00
|
|
|
with repo.wlock(), repo.lock():
|
2008-08-18 23:16:31 +04:00
|
|
|
# Validate input and define rebasing points
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
destf = opts.get("dest", None)
|
|
|
|
srcf = opts.get("source", None)
|
|
|
|
basef = opts.get("base", None)
|
|
|
|
revf = opts.get("rev", [])
|
2016-04-30 19:41:08 +03:00
|
|
|
# search default destination in this space
|
|
|
|
# used in the 'hg pull --rebase' case, see issue 5214.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
destspace = opts.get("_destspace")
|
|
|
|
contf = opts.get("continue")
|
|
|
|
abortf = opts.get("abort")
|
|
|
|
if opts.get("interactive"):
|
2015-10-06 22:07:00 +03:00
|
|
|
try:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if extensions.find("histedit"):
|
|
|
|
enablehistedit = ""
|
2015-10-06 22:07:00 +03:00
|
|
|
except KeyError:
|
|
|
|
enablehistedit = " --config extensions.histedit="
|
|
|
|
help = "hg%s help -e histedit" % enablehistedit
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
msg = (
|
|
|
|
_(
|
|
|
|
"interactive history editing is supported by the "
|
|
|
|
"'histedit' extension (see \"%s\")"
|
|
|
|
)
|
|
|
|
% help
|
|
|
|
)
|
2015-10-08 22:55:45 +03:00
|
|
|
raise error.Abort(msg)
|
2014-09-01 13:48:55 +04:00
|
|
|
|
2016-06-21 16:29:23 +03:00
|
|
|
if rbsrt.collapsemsg and not rbsrt.collapsef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("message can only be specified with collapse"))
|
2011-03-15 20:33:36 +03:00
|
|
|
|
2008-08-18 23:16:31 +04:00
|
|
|
if contf or abortf:
|
|
|
|
if contf and abortf:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("cannot use both abort and continue"))
|
2016-06-21 16:29:23 +03:00
|
|
|
if rbsrt.collapsef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("cannot use collapse with continue or abort"))
|
2009-04-22 03:39:47 +04:00
|
|
|
if srcf or basef or destf:
|
2015-10-08 22:55:45 +03:00
|
|
|
raise error.Abort(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
_("abort and continue do not allow specifying revisions")
|
|
|
|
)
|
|
|
|
if abortf and opts.get("tool", False):
|
|
|
|
ui.warn(_("tool option will be ignored\n"))
|
2016-11-02 21:59:29 +03:00
|
|
|
if contf:
|
|
|
|
ms = mergemod.mergestate.read(repo)
|
2016-11-22 05:32:39 +03:00
|
|
|
mergeutil.checkunresolved(ms)
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2016-07-01 15:09:53 +03:00
|
|
|
retcode = rbsrt._prepareabortorcontinue(abortf)
|
|
|
|
if retcode is not None:
|
|
|
|
return retcode
|
2008-08-18 23:16:31 +04:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
destmap = _definedestmap(
|
|
|
|
ui, repo, rbsrt, destf, srcf, basef, revf, destspace=destspace
|
|
|
|
)
|
2017-08-11 10:32:19 +03:00
|
|
|
retcode = rbsrt._preparenewrebase(destmap)
|
2016-07-01 15:09:53 +03:00
|
|
|
if retcode is not None:
|
|
|
|
return retcode
|
2013-11-26 06:18:56 +04:00
|
|
|
|
2017-07-18 17:47:28 +03:00
|
|
|
tr = None
|
2017-07-20 11:30:41 +03:00
|
|
|
dsguard = None
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
singletr = ui.configbool("rebase", "singletransaction")
|
2017-07-20 11:30:41 +03:00
|
|
|
if singletr:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
tr = repo.transaction("rebase")
|
2018-01-03 16:35:56 +03:00
|
|
|
|
|
|
|
# If `rebase.singletransaction` is enabled, wrap the entire operation in
|
|
|
|
# one transaction here. Otherwise, transactions are obtained when
|
|
|
|
# committing each node, which is slower but allows partial success.
|
2017-07-18 17:47:28 +03:00
|
|
|
with util.acceptintervention(tr):
|
2018-01-03 16:35:56 +03:00
|
|
|
# Same logic for the dirstate guard, except we don't create one when
|
|
|
|
# rebasing in-memory (it's not needed).
|
rebase: fix a bug where rebases would wrongly be restarted
Summary:
If `rebase.experimental.inmemory` was enabled, but you ended up merging on-disk (e.g. you rebased the working copy parent), and you got merge conflicts, and didn't immediately solve them, hg would discard any work you did and restart the rebase unnecessarily.
The bug here is basically that `rbsrt.inmemory` field can be set to False later, because we make further calculations once we define the `rebaseset`. In that case `InterventionRequired` will get raised if the user didn't solve conflicts, but we'll catch it, thinking something went wrong "in-memory", and abort/rerun the rebase. I was too hasty in adding the "catch all exceptions and retry" block.
I solved this two ways -- first, move the rbsrt definition here and explicitly check the state in the Exception catch. Second, add an explicit catch for InterventionRequired and explain why with a comment.
Further refactoring of the rebase code will help here, I think, so we can consolidate all of this logic.
Reviewed By: DurhamG
Differential Revision: D6817683
fbshipit-source-id: eb8baba86ec0deb59a1e0b1cf9ffb02f056ecd92
2018-01-26 21:49:16 +03:00
|
|
|
if singletr and not rbsrt.inmemory:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
dsguard = dirstateguard.dirstateguard(repo, "rebase")
|
2017-07-20 11:30:41 +03:00
|
|
|
with util.acceptintervention(dsguard):
|
|
|
|
rbsrt._performrebase(tr)
|
2017-07-18 17:47:28 +03:00
|
|
|
|
2016-07-01 15:09:53 +03:00
|
|
|
rbsrt._finishrebase()
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
def _definedestmap(
|
|
|
|
ui, repo, rbsrt, destf=None, srcf=None, basef=None, revf=None, destspace=None
|
|
|
|
):
|
2017-08-11 10:32:19 +03:00
|
|
|
"""use revisions argument to define destmap {srcrev: destrev}"""
|
2017-03-16 01:03:43 +03:00
|
|
|
if revf is None:
|
|
|
|
revf = []
|
2017-03-13 07:56:39 +03:00
|
|
|
|
2016-04-30 19:41:08 +03:00
|
|
|
# destspace is here to work around issues with `hg pull --rebase` see
|
|
|
|
# issue5214 for details
|
2016-02-10 02:49:55 +03:00
|
|
|
if srcf and basef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("cannot specify both a source and a base"))
|
2016-02-10 02:49:55 +03:00
|
|
|
if revf and basef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("cannot specify both a revision and a base"))
|
2016-02-10 02:49:55 +03:00
|
|
|
if revf and srcf:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("cannot specify both a revision and a source"))
|
2016-02-10 02:49:55 +03:00
|
|
|
|
2018-03-09 06:19:29 +03:00
|
|
|
cmdutil.checkunfinished(repo)
|
2017-12-12 09:16:13 +03:00
|
|
|
if not rbsrt.inmemory:
|
2017-12-08 00:20:47 +03:00
|
|
|
cmdutil.bailifchanged(repo)
|
2016-02-10 02:49:55 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if ui.configbool("commands", "rebase.requiredest") and not destf:
|
|
|
|
raise error.Abort(
|
|
|
|
_("you must specify a destination"), hint=_("use: hg rebase -d REV")
|
|
|
|
)
|
2017-03-30 13:50:10 +03:00
|
|
|
|
2017-08-30 03:27:37 +03:00
|
|
|
dest = None
|
2016-02-10 02:49:55 +03:00
|
|
|
|
|
|
|
if revf:
|
|
|
|
rebaseset = scmutil.revrange(repo, revf)
|
|
|
|
if not rebaseset:
|
|
|
|
ui.status(_('empty "rev" revision set - nothing to rebase\n'))
|
2017-08-11 10:32:19 +03:00
|
|
|
return None
|
2016-02-10 02:49:55 +03:00
|
|
|
elif srcf:
|
|
|
|
src = scmutil.revrange(repo, [srcf])
|
|
|
|
if not src:
|
|
|
|
ui.status(_('empty "source" revision set - nothing to rebase\n'))
|
2017-08-11 10:32:19 +03:00
|
|
|
return None
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
rebaseset = repo.revs("(%ld)::", src)
|
2019-10-17 04:20:41 +03:00
|
|
|
if not rebaseset:
|
|
|
|
ui.status(_('"source" revision set is invisible - nothing to rebase\n'))
|
|
|
|
ui.status(_("(hint: use 'hg unhide' to make commits visible first)\n"))
|
|
|
|
return None
|
2016-02-10 02:49:55 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
base = scmutil.revrange(repo, [basef or "."])
|
2016-02-10 02:49:55 +03:00
|
|
|
if not base:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(_('empty "base" revision set - ' "can't compute rebase set\n"))
|
2017-08-11 10:32:19 +03:00
|
|
|
return None
|
2017-08-30 03:27:37 +03:00
|
|
|
if destf:
|
|
|
|
# --base does not support multiple destinations
|
|
|
|
dest = scmutil.revsingle(repo, destf)
|
|
|
|
else:
|
2016-04-30 19:41:08 +03:00
|
|
|
dest = repo[_destrebase(repo, base, destspace=destspace)]
|
2016-02-14 16:25:59 +03:00
|
|
|
destf = str(dest)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
roots = [] # selected children of branching points
|
|
|
|
bpbase = {} # {branchingpoint: [origbase]}
|
|
|
|
for b in base: # group bases by branching points
|
|
|
|
bp = repo.revs("ancestor(%d, %d)", b, dest).first()
|
2016-11-28 08:45:22 +03:00
|
|
|
bpbase[bp] = bpbase.get(bp, []) + [b]
|
|
|
|
if None in bpbase:
|
|
|
|
# emulate the old behavior, showing "nothing to rebase" (a better
|
|
|
|
# behavior may be abort with "cannot find branching point" error)
|
|
|
|
bpbase.clear()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
for bp, bs in bpbase.iteritems(): # calculate roots
|
|
|
|
roots += list(repo.revs("children(%d) & ancestors(%ld)", bp, bs))
|
2016-11-28 08:45:22 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
rebaseset = repo.revs("%ld::", roots)
|
2016-02-10 02:49:55 +03:00
|
|
|
|
|
|
|
if not rebaseset:
|
|
|
|
# transform to list because smartsets are not comparable to
|
|
|
|
# lists. This should be improved to honor laziness of
|
|
|
|
# smartset.
|
|
|
|
if list(base) == [dest.rev()]:
|
|
|
|
if basef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(
|
|
|
|
_('nothing to rebase - %s is both "base"' " and destination\n")
|
|
|
|
% dest
|
|
|
|
)
|
2016-02-10 02:49:55 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(
|
|
|
|
_(
|
|
|
|
"nothing to rebase - working directory "
|
|
|
|
"parent is also destination\n"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
elif not repo.revs("%ld - ::%d", base, dest):
|
2016-02-10 02:49:55 +03:00
|
|
|
if basef:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(
|
|
|
|
_(
|
|
|
|
'nothing to rebase - "base" %s is '
|
|
|
|
"already an ancestor of destination "
|
|
|
|
"%s\n"
|
|
|
|
)
|
|
|
|
% ("+".join(str(repo[r]) for r in base), dest)
|
|
|
|
)
|
2016-02-10 02:49:55 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(
|
|
|
|
_(
|
|
|
|
"nothing to rebase - working "
|
|
|
|
"directory parent is already an "
|
|
|
|
"ancestor of destination %s\n"
|
|
|
|
)
|
|
|
|
% dest
|
|
|
|
)
|
|
|
|
else: # can it happen?
|
|
|
|
ui.status(
|
|
|
|
_("nothing to rebase from %s to %s\n")
|
|
|
|
% ("+".join(str(repo[r]) for r in base), dest)
|
|
|
|
)
|
2017-08-11 10:32:19 +03:00
|
|
|
return None
|
2018-01-03 16:35:56 +03:00
|
|
|
|
2016-02-14 16:25:59 +03:00
|
|
|
if not destf:
|
2016-04-30 19:41:08 +03:00
|
|
|
dest = repo[_destrebase(repo, rebaseset, destspace=destspace)]
|
2016-02-14 16:25:59 +03:00
|
|
|
destf = str(dest)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
allsrc = revsetlang.formatspec("%ld", rebaseset)
|
|
|
|
alias = {"ALLSRC": allsrc}
|
2017-08-30 03:27:37 +03:00
|
|
|
|
|
|
|
if dest is None:
|
|
|
|
try:
|
|
|
|
# fast path: try to resolve dest without SRC alias
|
|
|
|
dest = scmutil.revsingle(repo, destf, localalias=alias)
|
|
|
|
except error.RepoLookupError:
|
|
|
|
# multi-dest path: resolve dest for each SRC separately
|
|
|
|
destmap = {}
|
|
|
|
for r in rebaseset:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
alias["SRC"] = revsetlang.formatspec("%d", r)
|
2017-08-30 03:27:37 +03:00
|
|
|
# use repo.anyrevs instead of scmutil.revsingle because we
|
|
|
|
# don't want to abort if destset is empty.
|
|
|
|
destset = repo.anyrevs([destf], user=True, localalias=alias)
|
|
|
|
size = len(destset)
|
|
|
|
if size == 1:
|
|
|
|
destmap[r] = destset.first()
|
|
|
|
elif size == 0:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.note(_("skipping %s - empty destination\n") % repo[r])
|
2017-08-30 03:27:37 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(
|
|
|
|
_("rebase destination for %s is not " "unique") % repo[r]
|
|
|
|
)
|
2017-08-30 03:27:37 +03:00
|
|
|
|
|
|
|
if dest is not None:
|
|
|
|
# single-dest case: assign dest to each rev in rebaseset
|
|
|
|
destrev = dest.rev()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
destmap = {r: destrev for r in rebaseset} # {srcrev: destrev}
|
2017-08-30 03:27:37 +03:00
|
|
|
|
2018-07-23 22:32:37 +03:00
|
|
|
rbsrt.rebasingwcp = destmap is not None and repo["."].rev() in destmap
|
2019-04-23 12:45:38 +03:00
|
|
|
ui.log("rebase", rebase_rebasing_wcp=rbsrt.rebasingwcp)
|
2018-07-23 22:32:37 +03:00
|
|
|
if rbsrt.inmemory and rbsrt.rebasingwcp:
|
|
|
|
# Require a clean working copy if rebasing the current commit, as the
|
|
|
|
# last step of the rebase is an update.
|
|
|
|
#
|
|
|
|
# Technically this could be refined to hg update's checker, which can
|
|
|
|
# be more permissive (e.g., allow if only non-conflicting paths are
|
|
|
|
# changed).
|
|
|
|
cmdutil.bailifchanged(repo)
|
|
|
|
|
2017-08-30 03:27:37 +03:00
|
|
|
if not destmap:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(_("nothing to rebase - empty destination\n"))
|
2017-08-30 03:27:37 +03:00
|
|
|
return None
|
2017-08-11 10:32:19 +03:00
|
|
|
|
|
|
|
return destmap
|
2016-02-10 02:49:55 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2018-12-13 21:41:51 +03:00
|
|
|
def _definepredmap(repo, rebaseset):
|
|
|
|
"""defines the predecessor map
|
|
|
|
|
|
|
|
Returns a map of {rev: [preds]}, where preds are the predecessors of the
|
|
|
|
rebased node that are also being rebased.
|
|
|
|
"""
|
|
|
|
clnode = repo.unfiltered().changelog.node
|
|
|
|
clrev = repo.unfiltered().changelog.rev
|
|
|
|
if mutation.enabled(repo):
|
|
|
|
predmap = {
|
|
|
|
r: [
|
|
|
|
p
|
|
|
|
for p in map(
|
|
|
|
clrev, mutation.predecessorsset(repo, clnode(r), closest=True)
|
|
|
|
)
|
|
|
|
if p in rebaseset and p != r
|
|
|
|
]
|
|
|
|
for r in rebaseset
|
|
|
|
}
|
|
|
|
else:
|
|
|
|
# Mutation is not enabled - ignore predecessor information.
|
|
|
|
predmap = {r: [] for r in rebaseset}
|
|
|
|
return predmap
|
|
|
|
|
|
|
|
|
2017-05-12 08:38:03 +03:00
|
|
|
def externalparent(repo, state, destancestors):
|
2013-10-24 08:05:22 +04:00
|
|
|
"""Return the revision that should be used as the second parent
|
2017-05-12 08:38:03 +03:00
|
|
|
when the revisions in state is collapsed on top of destancestors.
|
2013-10-24 08:05:22 +04:00
|
|
|
Abort if there is more than one parent.
|
2010-01-31 15:30:17 +03:00
|
|
|
"""
|
2013-10-24 08:05:22 +04:00
|
|
|
parents = set()
|
2010-01-31 15:30:17 +03:00
|
|
|
source = min(state)
|
|
|
|
for rev in state:
|
|
|
|
if rev == source:
|
|
|
|
continue
|
|
|
|
for p in repo[rev].parents():
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if p.rev() not in state and p.rev() not in destancestors:
|
2013-10-24 08:05:22 +04:00
|
|
|
parents.add(p.rev())
|
|
|
|
if not parents:
|
|
|
|
return nullrev
|
|
|
|
if len(parents) == 1:
|
|
|
|
return parents.pop()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(
|
|
|
|
_(
|
|
|
|
"unable to collapse on top of %s, there is more "
|
|
|
|
"than one external parent: %s"
|
|
|
|
)
|
|
|
|
% (max(destancestors), ", ".join(str(p) for p in sorted(parents)))
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def concludememorynode(
|
|
|
|
repo,
|
|
|
|
rev,
|
|
|
|
p1,
|
|
|
|
p2,
|
2019-11-14 07:18:00 +03:00
|
|
|
keepf,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
wctx=None,
|
|
|
|
commitmsg=None,
|
|
|
|
editor=None,
|
|
|
|
extrafn=None,
|
|
|
|
date=None,
|
2018-12-13 21:41:51 +03:00
|
|
|
copypreds=None,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
):
|
|
|
|
"""Commit the memory changes with parents p1 and p2. Reuse commit info from
|
2018-01-03 16:35:56 +03:00
|
|
|
rev but also store useful information in extra.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
Return node of committed revision."""
|
2017-12-08 09:35:43 +03:00
|
|
|
ctx = repo[rev]
|
|
|
|
if commitmsg is None:
|
|
|
|
commitmsg = ctx.description()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
extra = {"rebase_source": ctx.hex()}
|
2018-12-13 21:41:51 +03:00
|
|
|
preds = [ctx.node()]
|
|
|
|
mutop = "rebase"
|
mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache. This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.
This change makes the mutationstore the (sole) source of truth for mutation
data. The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.
Collecting the mutation information during commit creation is now done through
a new `mutinfo` object. This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.
The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.
The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit. Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.
The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.
Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information. We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.
Reviewed By: DurhamG
Differential Revision: D19410650
fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 12:01:10 +03:00
|
|
|
mutinfo = None
|
2018-12-13 21:41:51 +03:00
|
|
|
if copypreds:
|
|
|
|
preds.extend(repo.changelog.node(r) for r in copypreds)
|
|
|
|
mutop = "rebase-copy"
|
2019-11-14 07:18:00 +03:00
|
|
|
if not keepf:
|
mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache. This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.
This change makes the mutationstore the (sole) source of truth for mutation
data. The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.
Collecting the mutation information during commit creation is now done through
a new `mutinfo` object. This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.
The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.
The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit. Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.
The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.
Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information. We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.
Reviewed By: DurhamG
Differential Revision: D19410650
fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 12:01:10 +03:00
|
|
|
mutinfo = mutation.record(repo, extra, preds, mutop)
|
2017-12-08 09:35:43 +03:00
|
|
|
if extrafn:
|
|
|
|
extrafn(ctx, extra)
|
2019-04-11 01:12:54 +03:00
|
|
|
loginfo = {"predecessors": ctx.hex(), "mutation": "rebase"}
|
2017-12-08 09:35:43 +03:00
|
|
|
|
2019-12-06 06:25:51 +03:00
|
|
|
if "narrowheads" in repo.storerequirements:
|
|
|
|
# with narrow-heads, phases.new-commit is meaningless
|
|
|
|
overrides = {}
|
|
|
|
else:
|
|
|
|
destphase = max(ctx.phase(), phases.draft)
|
|
|
|
overrides = {("phases", "new-commit"): destphase}
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
with repo.ui.configoverride(overrides, "rebase"):
|
2017-12-08 09:35:43 +03:00
|
|
|
# Replicates the empty check in ``repo.commit``.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if wctx.isempty() and not repo.ui.configbool("ui", "allowemptycommit"):
|
2017-12-08 09:35:43 +03:00
|
|
|
return None
|
|
|
|
|
|
|
|
if date is None:
|
|
|
|
date = ctx.date()
|
|
|
|
|
|
|
|
branch = repo[p1].branch()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
memctx = wctx.tomemctx(
|
|
|
|
commitmsg,
|
|
|
|
parents=(p1, p2),
|
|
|
|
date=date,
|
|
|
|
extra=extra,
|
|
|
|
user=ctx.user(),
|
|
|
|
branch=branch,
|
|
|
|
editor=editor,
|
2019-04-11 01:12:54 +03:00
|
|
|
loginfo=loginfo,
|
mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache. This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.
This change makes the mutationstore the (sole) source of truth for mutation
data. The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.
Collecting the mutation information during commit creation is now done through
a new `mutinfo` object. This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.
The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.
The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit. Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.
The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.
Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information. We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.
Reviewed By: DurhamG
Differential Revision: D19410650
fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 12:01:10 +03:00
|
|
|
mutinfo=mutinfo,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2017-12-08 09:35:43 +03:00
|
|
|
commitres = repo.commitctx(memctx)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
wctx.clean() # Might be reused
|
2017-12-08 09:35:43 +03:00
|
|
|
return commitres
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
def concludenode(
|
|
|
|
repo,
|
|
|
|
rev,
|
|
|
|
p1,
|
|
|
|
p2,
|
2019-11-14 07:18:00 +03:00
|
|
|
keepf,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
commitmsg=None,
|
|
|
|
editor=None,
|
|
|
|
extrafn=None,
|
|
|
|
date=None,
|
2018-12-13 21:41:51 +03:00
|
|
|
copypreds=None,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
):
|
|
|
|
"""Commit the wd changes with parents p1 and p2. Reuse commit info from rev
|
2014-11-19 05:38:51 +03:00
|
|
|
but also store useful information in extra.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
Return node of committed revision."""
|
2017-07-20 11:30:41 +03:00
|
|
|
dsguard = util.nullcontextmanager()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if not repo.ui.configbool("rebase", "singletransaction"):
|
|
|
|
dsguard = dirstateguard.dirstateguard(repo, "rebase")
|
2017-07-20 11:30:41 +03:00
|
|
|
with dsguard:
|
2017-06-27 18:39:55 +03:00
|
|
|
repo.setparents(repo[p1].node(), repo[p2].node())
|
|
|
|
ctx = repo[rev]
|
|
|
|
if commitmsg is None:
|
|
|
|
commitmsg = ctx.description()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
extra = {"rebase_source": ctx.hex()}
|
2018-12-13 21:41:51 +03:00
|
|
|
preds = [ctx.node()]
|
|
|
|
mutop = "rebase"
|
mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache. This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.
This change makes the mutationstore the (sole) source of truth for mutation
data. The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.
Collecting the mutation information during commit creation is now done through
a new `mutinfo` object. This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.
The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.
The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit. Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.
The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.
Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information. We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.
Reviewed By: DurhamG
Differential Revision: D19410650
fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 12:01:10 +03:00
|
|
|
mutinfo = None
|
2018-12-13 21:41:51 +03:00
|
|
|
if copypreds:
|
|
|
|
preds.extend(repo.changelog.node(r) for r in copypreds)
|
|
|
|
mutop = "rebase-copy"
|
2019-11-14 07:18:00 +03:00
|
|
|
if not keepf:
|
mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache. This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.
This change makes the mutationstore the (sole) source of truth for mutation
data. The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.
Collecting the mutation information during commit creation is now done through
a new `mutinfo` object. This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.
The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.
The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit. Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.
The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.
Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information. We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.
Reviewed By: DurhamG
Differential Revision: D19410650
fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 12:01:10 +03:00
|
|
|
mutinfo = mutation.record(repo, extra, preds, mutop)
|
2017-06-27 18:39:55 +03:00
|
|
|
if extrafn:
|
|
|
|
extrafn(ctx, extra)
|
2019-04-11 01:12:54 +03:00
|
|
|
loginfo = {"predecessors": ctx.hex(), "mutation": "rebase"}
|
2017-06-27 18:39:55 +03:00
|
|
|
|
2017-06-30 01:21:52 +03:00
|
|
|
destphase = max(ctx.phase(), phases.draft)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
overrides = {("phases", "new-commit"): destphase}
|
|
|
|
with repo.ui.configoverride(overrides, "rebase"):
|
2017-06-27 18:39:55 +03:00
|
|
|
# Commit might fail if unresolved files exist
|
|
|
|
if date is None:
|
|
|
|
date = ctx.date()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
newnode = repo.commit(
|
2019-04-11 01:12:54 +03:00
|
|
|
text=commitmsg,
|
|
|
|
user=ctx.user(),
|
|
|
|
date=date,
|
|
|
|
extra=extra,
|
|
|
|
editor=editor,
|
|
|
|
loginfo=loginfo,
|
mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache. This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.
This change makes the mutationstore the (sole) source of truth for mutation
data. The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.
Collecting the mutation information during commit creation is now done through
a new `mutinfo` object. This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.
The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.
The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit. Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.
The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.
Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information. We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.
Reviewed By: DurhamG
Differential Revision: D19410650
fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 12:01:10 +03:00
|
|
|
mutinfo=mutinfo,
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
)
|
2017-06-27 18:39:55 +03:00
|
|
|
|
|
|
|
repo.dirstate.setbranch(repo[newnode].branch())
|
|
|
|
return newnode
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-12-08 03:07:06 +03:00
|
|
|
def rebasenode(repo, rev, p1, base, state, collapse, dest, wctx):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"Rebase a single revision rev on top of p1 using base as merge ancestor"
|
2008-08-18 23:16:31 +04:00
|
|
|
# Merge phase
|
2017-05-12 08:38:03 +03:00
|
|
|
# Update to destination and merge it with local
|
2017-12-08 03:07:06 +03:00
|
|
|
if wctx.isinmemory():
|
|
|
|
wctx.setbase(repo[p1])
|
2008-08-18 23:16:31 +04:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if repo["."].rev() != p1:
|
2017-12-08 03:07:06 +03:00
|
|
|
repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
|
|
|
|
mergemod.update(repo, p1, False, True)
|
|
|
|
else:
|
|
|
|
repo.ui.debug(" already in destination\n")
|
2017-12-13 09:05:21 +03:00
|
|
|
# This is, alas, necessary to invalidate workingctx's manifest cache,
|
|
|
|
# as well as other data we litter on it in other places.
|
|
|
|
wctx = repo[None]
|
2017-12-08 03:07:06 +03:00
|
|
|
repo.dirstate.write(repo.currenttransaction())
|
2014-12-02 07:12:59 +03:00
|
|
|
repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
|
2013-10-30 22:45:14 +04:00
|
|
|
if base is not None:
|
2014-12-02 07:12:59 +03:00
|
|
|
repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
|
rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.
I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.
The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.
The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.
And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 17:14:58 +04:00
|
|
|
# When collapsing in-place, the parent is the common ancestor, we
|
|
|
|
# have to allow merging with it.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
stats = mergemod.update(
|
|
|
|
repo, rev, True, True, base, collapse, labels=["dest", "source"], wc=wctx
|
|
|
|
)
|
2014-10-14 02:55:45 +04:00
|
|
|
if collapse:
|
2017-10-16 06:36:29 +03:00
|
|
|
copies.duplicatecopies(repo, wctx, rev, dest)
|
2014-10-14 02:55:45 +04:00
|
|
|
else:
|
|
|
|
# If we're not using --collapse, we need to
|
|
|
|
# duplicate copies between the revision we're
|
|
|
|
# rebasing and its first parent, but *not*
|
|
|
|
# duplicate any copies that have already been
|
|
|
|
# performed in the destination.
|
|
|
|
p1rev = repo[rev].p1().rev()
|
2017-10-16 06:36:29 +03:00
|
|
|
copies.duplicatecopies(repo, wctx, rev, p1rev, skiprev=dest)
|
2014-10-14 02:55:45 +04:00
|
|
|
return stats
|
2008-08-21 13:35:17 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-08-27 12:47:47 +03:00
|
|
|
def adjustdest(repo, rev, destmap, state, skipped):
|
2017-07-25 09:52:56 +03:00
|
|
|
"""adjust rebase destination given the current rebase state
|
|
|
|
|
|
|
|
rev is what is being rebased. Return a list of two revs, which are the
|
|
|
|
adjusted destinations for rev's p1 and p2, respectively. If a parent is
|
|
|
|
nullrev, return dest without adjustment for it.
|
|
|
|
|
2017-08-30 03:27:37 +03:00
|
|
|
For example, when doing rebasing B+E to F, C to G, rebase will first move B
|
|
|
|
to B1, and E's destination will be adjusted from F to B1.
|
2017-07-25 09:52:56 +03:00
|
|
|
|
|
|
|
B1 <- written during rebasing B
|
|
|
|
|
|
|
|
|
F <- original destination of B, E
|
|
|
|
|
|
|
|
|
| E <- rev, which is being rebased
|
|
|
|
| |
|
|
|
|
| D <- prev, one parent of rev being checked
|
|
|
|
| |
|
|
|
|
| x <- skipped, ex. no successor or successor in (::dest)
|
|
|
|
| |
|
2017-08-30 03:27:37 +03:00
|
|
|
| C <- rebased as C', different destination
|
2017-07-25 09:52:56 +03:00
|
|
|
| |
|
2017-08-30 03:27:37 +03:00
|
|
|
| B <- rebased as B1 C'
|
|
|
|
|/ |
|
|
|
|
A G <- destination of C, different
|
2017-07-25 09:52:56 +03:00
|
|
|
|
|
|
|
Another example about merge changeset, rebase -r C+G+H -d K, rebase will
|
|
|
|
first move C to C1, G to G1, and when it's checking H, the adjusted
|
|
|
|
destinations will be [C1, G1].
|
|
|
|
|
|
|
|
H C1 G1
|
|
|
|
/| | /
|
|
|
|
F G |/
|
|
|
|
K | | -> K
|
|
|
|
| C D |
|
|
|
|
| |/ |
|
|
|
|
| B | ...
|
|
|
|
|/ |/
|
|
|
|
A A
|
2017-08-22 06:22:07 +03:00
|
|
|
|
|
|
|
Besides, adjust dest according to existing rebase information. For example,
|
|
|
|
|
|
|
|
B C D B needs to be rebased on top of C, C needs to be rebased on top
|
|
|
|
\|/ of D. We will rebase C first.
|
|
|
|
A
|
|
|
|
|
|
|
|
C' After rebasing C, when considering B's destination, use C'
|
|
|
|
| instead of the original C.
|
|
|
|
B D
|
|
|
|
\ /
|
|
|
|
A
|
2017-07-25 09:52:56 +03:00
|
|
|
"""
|
2017-08-11 10:32:19 +03:00
|
|
|
# pick already rebased revs with same dest from state as interesting source
|
|
|
|
dest = destmap[rev]
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
source = [
|
|
|
|
s for s, d in state.items() if d > 0 and destmap[s] == dest and s not in skipped
|
|
|
|
]
|
2017-08-11 11:08:07 +03:00
|
|
|
|
2017-07-25 09:52:56 +03:00
|
|
|
result = []
|
|
|
|
for prev in repo.changelog.parentrevs(rev):
|
|
|
|
adjusted = dest
|
|
|
|
if prev != nullrev:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
candidate = repo.revs("max(%ld and (::%d))", source, prev).first()
|
2017-07-25 09:52:56 +03:00
|
|
|
if candidate is not None:
|
|
|
|
adjusted = state[candidate]
|
2017-08-22 06:22:07 +03:00
|
|
|
if adjusted == dest and dest in state:
|
|
|
|
adjusted = state[dest]
|
|
|
|
if adjusted == revtodo:
|
|
|
|
# sortsource should produce an order that makes this impossible
|
|
|
|
raise error.ProgrammingError(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"rev %d should be rebased already at this time" % dest
|
|
|
|
)
|
2017-07-25 09:52:56 +03:00
|
|
|
result.append(adjusted)
|
|
|
|
return result
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-07-14 19:01:45 +03:00
|
|
|
def _checkobsrebase(repo, ui, rebaseobsrevs, rebaseobsskipped):
|
2016-03-29 21:49:45 +03:00
|
|
|
"""
|
|
|
|
Abort if rebase will create divergence or rebase is noop because of markers
|
|
|
|
|
|
|
|
`rebaseobsrevs`: set of obsolete revision in source
|
|
|
|
`rebaseobsskipped`: set of revisions from source skipped because they have
|
|
|
|
successors in destination
|
|
|
|
"""
|
|
|
|
# Obsolete node with successors not in dest leads to divergence
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
divergenceok = ui.configbool("experimental", "evolution.allowdivergence")
|
2016-03-29 21:49:45 +03:00
|
|
|
divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
|
|
|
|
|
|
|
|
if divergencebasecandidates and not divergenceok:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
divhashes = (str(repo[r]) for r in divergencebasecandidates)
|
|
|
|
msg = _("this rebase will cause " "divergences from: %s")
|
|
|
|
h = _(
|
|
|
|
"to force the rebase please set "
|
|
|
|
"experimental.evolution.allowdivergence=True"
|
|
|
|
)
|
2016-03-29 21:49:45 +03:00
|
|
|
raise error.Abort(msg % (",".join(divhashes),), hint=h)
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-09-07 02:17:04 +03:00
|
|
|
def successorrevs(unfi, rev):
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
"""yield revision numbers for successors of rev"""
|
2017-09-07 02:17:04 +03:00
|
|
|
assert unfi.filtername is None
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
nodemap = unfi.changelog.nodemap
|
2019-03-08 14:01:08 +03:00
|
|
|
node = unfi[rev].node()
|
|
|
|
if mutation.enabled(unfi):
|
|
|
|
successors = mutation.allsuccessors(unfi, [node])
|
|
|
|
else:
|
|
|
|
successors = obsutil.allsuccessors(unfi.obsstore, [node])
|
|
|
|
for s in successors:
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
if s in nodemap:
|
|
|
|
yield nodemap[s]
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-08-27 12:47:47 +03:00
|
|
|
def defineparents(repo, rev, destmap, state, skipped, obsskipped):
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
"""Return new parents and optionally a merge base for rev being rebased
|
|
|
|
|
|
|
|
The destination specified by "dest" cannot always be used directly because
|
|
|
|
previously rebase result could affect destination. For example,
|
|
|
|
|
|
|
|
D E rebase -r C+D+E -d B
|
|
|
|
|/ C will be rebased to C'
|
|
|
|
B C D's new destination will be C' instead of B
|
|
|
|
|/ E's new destination will be C' instead of B
|
|
|
|
A
|
|
|
|
|
|
|
|
The new parents of a merge is slightly more complicated. See the comment
|
|
|
|
block below.
|
|
|
|
"""
|
2017-09-06 22:40:00 +03:00
|
|
|
# use unfiltered changelog since successorrevs may return filtered nodes
|
2017-09-07 02:17:04 +03:00
|
|
|
assert repo.filtername is None
|
|
|
|
cl = repo.changelog
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
def isancestor(a, b):
|
|
|
|
# take revision numbers instead of nodes
|
|
|
|
if a == b:
|
|
|
|
return True
|
|
|
|
elif a > b:
|
|
|
|
return False
|
|
|
|
return cl.isancestor(cl.node(a), cl.node(b))
|
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
dest = destmap[rev]
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
oldps = repo.changelog.parentrevs(rev) # old parents
|
|
|
|
newps = [nullrev, nullrev] # new parents
|
2017-08-27 12:47:47 +03:00
|
|
|
dests = adjustdest(repo, rev, destmap, state, skipped)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
bases = list(oldps) # merge base candidates, initially just old parents
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
|
|
|
|
if all(r == nullrev for r in oldps[1:]):
|
|
|
|
# For non-merge changeset, just move p to adjusted dest as requested.
|
|
|
|
newps[0] = dests[0]
|
2014-11-19 05:38:51 +03:00
|
|
|
else:
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# For merge changeset, if we move p to dests[i] unconditionally, both
|
|
|
|
# parents may change and the end result looks like "the merge loses a
|
|
|
|
# parent", which is a surprise. This is a limit because "--dest" only
|
|
|
|
# accepts one dest per src.
|
2014-11-19 05:38:51 +03:00
|
|
|
#
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# Therefore, only move p with reasonable conditions (in this order):
|
|
|
|
# 1. use dest, if dest is a descendent of (p or one of p's successors)
|
|
|
|
# 2. use p's rebased result, if p is rebased (state[p] > 0)
|
2015-01-04 03:29:07 +03:00
|
|
|
#
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# Comparing with adjustdest, the logic here does some additional work:
|
|
|
|
# 1. decide which parents will not be moved towards dest
|
|
|
|
# 2. if the above decision is "no", should a parent still be moved
|
|
|
|
# because it was rebased?
|
2014-11-19 05:38:51 +03:00
|
|
|
#
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# For example:
|
2014-11-19 05:38:51 +03:00
|
|
|
#
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# C # "rebase -r C -d D" is an error since none of the parents
|
|
|
|
# /| # can be moved. "rebase -r B+C -d D" will move C's parent
|
|
|
|
# A B D # B (using rule "2."), since B will be rebased.
|
2015-01-04 03:29:07 +03:00
|
|
|
#
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# The loop tries to be not rely on the fact that a Mercurial node has
|
|
|
|
# at most 2 parents.
|
|
|
|
for i, p in enumerate(oldps):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
np = p # new parent
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
if any(isancestor(x, dests[i]) for x in successorrevs(repo, p)):
|
|
|
|
np = dests[i]
|
|
|
|
elif p in state and state[p] > 0:
|
|
|
|
np = state[p]
|
|
|
|
|
|
|
|
# "bases" only record "special" merge bases that cannot be
|
|
|
|
# calculated from changelog DAG (i.e. isancestor(p, np) is False).
|
|
|
|
# For example:
|
|
|
|
#
|
|
|
|
# B' # rebase -s B -d D, when B was rebased to B'. dest for C
|
|
|
|
# | C # is B', but merge base for C is B, instead of
|
|
|
|
# D | # changelog.ancestor(C, B') == A. If changelog DAG and
|
|
|
|
# | B # "state" edges are merged (so there will be an edge from
|
|
|
|
# |/ # B to B'), the merge base is still ancestor(C, B') in
|
|
|
|
# A # the merged graph.
|
|
|
|
#
|
|
|
|
# Also see https://bz.mercurial-scm.org/show_bug.cgi?id=1950#c8
|
|
|
|
# which uses "virtual null merge" to explain this situation.
|
|
|
|
if isancestor(p, np):
|
|
|
|
bases[i] = nullrev
|
|
|
|
|
|
|
|
# If one parent becomes an ancestor of the other, drop the ancestor
|
|
|
|
for j, x in enumerate(newps[:i]):
|
|
|
|
if x == nullrev:
|
|
|
|
continue
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if isancestor(np, x): # CASE-1
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
np = nullrev
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
elif isancestor(x, np): # CASE-2
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
newps[j] = np
|
|
|
|
np = nullrev
|
2017-08-11 08:17:15 +03:00
|
|
|
# New parents forming an ancestor relationship does not
|
|
|
|
# mean the old parents have a similar relationship. Do not
|
|
|
|
# set bases[x] to nullrev.
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
bases[j], bases[i] = bases[i], bases[j]
|
|
|
|
|
|
|
|
newps[i] = np
|
|
|
|
|
|
|
|
# "rebasenode" updates to new p1, and the old p1 will be used as merge
|
|
|
|
# base. If only p2 changes, merging using unchanged p1 as merge base is
|
|
|
|
# suboptimal. Therefore swap parents to make the merge sane.
|
|
|
|
if newps[1] != nullrev and oldps[0] == newps[0]:
|
|
|
|
assert len(newps) == 2 and len(oldps) == 2
|
|
|
|
newps.reverse()
|
|
|
|
bases.reverse()
|
|
|
|
|
|
|
|
# No parent change might be an error because we fail to make rev a
|
|
|
|
# descendent of requested dest. This can happen, for example:
|
2016-04-12 00:33:07 +03:00
|
|
|
#
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# C # rebase -r C -d D
|
|
|
|
# /| # None of A and B will be changed to D and rebase fails.
|
|
|
|
# A B D
|
|
|
|
if set(newps) == set(oldps) and dest not in newps:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(
|
|
|
|
_("cannot rebase %d:%s without " "moving at least one of its parents")
|
|
|
|
% (rev, repo[rev])
|
|
|
|
)
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
|
2017-08-22 06:22:07 +03:00
|
|
|
# Source should not be ancestor of dest. The check here guarantees it's
|
|
|
|
# impossible. With multi-dest, the initial check does not cover complex
|
|
|
|
# cases since we don't have abstractions to dry-run rebase cheaply.
|
|
|
|
if any(p != nullrev and isancestor(rev, p) for p in newps):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("source is ancestor of destination"))
|
2017-08-22 06:22:07 +03:00
|
|
|
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
# "rebasenode" updates to new p1, use the corresponding merge base.
|
|
|
|
if bases[0] != nullrev:
|
|
|
|
base = bases[0]
|
|
|
|
else:
|
|
|
|
base = None
|
|
|
|
|
|
|
|
# Check if the merge will contain unwanted changes. That may happen if
|
|
|
|
# there are multiple special (non-changelog ancestor) merge bases, which
|
|
|
|
# cannot be handled well by the 3-way merge algorithm. For example:
|
|
|
|
#
|
|
|
|
# F
|
|
|
|
# /|
|
|
|
|
# D E # "rebase -r D+E+F -d Z", when rebasing F, if "D" was chosen
|
|
|
|
# | | # as merge base, the difference between D and F will include
|
|
|
|
# B C # C, so the rebased F will contain C surprisingly. If "E" was
|
|
|
|
# |/ # chosen, the rebased F will contain B.
|
|
|
|
# A Z
|
|
|
|
#
|
|
|
|
# But our merge base candidates (D and E in above case) could still be
|
|
|
|
# better than the default (ancestor(F, Z) == null). Therefore still
|
|
|
|
# pick one (so choose p1 above).
|
|
|
|
if sum(1 for b in bases if b != nullrev) > 1:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
unwanted = [None, None] # unwanted[i]: unwanted revs if choose bases[i]
|
2017-08-11 08:17:15 +03:00
|
|
|
for i, base in enumerate(bases):
|
|
|
|
if base == nullrev:
|
|
|
|
continue
|
|
|
|
# Revisions in the side (not chosen as merge base) branch that
|
|
|
|
# might contain "surprising" contents
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
siderevs = list(repo.revs("((%ld-%d) %% (%d+%d))", bases, base, base, dest))
|
2017-08-11 08:17:15 +03:00
|
|
|
|
|
|
|
# If those revisions are covered by rebaseset, the result is good.
|
|
|
|
# A merge in rebaseset would be considered to cover its ancestors.
|
|
|
|
if siderevs:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
rebaseset = [
|
|
|
|
r for r, d in state.items() if d > 0 and r not in obsskipped
|
|
|
|
]
|
|
|
|
merges = [r for r in rebaseset if cl.parentrevs(r)[1] != nullrev]
|
|
|
|
unwanted[i] = list(
|
|
|
|
repo.revs("%ld - (::%ld) - %ld", siderevs, merges, rebaseset)
|
|
|
|
)
|
2017-08-11 08:17:15 +03:00
|
|
|
|
|
|
|
# Choose a merge base that has a minimal number of unwanted revs.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
l, i = min(
|
|
|
|
(len(revs), i) for i, revs in enumerate(unwanted) if revs is not None
|
|
|
|
)
|
2017-08-11 08:17:15 +03:00
|
|
|
base = bases[i]
|
|
|
|
|
|
|
|
# newps[0] should match merge base if possible. Currently, if newps[i]
|
|
|
|
# is nullrev, the only case is newps[i] and newps[j] (j < i), one is
|
|
|
|
# the other's ancestor. In that case, it's fine to not swap newps here.
|
|
|
|
# (see CASE-1 and CASE-2 above)
|
|
|
|
if i != 0 and newps[i] != nullrev:
|
|
|
|
newps[0], newps[i] = newps[i], newps[0]
|
|
|
|
|
|
|
|
# The merge will include unwanted revisions. Abort now. Revisit this if
|
|
|
|
# we have a more advanced merge algorithm that handles multiple bases.
|
|
|
|
if l > 0:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
unwanteddesc = _(" or ").join(
|
|
|
|
(
|
|
|
|
", ".join("%d:%s" % (r, repo[r]) for r in revs)
|
|
|
|
for revs in unwanted
|
|
|
|
if revs is not None
|
|
|
|
)
|
|
|
|
)
|
2017-08-11 08:17:15 +03:00
|
|
|
raise error.Abort(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
_("rebasing %d:%s will include unwanted changes from %s")
|
|
|
|
% (rev, repo[rev], unwanteddesc)
|
|
|
|
)
|
2017-08-11 08:17:15 +03:00
|
|
|
|
|
|
|
repo.ui.debug(" future parents are %d and %d\n" % tuple(newps))
|
rebase: rewrite core algorithm (issue5578) (issue5630)
"defineparents" is the core algorithm of rebase. The old code has too many
tech debts (like outdated comments, confusing assertions, etc) and is very
error-prone to be improved. This patch rewrites "defineparents" to make the
code easier to reason about, and solve a bunch of issues, including:
- Assertion error: no base found (demonstrated by D212, issue5578)
- Asymmetric result (demonstrated by D211, "F with one parent")
- Wrong new parent (demonstrated by D262, "C':A'A'")
- "revlog index out of range" (demonstrated by D262, issue5630)
- "nothing to merge" (demonstrated by D262)
As a side effect, merge base decision has been made more solid - rebase now
prints out explicitly what could go wrong when it cannot find a unique
suitable merge base.
.. fix:: Issue 5578, Issue 5630
Core rebase algorithm has been rewritten to be more robust.
Differential Revision: https://phab.mercurial-scm.org/D21
2017-08-11 07:30:31 +03:00
|
|
|
|
|
|
|
return newps[0], newps[1], base
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-02-18 00:45:01 +03:00
|
|
|
def storecollapsemsg(repo, collapsemsg):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"Store the collapse message to allow recovery"
|
|
|
|
collapsemsg = collapsemsg or ""
|
2018-09-28 17:08:56 +03:00
|
|
|
f = repo.localvfs("last-message.txt", "w")
|
2016-02-18 00:45:01 +03:00
|
|
|
f.write("%s\n" % collapsemsg)
|
|
|
|
f.close()
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-02-18 00:45:01 +03:00
|
|
|
def clearcollapsemsg(repo):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"Remove collapse message file"
|
2018-09-28 17:08:56 +03:00
|
|
|
repo.localvfs.unlinkpath("last-message.txt", ignoremissing=True)
|
2016-02-18 00:45:01 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-03-08 03:30:31 +03:00
|
|
|
def restorecollapsemsg(repo, isabort):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"Restore previously stored collapse message"
|
2016-02-18 00:45:01 +03:00
|
|
|
try:
|
2018-09-28 17:08:56 +03:00
|
|
|
f = repo.localvfs("last-message.txt")
|
2016-02-18 00:45:01 +03:00
|
|
|
collapsemsg = f.readline().strip()
|
|
|
|
f.close()
|
|
|
|
except IOError as err:
|
|
|
|
if err.errno != errno.ENOENT:
|
|
|
|
raise
|
2017-03-08 03:30:31 +03:00
|
|
|
if isabort:
|
|
|
|
# Oh well, just abort like normal
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
collapsemsg = ""
|
2017-03-08 03:30:31 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("missing .hg/last-message.txt for rebase"))
|
2016-02-18 00:45:01 +03:00
|
|
|
return collapsemsg
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2008-08-18 23:16:31 +04:00
|
|
|
def clearstatus(repo):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"Remove the status files"
|
2017-06-25 07:13:48 +03:00
|
|
|
# Make sure the active transaction won't write the state file
|
|
|
|
tr = repo.currenttransaction()
|
|
|
|
if tr:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
tr.removefilegenerator("rebasestate")
|
2018-09-28 17:08:56 +03:00
|
|
|
repo.localvfs.unlinkpath("rebasestate", ignoremissing=True)
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2015-05-10 17:57:24 +03:00
|
|
|
def needupdate(repo, state):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"""check whether we should `update --clean` away from a merge, or if
|
|
|
|
somehow the working dir got forcibly updated, e.g. by older hg"""
|
2015-11-12 04:07:15 +03:00
|
|
|
parents = [p.rev() for p in repo[None].parents()]
|
2013-08-02 02:33:09 +04:00
|
|
|
|
2015-05-10 17:57:24 +03:00
|
|
|
# Are we in a merge state at all?
|
|
|
|
if len(parents) < 2:
|
|
|
|
return False
|
|
|
|
|
|
|
|
# We should be standing on the first as-of-yet unrebased commit.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
firstunrebased = min([old for old, new in state.iteritems() if new == nullrev])
|
2015-05-10 17:57:24 +03:00
|
|
|
if firstunrebased in parents:
|
|
|
|
return True
|
2013-08-02 02:33:09 +04:00
|
|
|
|
|
|
|
return False
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
def abort(repo, originalwd, destmap, state, activebookmark=None):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"""Restore the repository to its original state. Additional args:
|
2015-04-13 21:54:02 +03:00
|
|
|
|
|
|
|
activebookmark: the name of the bookmark that should be active after the
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
restore"""
|
2015-10-14 00:06:51 +03:00
|
|
|
|
2015-10-15 22:13:46 +03:00
|
|
|
try:
|
|
|
|
# If the first commits in the rebased set get skipped during the rebase,
|
2017-05-12 08:38:03 +03:00
|
|
|
# their values within the state mapping will be the dest rev id. The
|
2018-04-10 21:03:27 +03:00
|
|
|
# rebased list must must not contain the dest rev (issue4896)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
rebased = [s for r, s in state.items() if s >= 0 and s != r and s != destmap[r]]
|
2018-04-10 21:03:27 +03:00
|
|
|
immutable = [d for d in rebased if not repo[d].mutable()]
|
2015-10-15 22:13:46 +03:00
|
|
|
cleanup = True
|
|
|
|
if immutable:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.warn(
|
|
|
|
_("warning: can't clean up public changesets %s\n")
|
|
|
|
% ", ".join(str(repo[r]) for r in immutable),
|
|
|
|
hint=_("see 'hg help phases' for details"),
|
|
|
|
)
|
2015-10-15 22:13:46 +03:00
|
|
|
cleanup = False
|
|
|
|
|
|
|
|
descendants = set()
|
2018-04-10 21:03:27 +03:00
|
|
|
if rebased:
|
|
|
|
descendants = set(repo.changelog.descendants(rebased))
|
|
|
|
if descendants - set(rebased):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.warn(
|
|
|
|
_(
|
|
|
|
"warning: new changesets detected on destination "
|
|
|
|
"branch, can't strip\n"
|
|
|
|
)
|
|
|
|
)
|
2015-10-15 22:13:46 +03:00
|
|
|
cleanup = False
|
|
|
|
|
|
|
|
if cleanup:
|
2016-02-05 04:56:46 +03:00
|
|
|
shouldupdate = False
|
2017-03-08 01:19:08 +03:00
|
|
|
|
|
|
|
updateifonnodes = set(rebased)
|
2017-08-11 10:32:19 +03:00
|
|
|
updateifonnodes.update(destmap.values())
|
2017-03-08 01:19:08 +03:00
|
|
|
updateifonnodes.add(originalwd)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
shouldupdate = repo["."].rev() in updateifonnodes
|
2016-02-05 04:56:46 +03:00
|
|
|
|
2015-10-15 22:13:46 +03:00
|
|
|
# Update away from the rebase if necessary
|
2016-02-05 04:56:46 +03:00
|
|
|
if shouldupdate or needupdate(repo, state):
|
2016-11-02 21:56:07 +03:00
|
|
|
mergemod.update(repo, originalwd, False, True)
|
2015-10-15 22:13:46 +03:00
|
|
|
|
|
|
|
# Strip from the first rebased revision
|
|
|
|
if rebased:
|
|
|
|
# no backup of rebased cset versions needed
|
2018-08-18 20:40:40 +03:00
|
|
|
nodes = map(repo.changelog.node, rebased)
|
|
|
|
scmutil.cleanupnodes(repo, nodes, "rebase")
|
2015-10-15 22:13:46 +03:00
|
|
|
|
|
|
|
if activebookmark and activebookmark in repo._bookmarks:
|
|
|
|
bookmarks.activate(repo, activebookmark)
|
|
|
|
|
|
|
|
finally:
|
|
|
|
clearstatus(repo)
|
2016-02-18 00:45:01 +03:00
|
|
|
clearcollapsemsg(repo)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.warn(_("rebase aborted\n"))
|
2013-08-02 02:54:12 +04:00
|
|
|
return 0
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-08-22 06:22:07 +03:00
|
|
|
def sortsource(destmap):
|
|
|
|
"""yield source revisions in an order that we only rebase things once
|
|
|
|
|
|
|
|
If source and destination overlaps, we should filter out revisions
|
|
|
|
depending on other revisions which hasn't been rebased yet.
|
|
|
|
|
|
|
|
Yield a sorted list of revisions each time.
|
|
|
|
|
|
|
|
For example, when rebasing A to B, B to C. This function yields [B], then
|
|
|
|
[A], indicating B needs to be rebased first.
|
|
|
|
|
|
|
|
Raise if there is a cycle so the rebase is impossible.
|
|
|
|
"""
|
|
|
|
srcset = set(destmap)
|
|
|
|
while srcset:
|
|
|
|
srclist = sorted(srcset)
|
|
|
|
result = []
|
|
|
|
for r in srclist:
|
|
|
|
if destmap[r] not in srcset:
|
|
|
|
result.append(r)
|
|
|
|
if not result:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("source and destination form a cycle"))
|
2017-08-22 06:22:07 +03:00
|
|
|
srcset -= set(result)
|
|
|
|
yield result
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-08-27 12:47:47 +03:00
|
|
|
def buildstate(repo, destmap, collapse):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"""Define which revisions are going to be rebased and where
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2011-10-15 21:07:51 +04:00
|
|
|
repo: repo
|
2017-08-11 10:32:19 +03:00
|
|
|
destmap: {srcrev: destrev}
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"""
|
2017-08-11 10:32:19 +03:00
|
|
|
rebaseset = destmap.keys()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
originalwd = repo["."].rev()
|
2008-08-18 23:16:31 +04:00
|
|
|
|
2017-08-22 06:22:07 +03:00
|
|
|
# Get "cycle" error early by exhausting the generator.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
sortedsrc = list(sortsource(destmap)) # a list of sorted revs
|
2017-08-22 06:22:07 +03:00
|
|
|
if not sortedsrc:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("no matching revisions"))
|
2017-08-22 06:22:07 +03:00
|
|
|
|
|
|
|
# Only check the first batch of revisions to rebase not depending on other
|
|
|
|
# rebaseset. This means "source is ancestor of destination" for the second
|
|
|
|
# (and following) batches of revisions are not checked here. We rely on
|
|
|
|
# "defineparents" to do that check.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
roots = list(repo.set("roots(%ld)", sortedsrc[0]))
|
2011-10-15 21:07:51 +04:00
|
|
|
if not roots:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("no matching revisions"))
|
2013-01-17 03:35:01 +04:00
|
|
|
roots.sort()
|
2017-03-11 23:25:56 +03:00
|
|
|
state = dict.fromkeys(rebaseset, revtodo)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
emptyrebase = len(sortedsrc) == 1
|
2013-01-17 03:35:01 +04:00
|
|
|
for root in roots:
|
2017-08-11 10:32:19 +03:00
|
|
|
dest = repo[destmap[root.rev()]]
|
2013-01-17 03:35:01 +04:00
|
|
|
commonbase = root.ancestor(dest)
|
|
|
|
if commonbase == root:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
raise error.Abort(_("source is ancestor of destination"))
|
2013-01-17 03:35:01 +04:00
|
|
|
if commonbase == dest:
|
2017-03-13 02:44:01 +03:00
|
|
|
wctx = repo[None]
|
|
|
|
if dest == wctx.p1():
|
|
|
|
# when rebasing to '.', it will use the current wd branch name
|
|
|
|
samebranch = root.branch() == wctx.branch()
|
|
|
|
else:
|
|
|
|
samebranch = root.branch() == dest.branch()
|
2017-06-18 09:09:47 +03:00
|
|
|
if not collapse and samebranch and dest in root.parents():
|
2017-05-11 21:37:18 +03:00
|
|
|
# mark the revision as done by setting its new revision
|
|
|
|
# equal to its old (current) revisions
|
|
|
|
state[root.rev()] = root.rev()
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.debug("source is a child of destination\n")
|
2017-05-11 21:37:18 +03:00
|
|
|
continue
|
2013-01-17 03:35:01 +04:00
|
|
|
|
2017-05-11 21:37:18 +03:00
|
|
|
emptyrebase = False
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
repo.ui.debug("rebase onto %s starting from %s\n" % (dest, root))
|
2017-05-11 21:37:18 +03:00
|
|
|
if emptyrebase:
|
|
|
|
return None
|
|
|
|
for rev in sorted(state):
|
|
|
|
parents = [p for p in repo.changelog.parentrevs(rev) if p != nullrev]
|
|
|
|
# if all parents of this revision are done, then so is this revision
|
|
|
|
if parents and all((state.get(p) == p for p in parents)):
|
|
|
|
state[rev] = rev
|
2017-08-11 10:32:19 +03:00
|
|
|
return originalwd, destmap, state
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
|
|
|
def clearrebased(
|
2018-06-07 01:21:34 +03:00
|
|
|
ui, repo, templ, destmap, state, skipped, collapsedas=None, keepf=False
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
):
|
2012-09-19 01:42:27 +04:00
|
|
|
"""dispose of rebased revision at the end of the rebase
|
|
|
|
|
|
|
|
If `collapsedas` is not None, the rebase was a collapse whose result if the
|
2017-09-18 20:54:00 +03:00
|
|
|
`collapsedas` node.
|
|
|
|
|
|
|
|
If `keepf` is not True, the rebase has --keep set and no nodes should be
|
|
|
|
removed (but bookmarks still need to be moved).
|
|
|
|
"""
|
2017-07-08 04:51:46 +03:00
|
|
|
tonode = repo.changelog.node
|
2018-06-07 01:21:34 +03:00
|
|
|
replacements = util.sortdict()
|
2017-09-18 20:54:00 +03:00
|
|
|
moves = {}
|
2017-07-08 05:03:03 +03:00
|
|
|
for rev, newrev in sorted(state.items()):
|
|
|
|
if newrev >= 0 and newrev != rev:
|
2017-09-18 20:54:00 +03:00
|
|
|
oldnode = tonode(rev)
|
|
|
|
newnode = collapsedas or tonode(newrev)
|
|
|
|
moves[oldnode] = newnode
|
|
|
|
if not keepf:
|
|
|
|
if rev in skipped:
|
|
|
|
succs = ()
|
|
|
|
else:
|
|
|
|
succs = (newnode,)
|
|
|
|
replacements[oldnode] = succs
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
scmutil.cleanupnodes(repo, replacements, "rebase", moves)
|
2018-06-07 01:21:34 +03:00
|
|
|
if templ:
|
|
|
|
templ.setprop("nodereplacements", replacements)
|
2012-09-19 00:58:12 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2008-10-23 02:34:52 +04:00
|
|
|
def pullrebase(orig, ui, repo, *args, **opts):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
"Call rebase after pull if the latter has been invoked with --rebase"
|
2015-11-16 00:18:48 +03:00
|
|
|
ret = None
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if opts.get(r"rebase"):
|
|
|
|
if ui.configbool("commands", "rebase.requiredest"):
|
|
|
|
msg = _("rebase destination required by configuration")
|
|
|
|
hint = _("use hg pull followed by hg rebase -d DEST")
|
2017-03-30 13:50:10 +03:00
|
|
|
raise error.Abort(msg, hint=hint)
|
|
|
|
|
2017-06-19 21:18:12 +03:00
|
|
|
with repo.wlock(), repo.lock():
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if opts.get(r"update"):
|
|
|
|
del opts[r"update"]
|
|
|
|
ui.debug(
|
|
|
|
"--update and --rebase are not compatible, ignoring "
|
|
|
|
"the update flag\n"
|
|
|
|
)
|
2015-08-12 02:45:11 +03:00
|
|
|
|
2017-01-01 15:16:29 +03:00
|
|
|
cmdutil.checkunfinished(repo)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
cmdutil.bailifchanged(
|
|
|
|
repo,
|
|
|
|
hint=_(
|
|
|
|
"cannot pull with rebase: "
|
|
|
|
"please commit or shelve your changes first"
|
|
|
|
),
|
|
|
|
)
|
2017-01-01 15:16:29 +03:00
|
|
|
|
2015-08-12 02:45:11 +03:00
|
|
|
revsprepull = len(repo)
|
|
|
|
origpostincoming = commands.postincoming
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2015-08-12 02:45:11 +03:00
|
|
|
def _dummy(*args, **kwargs):
|
|
|
|
pass
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2015-08-12 02:45:11 +03:00
|
|
|
commands.postincoming = _dummy
|
|
|
|
try:
|
2015-11-16 00:18:48 +03:00
|
|
|
ret = orig(ui, repo, *args, **opts)
|
2015-08-12 02:45:11 +03:00
|
|
|
finally:
|
|
|
|
commands.postincoming = origpostincoming
|
|
|
|
revspostpull = len(repo)
|
|
|
|
if revspostpull > revsprepull:
|
|
|
|
# --rev option from pull conflict with rebase own --rev
|
|
|
|
# dropping it
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if r"rev" in opts:
|
|
|
|
del opts[r"rev"]
|
2015-08-12 02:45:11 +03:00
|
|
|
# positional argument from pull conflicts with rebase's own
|
|
|
|
# --source.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if r"source" in opts:
|
|
|
|
del opts[r"source"]
|
2016-04-30 19:39:39 +03:00
|
|
|
# revsprepull is the len of the repo, not revnum of tip.
|
|
|
|
destspace = list(repo.changelog.revs(start=revsprepull))
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
opts[r"_destspace"] = destspace
|
2016-02-14 16:25:59 +03:00
|
|
|
try:
|
|
|
|
rebase(ui, repo, **opts)
|
|
|
|
except error.NoMergeDestAbort:
|
|
|
|
# we can maybe update instead
|
2016-02-14 03:45:17 +03:00
|
|
|
rev, _a, _b = destutil.destupdate(repo)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if rev == repo["."].rev():
|
|
|
|
ui.status(_("nothing to rebase\n"))
|
2016-02-14 16:25:59 +03:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.status(_("nothing to rebase - updating instead\n"))
|
2016-02-14 03:45:17 +03:00
|
|
|
# not passing argument to get the bare update behavior
|
|
|
|
# with warning and trumpets
|
|
|
|
commands.update(ui, repo)
|
2008-08-18 23:16:31 +04:00
|
|
|
else:
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if opts.get(r"tool"):
|
|
|
|
raise error.Abort(_("--tool can only be used with --rebase"))
|
2015-11-16 00:18:48 +03:00
|
|
|
ret = orig(ui, repo, *args, **opts)
|
|
|
|
|
|
|
|
return ret
|
2008-08-18 23:16:31 +04:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2016-01-14 22:50:28 +03:00
|
|
|
def _filterobsoleterevs(repo, revs):
|
|
|
|
"""returns a set of the obsolete revisions in revs"""
|
|
|
|
return set(r for r in revs if repo[r].obsolete())
|
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2017-08-11 10:32:19 +03:00
|
|
|
def _computeobsoletenotrebased(repo, rebaseobsrevs, destmap):
|
2017-11-15 00:46:10 +03:00
|
|
|
"""Return (obsoletenotrebased, obsoletewithoutsuccessorindestination).
|
|
|
|
|
|
|
|
`obsoletenotrebased` is a mapping mapping obsolete => successor for all
|
|
|
|
obsolete nodes to be rebased given in `rebaseobsrevs`.
|
2015-11-19 00:44:29 +03:00
|
|
|
|
2017-11-15 00:46:10 +03:00
|
|
|
`obsoletewithoutsuccessorindestination` is a set with obsolete revisions
|
|
|
|
without a successor in destination.
|
|
|
|
"""
|
2015-09-15 03:31:48 +03:00
|
|
|
obsoletenotrebased = {}
|
2017-11-15 00:46:10 +03:00
|
|
|
obsoletewithoutsuccessorindestination = set([])
|
2015-09-15 03:31:48 +03:00
|
|
|
|
2017-09-07 02:17:04 +03:00
|
|
|
assert repo.filtername is None
|
|
|
|
cl = repo.changelog
|
2017-08-11 10:31:52 +03:00
|
|
|
nodemap = cl.nodemap
|
|
|
|
for srcrev in rebaseobsrevs:
|
|
|
|
srcnode = cl.node(srcrev)
|
2017-08-11 10:32:19 +03:00
|
|
|
destnode = cl.node(destmap[srcrev])
|
2017-08-11 10:31:52 +03:00
|
|
|
# XXX: more advanced APIs are required to handle split correctly
|
2019-03-08 14:01:08 +03:00
|
|
|
# allsuccessors can include nodes that aren't present
|
2018-05-15 21:23:07 +03:00
|
|
|
# in the repo and changelog nodemap. This is normal if CommitCloud
|
|
|
|
# extension is enabled.
|
2019-03-08 14:01:08 +03:00
|
|
|
if mutation.enabled(repo):
|
|
|
|
successors = list(mutation.allsuccessors(repo, [srcnode]))
|
|
|
|
else:
|
|
|
|
successors = list(obsutil.allsuccessors(repo.obsstore, [srcnode]))
|
2017-08-11 10:31:52 +03:00
|
|
|
if len(successors) == 1:
|
2019-03-08 14:01:08 +03:00
|
|
|
# allsuccessors includes node itself. When the list only
|
2017-08-11 10:31:52 +03:00
|
|
|
# contains one element, it means there are no successors.
|
|
|
|
obsoletenotrebased[srcrev] = None
|
|
|
|
else:
|
|
|
|
for succnode in successors:
|
|
|
|
if succnode == srcnode or succnode not in nodemap:
|
|
|
|
continue
|
|
|
|
if cl.isancestor(succnode, destnode):
|
|
|
|
obsoletenotrebased[srcrev] = nodemap[succnode]
|
|
|
|
break
|
2017-11-15 00:46:10 +03:00
|
|
|
else:
|
|
|
|
# If 'srcrev' has a successor in rebase set but none in
|
|
|
|
# destination (which would be catched above), we shall skip it
|
|
|
|
# and its descendants to avoid divergence.
|
2019-03-08 14:01:08 +03:00
|
|
|
# allsuccessors can include nodes that aren't present
|
2018-05-15 21:23:07 +03:00
|
|
|
# in changelog nodemap.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
if any(
|
|
|
|
nodemap[s] in destmap
|
|
|
|
for s in successors
|
|
|
|
if s != srcnode and s in nodemap
|
|
|
|
):
|
2017-11-15 00:46:10 +03:00
|
|
|
obsoletewithoutsuccessorindestination.add(srcrev)
|
|
|
|
|
|
|
|
return obsoletenotrebased, obsoletewithoutsuccessorindestination
|
2015-09-15 03:31:48 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2013-05-14 22:23:17 +04:00
|
|
|
def summaryhook(ui, repo):
|
2018-09-28 17:08:56 +03:00
|
|
|
if not repo.localvfs.exists("rebasestate"):
|
2013-05-14 22:23:17 +04:00
|
|
|
return
|
2013-09-30 19:35:07 +04:00
|
|
|
try:
|
2018-06-07 01:21:34 +03:00
|
|
|
rbsrt = rebaseruntime(repo, ui, None, {})
|
2016-06-21 16:29:23 +03:00
|
|
|
rbsrt.restorestatus()
|
|
|
|
state = rbsrt.state
|
2013-09-30 19:35:07 +04:00
|
|
|
except error.RepoLookupError:
|
|
|
|
# i18n: column positioning for "hg summary"
|
|
|
|
msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n')
|
|
|
|
ui.write(msg)
|
|
|
|
return
|
2014-12-04 18:03:02 +03:00
|
|
|
numrebased = len([i for i in state.itervalues() if i >= 0])
|
2013-05-14 22:23:17 +04:00
|
|
|
# i18n: column positioning for "hg summary"
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
ui.write(
|
|
|
|
_("rebase: %s, %s (rebase --continue)\n")
|
|
|
|
% (
|
|
|
|
ui.label(_("%d rebased"), "rebase.rebased") % numrebased,
|
|
|
|
ui.label(_("%d remaining"), "rebase.remaining") % (len(state) - numrebased),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2013-05-14 22:23:17 +04:00
|
|
|
|
2008-08-18 23:16:31 +04:00
|
|
|
def uisetup(ui):
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
# Replace pull with a decorator to provide --rebase option
|
|
|
|
entry = extensions.wrapcommand(commands.table, "pull", pullrebase)
|
2018-10-23 21:38:42 +03:00
|
|
|
entry[1].append(
|
|
|
|
("", "rebase", None, _("rebase current commit or current stack onto master"))
|
|
|
|
)
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
entry[1].append(("t", "tool", "", _("specify merge tool for rebase")))
|
|
|
|
cmdutil.summaryhooks.add("rebase", summaryhook)
|
2013-07-25 08:51:44 +04:00
|
|
|
cmdutil.unfinishedstates.append(
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
[
|
|
|
|
"rebasestate",
|
|
|
|
False,
|
|
|
|
False,
|
|
|
|
_("rebase in progress"),
|
|
|
|
_("use 'hg rebase --continue' or 'hg rebase --abort'"),
|
|
|
|
]
|
|
|
|
)
|
2019-10-09 00:18:34 +03:00
|
|
|
cmdutil.afterresolvedstates.append(("rebasestate", "hg rebase --continue"))
|