2019-11-01 23:24:22 +03:00
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
2016-06-24 18:12:05 +03:00
|
|
|
#
|
|
|
|
# This software may be used and distributed according to the terms of the
|
2019-11-01 23:24:22 +03:00
|
|
|
# GNU General Public License version 2.
|
|
|
|
|
2017-03-24 07:16:29 +03:00
|
|
|
"""track previous positions of bookmarks (EXPERIMENTAL)
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
This extension adds a new command: `hg journal`, which shows you where
|
|
|
|
bookmarks were previously located.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import absolute_import
|
|
|
|
|
|
|
|
import collections
|
2016-07-11 16:45:41 +03:00
|
|
|
import errno
|
2016-06-24 18:12:05 +03:00
|
|
|
import os
|
2016-07-11 15:39:24 +03:00
|
|
|
import weakref
|
2016-06-24 18:12:05 +03:00
|
|
|
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial import (
|
2016-06-24 18:12:05 +03:00
|
|
|
bookmarks,
|
|
|
|
cmdutil,
|
|
|
|
dispatch,
|
|
|
|
error,
|
|
|
|
extensions,
|
2016-07-11 16:45:41 +03:00
|
|
|
hg,
|
2016-07-11 15:39:24 +03:00
|
|
|
localrepo,
|
|
|
|
lock,
|
2016-06-24 18:12:05 +03:00
|
|
|
node,
|
2017-10-22 21:34:12 +03:00
|
|
|
pycompat,
|
2016-01-09 17:07:20 +03:00
|
|
|
registrar,
|
2016-06-24 18:12:05 +03:00
|
|
|
util,
|
|
|
|
)
|
2019-01-30 03:25:33 +03:00
|
|
|
from edenscm.mercurial.i18n import _
|
2016-06-24 18:12:05 +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
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
cmdtable = {}
|
2016-01-09 17:07:20 +03:00
|
|
|
command = registrar.command(cmdtable)
|
2016-06-24 18:12:05 +03:00
|
|
|
|
2016-08-23 18:26:08 +03:00
|
|
|
# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
|
2016-06-24 18:12:05 +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"
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
# storage format version; increment when the format changes
|
|
|
|
storageversion = 0
|
|
|
|
|
|
|
|
# namespaces
|
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
|
|
|
bookmarktype = "bookmark"
|
|
|
|
wdirparenttype = "wdirparent"
|
2016-07-11 16:45:41 +03:00
|
|
|
# In a shared repository, what shared feature name is used
|
|
|
|
# to indicate this namespace is shared with the 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
|
|
|
sharednamespaces = {bookmarktype: hg.sharedbookmarks}
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
# Journal recording, register hooks and storage object
|
|
|
|
def extsetup(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
|
|
|
extensions.wrapfunction(dispatch, "runcommand", runcommand)
|
|
|
|
extensions.wrapfunction(bookmarks.bmstore, "_write", recordbookmarks)
|
|
|
|
extensions.wrapfilecache(localrepo.localrepository, "dirstate", wrapdirstate)
|
|
|
|
extensions.wrapfunction(hg, "postshare", wrappostshare)
|
|
|
|
extensions.wrapfunction(hg, "copystore", unsharejournal)
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
def reposetup(ui, repo):
|
|
|
|
if repo.local():
|
|
|
|
repo.journal = journalstorage(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._wlockfreeprefix.add("namejournal")
|
2016-06-24 18:12:05 +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
|
|
|
dirstate, cached = localrepo.isfilecached(repo, "dirstate")
|
2017-07-10 17:09:51 +03:00
|
|
|
if cached:
|
|
|
|
# already instantiated dirstate isn't yet marked as
|
|
|
|
# "journal"-ing, even though repo.dirstate() was already
|
|
|
|
# wrapped by own wrapdirstate()
|
|
|
|
_setupdirstate(repo, dirstate)
|
|
|
|
|
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-24 18:12:05 +03:00
|
|
|
def runcommand(orig, lui, repo, cmd, fullargs, *args):
|
|
|
|
"""Track the command line options for recording in the journal"""
|
|
|
|
journalstorage.recordcommand(*fullargs)
|
|
|
|
return orig(lui, repo, cmd, fullargs, *args)
|
|
|
|
|
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-10 17:09:51 +03:00
|
|
|
def _setupdirstate(repo, dirstate):
|
|
|
|
dirstate.journalstorage = repo.journal
|
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
|
|
|
dirstate.addparentchangecallback("journal", recorddirstateparents)
|
|
|
|
|
2017-07-10 17:09:51 +03:00
|
|
|
|
2016-07-11 15:39:24 +03:00
|
|
|
# hooks to record dirstate changes
|
|
|
|
def wrapdirstate(orig, repo):
|
|
|
|
"""Make journal storage available to the dirstate object"""
|
|
|
|
dirstate = orig(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 util.safehasattr(repo, "journal"):
|
2017-07-10 17:09:51 +03:00
|
|
|
_setupdirstate(repo, dirstate)
|
2016-07-11 15:39:24 +03:00
|
|
|
return dirstate
|
|
|
|
|
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-08-09 19:15:46 +03:00
|
|
|
def recorddirstateparents(dirstate, old, new):
|
2016-07-11 15:39:24 +03:00
|
|
|
"""Records all dirstate parent changes in the journal."""
|
2016-08-09 19:15:46 +03:00
|
|
|
old = list(old)
|
|
|
|
new = list(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
|
|
|
if util.safehasattr(dirstate, "journalstorage"):
|
2016-08-09 19:15:46 +03:00
|
|
|
# only record two hashes if there was a merge
|
|
|
|
oldhashes = old[:1] if old[1] == node.nullid else old
|
|
|
|
newhashes = new[:1] if new[1] == node.nullid else 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
|
|
|
dirstate.journalstorage.record(wdirparenttype, ".", oldhashes, newhashes)
|
|
|
|
|
2016-07-11 15:39:24 +03:00
|
|
|
|
|
|
|
# hooks to record bookmark changes (both local and remote)
|
2016-06-24 18:12:05 +03:00
|
|
|
def recordbookmarks(orig, store, fp):
|
|
|
|
"""Records all bookmark changes in the journal."""
|
|
|
|
repo = store._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 util.safehasattr(repo, "journal"):
|
2016-06-24 18:12:05 +03:00
|
|
|
oldmarks = bookmarks.bmstore(repo)
|
2020-01-29 03:25:29 +03:00
|
|
|
for mark, value in pycompat.iteritems(store):
|
2016-06-24 18:12:05 +03:00
|
|
|
oldvalue = oldmarks.get(mark, node.nullid)
|
|
|
|
if value != oldvalue:
|
|
|
|
repo.journal.record(bookmarktype, mark, oldvalue, value)
|
|
|
|
return orig(store, fp)
|
|
|
|
|
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-07-11 16:45:41 +03:00
|
|
|
def _mergeentriesiter(*iterables, **kwargs):
|
|
|
|
"""Given a set of sorted iterables, yield the next entry in merged order
|
|
|
|
|
|
|
|
Note that by default entries go from most recent to oldest.
|
|
|
|
"""
|
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
|
|
|
order = kwargs.pop(r"order", max)
|
2016-07-11 16:45:41 +03:00
|
|
|
iterables = [iter(it) for it in iterables]
|
|
|
|
# this tracks still active iterables; iterables are deleted as they are
|
|
|
|
# exhausted, which is why this is a dictionary and why each entry also
|
|
|
|
# stores the key. Entries are mutable so we can store the next value each
|
|
|
|
# time.
|
|
|
|
iterable_map = {}
|
|
|
|
for key, it in enumerate(iterables):
|
|
|
|
try:
|
|
|
|
iterable_map[key] = [next(it), key, it]
|
|
|
|
except StopIteration:
|
|
|
|
# empty entry, can be ignored
|
|
|
|
pass
|
|
|
|
|
|
|
|
while iterable_map:
|
2020-01-29 03:25:29 +03:00
|
|
|
value, key, it = order(pycompat.itervalues(iterable_map))
|
2016-07-11 16:45:41 +03:00
|
|
|
yield value
|
|
|
|
try:
|
|
|
|
iterable_map[key][0] = next(it)
|
|
|
|
except StopIteration:
|
|
|
|
# this iterable is empty, remove it from consideration
|
|
|
|
del iterable_map[key]
|
|
|
|
|
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-07-11 16:45:41 +03:00
|
|
|
def wrappostshare(orig, sourcerepo, destrepo, **kwargs):
|
|
|
|
"""Mark this shared working copy as sharing journal information"""
|
2016-08-08 19:05:10 +03:00
|
|
|
with destrepo.wlock():
|
|
|
|
orig(sourcerepo, destrepo, **kwargs)
|
2018-09-28 17:09:02 +03:00
|
|
|
with destrepo.localvfs("shared", "a") as fp:
|
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
|
|
|
fp.write("journal\n")
|
|
|
|
|
2016-07-11 16:45:41 +03:00
|
|
|
|
|
|
|
def unsharejournal(orig, ui, repo, repopath):
|
|
|
|
"""Copy shared journal entries into this repo when unsharing"""
|
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.path == repopath and repo.shared() and util.safehasattr(repo, "journal"):
|
2018-09-28 17:09:02 +03:00
|
|
|
if repo.shared() and "journal" in repo.sharedfeatures:
|
2016-07-11 16:45:41 +03:00
|
|
|
# there is a shared repository and there are shared journal entries
|
2018-09-28 17:09:02 +03:00
|
|
|
# to copy. move shared data over from source to destination but
|
|
|
|
# rename the local file first
|
|
|
|
if repo.localvfs.exists("namejournal"):
|
|
|
|
journalpath = repo.localvfs.join("namejournal")
|
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.rename(journalpath, journalpath + ".bak")
|
2016-07-11 16:45:41 +03:00
|
|
|
storage = repo.journal
|
|
|
|
local = storage._open(
|
2018-09-28 17:09:02 +03:00
|
|
|
repo.localvfs, filename="namejournal.bak", _newestfirst=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
|
|
|
)
|
2016-07-11 16:45:41 +03:00
|
|
|
shared = (
|
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
|
2018-09-28 17:09:02 +03:00
|
|
|
for e in storage._open(repo.sharedvfs, _newestfirst=False)
|
|
|
|
if sharednamespaces.get(e.namespace) in repo.sharedfeatures
|
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-07-11 16:45:41 +03:00
|
|
|
for entry in _mergeentriesiter(local, shared, order=min):
|
2018-09-28 17:09:02 +03:00
|
|
|
storage._write(repo.localvfs, [entry])
|
2016-07-11 16:45:41 +03:00
|
|
|
|
|
|
|
return orig(ui, repo, repopath)
|
|
|
|
|
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
|
|
|
|
|
|
|
class journalentry(
|
|
|
|
collections.namedtuple(
|
|
|
|
u"journalentry", u"timestamp user command namespace name oldhashes newhashes"
|
|
|
|
)
|
|
|
|
):
|
2016-06-24 18:12:05 +03:00
|
|
|
"""Individual journal entry
|
|
|
|
|
|
|
|
* timestamp: a mercurial (time, timezone) tuple
|
|
|
|
* user: the username that ran the command
|
|
|
|
* namespace: the entry namespace, an opaque string
|
|
|
|
* name: the name of the changed item, opaque string with meaning in the
|
|
|
|
namespace
|
|
|
|
* command: the hg command that triggered this record
|
|
|
|
* oldhashes: a tuple of one or more binary hashes for the old location
|
|
|
|
* newhashes: a tuple of one or more binary hashes for the new location
|
|
|
|
|
|
|
|
Handles serialisation from and to the storage format. Fields are
|
|
|
|
separated by newlines, hashes are written out in hex separated by commas,
|
|
|
|
timestamp and timezone are separated by a space.
|
|
|
|
|
|
|
|
"""
|
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-24 18:12:05 +03:00
|
|
|
@classmethod
|
|
|
|
def fromstorage(cls, line):
|
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
|
|
|
(time, user, command, namespace, name, oldhashes, newhashes) = line.split("\n")
|
2016-06-24 18:12:05 +03:00
|
|
|
timestamp, tz = time.split()
|
|
|
|
timestamp, tz = float(timestamp), int(tz)
|
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
|
|
|
oldhashes = tuple(node.bin(hash) for hash in oldhashes.split(","))
|
|
|
|
newhashes = tuple(node.bin(hash) for hash in newhashes.split(","))
|
2016-06-24 18:12:05 +03:00
|
|
|
return cls(
|
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
|
|
|
(timestamp, tz), user, command, namespace, name, oldhashes, newhashes
|
|
|
|
)
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
"""String representation for storage"""
|
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
|
|
|
time = " ".join(map(str, self.timestamp))
|
|
|
|
oldhashes = ",".join([node.hex(hash) for hash in self.oldhashes])
|
|
|
|
newhashes = ",".join([node.hex(hash) for hash in self.newhashes])
|
|
|
|
return "\n".join(
|
|
|
|
(
|
|
|
|
time,
|
|
|
|
self.user,
|
|
|
|
self.command,
|
|
|
|
self.namespace,
|
|
|
|
self.name,
|
|
|
|
oldhashes,
|
|
|
|
newhashes,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
class journalstorage(object):
|
|
|
|
"""Storage for journal entries
|
|
|
|
|
2016-07-11 16:45:41 +03:00
|
|
|
Entries are divided over two files; one with entries that pertain to the
|
|
|
|
local working copy *only*, and one with entries that are shared across
|
|
|
|
multiple working copies when shared using the share extension.
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
Entries are stored with NUL bytes as separators. See the journalentry
|
|
|
|
class for the per-entry structure.
|
|
|
|
|
|
|
|
The file format starts with an integer version, delimited by a NUL.
|
|
|
|
|
2016-07-11 15:39:24 +03:00
|
|
|
This storage uses a dedicated lock; this makes it easier to avoid issues
|
|
|
|
with adding entries that added when the regular wlock is unlocked (e.g.
|
|
|
|
the dirstate).
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
"""
|
2018-05-30 12:16:33 +03:00
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
_currentcommand = ()
|
2016-07-11 15:39:24 +03:00
|
|
|
_lockref = None
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
def __init__(self, repo):
|
|
|
|
self.user = util.getuser()
|
2016-07-11 15:39:24 +03:00
|
|
|
self.ui = repo.ui
|
2018-09-28 17:09:02 +03:00
|
|
|
self.localvfs = repo.localvfs
|
|
|
|
self.sharedfeatures = repo.sharedfeatures
|
|
|
|
if repo.shared() and "journal" in self.sharedfeatures:
|
|
|
|
self.sharedvfs = repo.sharedvfs
|
|
|
|
else:
|
|
|
|
self.sharedvfs = None
|
2016-07-11 16:45:41 +03:00
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
# track the current command for recording in journal entries
|
|
|
|
@property
|
|
|
|
def command(self):
|
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
|
|
|
commandstr = " ".join(map(util.shellquote, journalstorage._currentcommand))
|
|
|
|
if "\n" in commandstr:
|
2016-06-24 18:12:05 +03:00
|
|
|
# truncate multi-line commands
|
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
|
|
|
commandstr = commandstr.partition("\n")[0] + " ..."
|
2016-06-24 18:12:05 +03:00
|
|
|
return commandstr
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def recordcommand(cls, *fullargs):
|
|
|
|
"""Set the current hg arguments, stored with recorded entries"""
|
|
|
|
# Set the current command on the class because we may have started
|
|
|
|
# with a non-local repo (cloning for example).
|
|
|
|
cls._currentcommand = fullargs
|
|
|
|
|
2016-09-13 21:30:19 +03:00
|
|
|
def _currentlock(self, lockref):
|
|
|
|
"""Returns the lock if it's held, or None if it's not.
|
|
|
|
|
|
|
|
(This is copied from the localrepo class)
|
|
|
|
"""
|
|
|
|
if lockref is None:
|
|
|
|
return None
|
|
|
|
l = lockref()
|
|
|
|
if l is None or not l.held:
|
|
|
|
return None
|
|
|
|
return l
|
|
|
|
|
2016-07-11 16:45:41 +03:00
|
|
|
def jlock(self, vfs):
|
2016-07-11 15:39:24 +03:00
|
|
|
"""Create a lock for the journal file"""
|
2016-09-13 21:30:19 +03:00
|
|
|
if self._currentlock(self._lockref) 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
|
|
|
raise error.Abort(_("journal lock does not support nesting"))
|
|
|
|
desc = _("journal of %s") % vfs.base
|
2016-07-11 15:39:24 +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
|
|
|
l = lock.lock(vfs, "namejournal.lock", 0, desc=desc)
|
2016-07-11 15:39:24 +03:00
|
|
|
except error.LockHeld as inst:
|
2018-08-14 00:55:47 +03:00
|
|
|
self.ui.warn(
|
|
|
|
_("waiting for lock on %s held by %r\n") % (desc, inst.lockinfo)
|
|
|
|
)
|
2016-07-11 15:39:24 +03:00
|
|
|
# default to 600 seconds timeout
|
|
|
|
l = lock.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
|
|
|
vfs, "namejournal.lock", self.ui.configint("ui", "timeout"), desc=desc
|
|
|
|
)
|
2016-07-11 15:39:24 +03:00
|
|
|
self.ui.warn(_("got lock after %s seconds\n") % l.delay)
|
|
|
|
self._lockref = weakref.ref(l)
|
|
|
|
return l
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
def record(self, namespace, name, oldhashes, newhashes):
|
|
|
|
"""Record a new journal entry
|
|
|
|
|
|
|
|
* namespace: an opaque string; this can be used to filter on the type
|
|
|
|
of recorded entries.
|
|
|
|
* name: the name defining this entry; for bookmarks, this is the
|
|
|
|
bookmark name. Can be filtered on when retrieving entries.
|
|
|
|
* oldhashes and newhashes: each a single binary hash, or a list of
|
|
|
|
binary hashes. These represent the old and new position of the named
|
|
|
|
item.
|
|
|
|
|
|
|
|
"""
|
2018-07-19 10:29:42 +03:00
|
|
|
|
|
|
|
entry = self._buildjournalentry(namespace, name, oldhashes, newhashes)
|
|
|
|
vfs = self._getvfs(namespace)
|
|
|
|
|
|
|
|
self._write(vfs, [entry])
|
|
|
|
|
|
|
|
def recordmany(self, namespace, entrydata):
|
|
|
|
"""Batch version of `record()`
|
|
|
|
|
|
|
|
Records a lot of entries at once. namespace is the same as in `record()`
|
|
|
|
`entrydata` is an iterable of `(name, oldhashes, newhashes)`
|
|
|
|
"""
|
|
|
|
vfs = self._getvfs(namespace)
|
|
|
|
|
|
|
|
entries = []
|
|
|
|
for name, oldhashes, newhashes in entrydata:
|
|
|
|
entry = self._buildjournalentry(namespace, name, oldhashes, newhashes)
|
|
|
|
entries.append(entry)
|
|
|
|
|
|
|
|
self._write(vfs, entries)
|
|
|
|
|
|
|
|
def _getvfs(self, namespace):
|
2018-09-28 17:09:02 +03:00
|
|
|
# write to the shared repository if this feature is being
|
|
|
|
# shared between working copies.
|
|
|
|
if (
|
|
|
|
self.sharedvfs is not None
|
|
|
|
and sharednamespaces.get(namespace) in self.sharedfeatures
|
|
|
|
):
|
|
|
|
return self.sharedvfs
|
|
|
|
else:
|
|
|
|
return self.localvfs
|
2018-07-19 10:29:42 +03:00
|
|
|
|
|
|
|
def _buildjournalentry(self, namespace, name, oldhashes, newhashes):
|
2016-06-24 18:12:05 +03:00
|
|
|
if not isinstance(oldhashes, list):
|
|
|
|
oldhashes = [oldhashes]
|
|
|
|
if not isinstance(newhashes, list):
|
|
|
|
newhashes = [newhashes]
|
|
|
|
|
2018-07-19 10:29:42 +03:00
|
|
|
return journalentry(
|
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.makedate(),
|
|
|
|
self.user,
|
|
|
|
self.command,
|
|
|
|
namespace,
|
|
|
|
name,
|
|
|
|
oldhashes,
|
|
|
|
newhashes,
|
|
|
|
)
|
2016-06-24 18:12:05 +03:00
|
|
|
|
2018-07-19 10:29:42 +03:00
|
|
|
def _write(self, vfs, entries):
|
2016-07-11 16:45:41 +03:00
|
|
|
with self.jlock(vfs):
|
2016-06-24 18:12:05 +03:00
|
|
|
version = None
|
|
|
|
# open file in amend mode to ensure it is created if missing
|
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 vfs("namejournal", mode="a+b") as f:
|
2016-06-24 18:12:05 +03:00
|
|
|
f.seek(0, os.SEEK_SET)
|
|
|
|
# Read just enough bytes to get a version number (up to 2
|
|
|
|
# digits plus separator)
|
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
|
|
|
version = f.read(3).partition("\0")[0]
|
2016-06-24 18:12:05 +03:00
|
|
|
if version and version != str(storageversion):
|
|
|
|
# different version of the storage. Exit early (and not
|
|
|
|
# write anything) if this is not a version we can handle or
|
|
|
|
# the file is corrupt. In future, perhaps rotate the file
|
|
|
|
# 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
|
|
|
self.ui.warn(_("unsupported journal file version '%s'\n") % version)
|
2016-06-24 18:12:05 +03:00
|
|
|
return
|
|
|
|
if not version:
|
|
|
|
# empty file, write version first
|
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(str(storageversion) + "\0")
|
2016-06-24 18:12:05 +03:00
|
|
|
f.seek(0, os.SEEK_END)
|
2018-07-19 10:29:42 +03:00
|
|
|
for entry in entries:
|
|
|
|
f.write(str(entry) + "\0")
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
def filtered(self, namespace=None, name=None):
|
|
|
|
"""Yield all journal entries with the given namespace or name
|
|
|
|
|
|
|
|
Both the namespace and the name are optional; if neither is given all
|
|
|
|
entries in the journal are produced.
|
|
|
|
|
2016-07-08 18:48:38 +03:00
|
|
|
Matching supports regular expressions by using the `re:` prefix
|
|
|
|
(use `literal:` to match names or namespaces that start with `re:`)
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
"""
|
2016-07-08 18:48:38 +03:00
|
|
|
if namespace is not None:
|
|
|
|
namespace = util.stringmatcher(namespace)[-1]
|
|
|
|
if name is not None:
|
|
|
|
name = util.stringmatcher(name)[-1]
|
2016-06-24 18:12:05 +03:00
|
|
|
for entry in self:
|
2016-07-08 18:48:38 +03:00
|
|
|
if namespace is not None and not namespace(entry.namespace):
|
2016-06-24 18:12:05 +03:00
|
|
|
continue
|
2016-07-08 18:48:38 +03:00
|
|
|
if name is not None and not name(entry.name):
|
2016-06-24 18:12:05 +03:00
|
|
|
continue
|
|
|
|
yield entry
|
|
|
|
|
|
|
|
def __iter__(self):
|
|
|
|
"""Iterate over the storage
|
|
|
|
|
|
|
|
Yields journalentry instances for each contained journal record.
|
|
|
|
|
|
|
|
"""
|
2018-09-28 17:09:02 +03:00
|
|
|
local = self._open(self.localvfs)
|
2016-07-11 16:45:41 +03:00
|
|
|
|
|
|
|
if self.sharedvfs is None:
|
|
|
|
return local
|
|
|
|
|
|
|
|
# iterate over both local and shared entries, but only those
|
|
|
|
# shared entries that are among the currently shared features
|
|
|
|
shared = (
|
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
|
|
|
|
for e in self._open(self.sharedvfs)
|
|
|
|
if sharednamespaces.get(e.namespace) in self.sharedfeatures
|
|
|
|
)
|
2016-07-11 16:45:41 +03:00
|
|
|
return _mergeentriesiter(local, shared)
|
|
|
|
|
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 _open(self, vfs, filename="namejournal", _newestfirst=True):
|
2016-07-11 16:45:41 +03:00
|
|
|
if not vfs.exists(filename):
|
2016-06-24 18:12:05 +03:00
|
|
|
return
|
|
|
|
|
2016-07-11 16:45:41 +03:00
|
|
|
with vfs(filename) as f:
|
2016-06-24 18:12:05 +03:00
|
|
|
raw = f.read()
|
|
|
|
|
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
|
|
|
lines = raw.split("\0")
|
2016-06-24 18:12:05 +03:00
|
|
|
version = lines and lines[0]
|
|
|
|
if version != str(storageversion):
|
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
|
|
|
version = version or _("not available")
|
2016-06-24 18:12:05 +03:00
|
|
|
raise error.Abort(_("unknown journal file version '%s'") % version)
|
|
|
|
|
2016-07-11 16:45:41 +03:00
|
|
|
# Skip the first line, it's a version number. Normally we iterate over
|
|
|
|
# these in reverse order to list newest first; only when copying across
|
|
|
|
# a shared storage do we forgo reversing.
|
|
|
|
lines = lines[1:]
|
|
|
|
if _newestfirst:
|
|
|
|
lines = reversed(lines)
|
2016-06-24 18:12:05 +03:00
|
|
|
for line in lines:
|
|
|
|
if not line:
|
|
|
|
continue
|
|
|
|
yield journalentry.fromstorage(line)
|
|
|
|
|
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-24 18:12:05 +03:00
|
|
|
# journal reading
|
|
|
|
# log options that don't make sense for journal
|
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
|
|
|
_ignoreopts = ("no-merges", "graph")
|
|
|
|
|
|
|
|
|
2016-06-24 18:12:05 +03:00
|
|
|
@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
|
|
|
"journal|j|jo|jou|jour|journ|journa",
|
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
|
|
|
[
|
|
|
|
("", "all", None, "show history for all names"),
|
|
|
|
("c", "commits", None, "show commit metadata"),
|
|
|
|
]
|
|
|
|
+ [opt for opt in cmdutil.logopts if opt[1] not in _ignoreopts],
|
|
|
|
"[OPTION]... [BOOKMARKNAME]",
|
|
|
|
)
|
2016-06-24 18:12:05 +03:00
|
|
|
def journal(ui, repo, *args, **opts):
|
2018-11-08 06:57:38 +03:00
|
|
|
"""show history of the checked out commit or a bookmark
|
2016-06-24 18:12:05 +03:00
|
|
|
|
2019-09-23 18:36:21 +03:00
|
|
|
Show the history of all the commits that were once the current commit. In
|
|
|
|
other words, shows a list of your previously checked out commits.
|
|
|
|
:hg:`journal` can be used to find older versions of commits (for example,
|
|
|
|
when you want to revert to a previous state). It can also be used to
|
|
|
|
discover commits that were previously hidden.
|
|
|
|
|
|
|
|
By default, :hg:`journal` displays the history of the current commit. To
|
|
|
|
display a list of commits pointed to by a bookmark, specify a bookmark
|
|
|
|
name.
|
|
|
|
|
|
|
|
Specify --all to show the history of both the current commit and all
|
|
|
|
bookmarks. In the output for --all, bookmarks are listed by name, and '.'
|
|
|
|
indicates the current commit.
|
|
|
|
|
|
|
|
Specify -Tjson to produce machine-readable output.
|
|
|
|
|
|
|
|
.. container:: verbose
|
|
|
|
|
|
|
|
By default, :hg:`journal` only shows the commit hash and the
|
|
|
|
corresponding command. Specify --verbose to also include the previous
|
|
|
|
commit hash, user, and timestamp.
|
|
|
|
|
|
|
|
Use -c/--commits to output log information about each commit hash. To
|
|
|
|
customize the log output, you can also specify switches like '--patch',
|
|
|
|
'--git', '--stat', and '--template'.
|
|
|
|
|
|
|
|
If a bookmark name starts with 're:', the remainder of the name is
|
|
|
|
treated as a regular expression. To match a name that actually starts
|
|
|
|
with 're:', use the prefix 'literal:'.
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
"""
|
2017-10-22 21:34:12 +03:00
|
|
|
opts = pycompat.byteskwargs(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
|
|
|
name = "."
|
|
|
|
if opts.get("all"):
|
2016-07-11 15:39:24 +03:00
|
|
|
if args:
|
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(_("You can't combine --all and filtering on a name"))
|
2016-07-11 15:39:24 +03:00
|
|
|
name = None
|
2016-06-24 18:12:05 +03:00
|
|
|
if args:
|
2016-07-11 15:39:24 +03:00
|
|
|
name = args[0]
|
2016-06-24 18:12:05 +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
|
|
|
fm = ui.formatter("journal", opts)
|
|
|
|
ui.pager("journal")
|
2016-06-24 18:12:05 +03:00
|
|
|
|
2018-04-07 00:33:11 +03:00
|
|
|
if not opts.get("template"):
|
2016-07-11 15:39:24 +03:00
|
|
|
if name 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
|
|
|
displayname = _("the working copy and bookmarks")
|
2016-06-24 18:12:05 +03:00
|
|
|
else:
|
2016-07-11 15:39:24 +03:00
|
|
|
displayname = "'%s'" % name
|
|
|
|
ui.status(_("previous locations of %s:\n") % displayname)
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
limit = cmdutil.loglimit(opts)
|
|
|
|
entry = None
|
2016-07-11 15:39:24 +03:00
|
|
|
for count, entry in enumerate(repo.journal.filtered(name=name)):
|
2016-06-24 18:12:05 +03:00
|
|
|
if count == limit:
|
|
|
|
break
|
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
|
|
|
newhashesstr = fm.formatlist(
|
2020-01-29 05:22:50 +03:00
|
|
|
list(map(fm.hexfunc, entry.newhashes)), name="node", sep=","
|
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
|
|
|
)
|
|
|
|
oldhashesstr = fm.formatlist(
|
2020-01-29 05:22:50 +03:00
|
|
|
list(map(fm.hexfunc, entry.oldhashes)), name="node", sep=","
|
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-24 18:12:05 +03:00
|
|
|
|
|
|
|
fm.startitem()
|
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
|
|
|
fm.condwrite(ui.verbose, "oldhashes", "%s -> ", oldhashesstr)
|
|
|
|
fm.write("newhashes", "%s", newhashesstr)
|
|
|
|
fm.condwrite(ui.verbose, "user", " %-8s", entry.user)
|
2016-07-08 18:48:38 +03:00
|
|
|
fm.condwrite(
|
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.get("all") or name.startswith("re:"), "name", " %-8s", entry.name
|
|
|
|
)
|
2016-06-24 18:12:05 +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
|
|
|
timestring = fm.formatdate(entry.timestamp, "%Y-%m-%d %H:%M %1%2")
|
|
|
|
fm.condwrite(ui.verbose, "date", " %s", timestring)
|
|
|
|
fm.write("command", " %s\n", entry.command)
|
2016-06-24 18:12:05 +03:00
|
|
|
|
|
|
|
if opts.get("commits"):
|
|
|
|
displayer = cmdutil.show_changeset(ui, repo, opts, buffered=False)
|
|
|
|
for hash in entry.newhashes:
|
|
|
|
try:
|
|
|
|
ctx = repo[hash]
|
|
|
|
displayer.show(ctx)
|
|
|
|
except error.RepoLookupError as e:
|
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
|
|
|
fm.write("repolookuperror", "%s\n\n", str(e))
|
2016-06-24 18:12:05 +03:00
|
|
|
displayer.close()
|
|
|
|
|
|
|
|
fm.end()
|
|
|
|
|
2018-04-06 23:41:52 +03:00
|
|
|
if entry is None and not opts.get("template"):
|
2016-06-24 18:12:05 +03:00
|
|
|
ui.status(_("no recorded locations\n"))
|