Commit Graph

5511 Commits

Author SHA1 Message Date
liscju
251de74ab8 shelve: preserve newly created branch on non-bare shelve in wctx (BC)
Before this patch current branch in working context wasnt preserved
after shelve, this patch makes it restore after update.
2016-03-12 18:36:31 +01:00
liscju
802a1dd151 largefiles: replace invocation of os.path module by vfs in lfutil.py
Replaces invocations os.path functions to methods in vfs. Unfortunately
(in my view) this makes code less readable, because instead of using
clear variable names with path it needs to replace them with vfs(..).
I need guidance how to make such transition look more readable.

For example in this patch there is example with few places with
wvfs.join(standindir), standindir before this patch was absolute
path, in this it is changed to relative because it is used also
in expression wvfs.join(standindir, pat).
2016-03-14 20:20:22 +01:00
liscju
4648b42bff largefiles: replace invocation of os.path module by vfs in lfcommands.py 2016-03-13 23:16:44 +01:00
Jun Wu
cbbb576b1c pager: skip uisetup if chg is detected
chg has its own pager implementation that it wants to skip pager's uisetup.
It is currently done by redirecting stdout to /dev/null, which has unintended
side effects. This patch makes pager aware of chg and skip uisetup directly
from pager. We may want to merge chg and pager's pager implementation to
make this unnecessary in the future.
2016-03-14 15:03:19 +00:00
Jun Wu
60655f3e3b chgserver: add an explicit gc to trigger __del__
SocketServer.ForkingMixIn uses os._exit which will skip all cleanup handlers.
We want to run __del__ to make things like transactions, {ssh,http}peer,
atomictempfile, dirstateguard, etc. work.

This patch adds a "gc.collect()" to trigger __del__. It is helpful for chg
to pass some test cases in test-devel-warnings.t.
2016-03-14 23:08:03 +00:00
Jun Wu
d487d6ed63 blackbox: do not assume self._bb{vfs,repo,fp} are set in blackboxui.__init__
It's possible for the blackboxui code to do a "del self._bbvfs", then ui.copy()
or similar attempt will fail. It will also fail when constructing a blackboxui
from a non-blackbox ui.
This patch fixes the issue by not assuming any _bb* attr is set.
2016-03-15 10:36:02 +00:00
Jun Wu
745b527cb7 histedit: do not close stdin
Closing stdin is unexpected by chgserver and is not a good idea generally.
This patch refactors related code a bit and make sure stdin is not closed.
It will make chg much happier on test-histedit*.t.
2016-03-15 00:42:33 +00:00
FUJIWARA Katsunori
1d2fb0ab99 hgext: use templatekeyword to mark a function as template keyword
This patch replaces registration of template keyword function in
bundled extensions by registrar.templatekeyword decorator all at once.
2016-03-13 05:17:06 +09:00
Jun Wu
b50f59de5d chgserver: do not keep repo object
The current chgserver design is to use one server to handle multiple repos
which has same [extensions] config. Previously the client uses --cwd / to
avoid creating a repo object. Now we need to set repo to None before we
have code to make "serve" command norepo when it's chg.
2016-03-16 11:57:09 +00:00
Jun Wu
6193936a7f chgserver: invalidate the server if extensions fail to load
Previously, if extensions fail to load, chg server will just keep working
without those extensions. It will print a warning message but only if a new
server starts.

This patch invalidates the server if any extension failed to load, but still
serve the client (hopefully just) once. It will help chg pass some test cases
of test-bad-extension.t.
2016-03-12 04:24:11 +00:00
Jun Wu
80fd75af3b chgserver: add an explicit "reconnect" instruction to validate
In some rare cases (next patch), we may want validate to do "unlink" without
forcing the client reconnect. This patch addes a new "reconnect" instruction
and makes "unlink" not to reconnect by default.
2016-03-14 13:48:33 +00:00
Augie Fackler
b569044317 fsmonitor: flag msc_stdint as no-check-code
I'd rather not modify code that we're vendoring, so I'm just marking
it this way.
2016-03-14 21:15:59 -04:00
Sune Foldager
1e39bee49b fsmonitor: use custom stdint.h file when compiling with Visual C
Visual C/C++ 9, which Python 2.7 is compatible with, doesn't have C99
support and thus doesn't contain a stdint.h file.

This changeset adds a custom version of stdint.h, created specifically
for Visual C, and uses it when building with that compiler.
2016-03-14 17:53:47 +01:00
Mateusz Kwapich
812fb817e3 histedit: have dropmissing abort on empty plan
We noticed that many users have the intuition of laving the editor empty when
they want to abort the operation. The fact that dropmissing allows user to
delete all edited commits is not intuitive even for users that asked for it.

Let's prevent people from this footgun.
2016-03-13 16:46:49 -07:00
Jun Wu
3303b6aab4 chgserver: handle ParseError during validate
Currently the validate command in chgserver expects config can be loaded
without issues but the config can be broken and chg will print a stacktrace
instead of the parsing error, if a chg server is already running.

This patch adds a handler for ParseError in validate and a new instruction
"exit" to make the client exit without abortmsg. A test is also added to make
sure it will behave as expected.
2016-03-14 12:52:35 +00:00
Jun Wu
efff39b548 chgserver: resolve relative path before sending via system channel
The chgserver may have a different cwd from the client because of the side
effect of "--cwd" and other possible os.chdir done by extensions. Therefore
relative paths can be misunderstood by the client.

This patch solves it by expanding relative cwd path to absolute one before
sending them via the 'S' channel. It can help chg to pass a testcase in
test-alias.t later.
2016-03-14 11:23:04 +00:00
Yuya Nishihara
025ddf17ef cmdserver: write early exception to 'e' channel in 'unix' mode
In 'unix' mode, the server is typically detached from the console. Therefore
a client couldn't see the exception that occurred while instantiating the
server object.

This patch tries to catch the early error and send it to 'e' channel even if
the server isn't instantiated yet. This means the error may be sent before the
initial hello message. So it's up to the client implementation whether to
handle the early error message or error out as protocol violation.

The error handling code is also copied to chgserver.py. I'll factor out them
later if we manage to get chg passes the test suite.
2016-03-12 22:03:30 +09:00
Martin von Zweigbergk
4da3e7135f zeroconf: remove leftover camelcase identifier
00820e3ad90f (zeroconf: remove camelcase in identifiers, 2016-03-01)
forgot one occurrence of "numAuthorities", which makes test-paths.t
fail for me. I don't even know what zeroconf is, but this patch seems
obviously correct and it fixes the failing test case.
2016-03-11 15:40:58 -08:00
Yuya Nishihara
88535fc17d chgserver: remove outdated comment about setvbuf()
I've replaced setvbuf() by fdopen() before merging chg into the core, so
this comment is wrong.

https://bitbucket.org/yuja/chg/commits/5c24e72bc447
2016-02-27 21:17:37 +09:00
timeless
c63b17c586 transplant: use absolute_import 2016-03-01 04:53:43 +00:00
timeless
1e52ec82b3 transplant: switch to using nodemod for hex+short 2016-03-11 16:07:22 +00:00
timeless
4f987db82a convert: bzr use absolute_import 2016-03-02 16:32:52 +00:00
Jun Wu
b98b0254ad chgserver: include [extdiff] in confighash
extdiff's uisetup will register new commands. If we do not include it in
confighash, changes to [extdiff] will not get new commands registered.
This patch adds extdiff to confighash and makes it possible for chg to pass
test-extdiff.t.
2016-03-11 13:00:20 +00:00
Anton Shestakov
adaa0d801e patchbomb: specify unit for ui.progress when sending emails 2016-03-11 22:30:43 +08:00
Anton Shestakov
a65379c3ff churn: specify unit for ui.progress when analyzing revisions 2016-03-11 22:30:29 +08:00
Anton Shestakov
67f0dab5d3 convert: specify unit for ui.progress when scanning paths 2016-03-11 22:30:04 +08:00
Anton Shestakov
5b22fe48fb convert: specify unit for ui.progress when operating on files 2016-03-11 22:29:51 +08:00
Anton Shestakov
f67064214c largefiles: use revisions as a ui.progress unit
Using plural form is consistent with other progress units, and "1 out of 5
revisions" sounds more correct. Also, tests don't show this, but if you have
'speed' item in progress.format config, it shows e.g. '100 revisions/sec',
which also seems better.
2016-03-11 22:26:06 +08:00
Anton Shestakov
a30859be56 largefiles: specify unit for ui.progress when operating on files
Also make it available for translation. It could already be translated, because
it's used as a unit in archival.py and subrepo.py, for example.
2016-03-11 22:21:43 +08:00
FUJIWARA Katsunori
08147e9705 convert: fix "stdlib import follows local import" problem in transport
Before this patch, import-checker reports error below for importing
subversion python binding libraries.

    stdlib import "svn.*" follows local import: mercurial
2016-03-11 21:55:44 +09:00
FUJIWARA Katsunori
8afa478806 convert: fix relative import of stdlib module in subversion
Before this patch, import-checker reports "relative import of stdlib
module" error for importing Pool and SubversionException from svn.core
in subversion.py.

To fix this relative import of stdlib module, this patch adds prefix
'svn.core.' to Pool and SubversionException in source.

These 'svn.core.' relative accessing shouldn't cause performance
impact, because there are much more code paths accessing to
'svn.core.' relative properties.

BTW, in transport.py, this error is avoided by assignment below.

    SubversionException = svn.core.SubversionException

But this can't be used in subversion.py case, because:

  - such assignment in indented code block causes "don't use camelcase
    in identifiers" error of check-code.py

  - but it should be placed in indented block, because svn is None at
    failure of importing subversion python binding libraries (=
    examination of 'svn' is needed)
2016-03-11 21:55:44 +09:00
FUJIWARA Katsunori
b75e95ce01 convert: make subversion import transport locally
Introducing "absolute_import" feature in previous patch caused failure
of importing local module "transport".
2016-03-11 21:55:44 +09:00
Christian Ebert
131615fd5b keyword: compact writing of temporary kwdemo hgrc 2016-03-11 08:27:11 +00:00
Jun Wu
bac9bcbc56 chg: remove manual reload logic
chgserver now validates and reloads configs automatically. Manually reloading
is no longer necessary. Besides, we are deprecating pid files since the server
will periodically check its ownership of the socket file and exit if it does
not own the socket file any longer, which works more reliable than a pid file.
This patch removes the SIGHUP reload logic from both chg server and client.
2016-03-10 00:12:33 +00:00
Pierre-Yves David
cc59112ca7 hgext: officially turn 'hgext' into a namespace package
Actually since Python 2.3, there is some way to turn top level package into
"namespace package" so that multiple subpackage installed in different part of
the path can still be imported transparently. This feature was previously
thought (at least by myself) to be only provided by some setuptool black magic.

Turning hgext into such namespace package allows third extensions to install
themselves inside the "hgext" namespace package to avoid polluting the global
python module namespace. They will now be able to do so without making it a pain
to use a Mercurial "installed" in a different way/location than these
extensions.

The only constrains is that the extension ship a 'hgext/__init__.py' containing
the same call to 'pkgutil.extend_path' and nothing else. This seems realistic.

The main question that remains is: should we introduce a dedicated namespace for
third party extension (hgext3rd?) to make a clearer distinction between what is
officially supported and what is not? If so, this will be introduced in a follow
up patch.
2016-02-27 12:56:26 +01:00
Matt Mackall
6d2484af42 merge with stable 2016-03-11 15:24:27 -06:00
Martijn Pieters
b1494940de fsmonitor: hook up state-enter, state-leave signals
Keeping the codebase in sync with upstream:

Watchman 4.4 introduced an advanced settling feature that allows publishing
tools to notify subscribing tools of the boundaries for important filesystem
operations.

https://facebook.github.io/watchman/docs/cmd/subscribe.html#advanced-settling
has more information about how this feature works.

This diff connects a signal that we're calling `hg.update` to the mercurial
update function so that mercurial can indirectly notify tools (such as IDEs or
build machinery) when it is changing the working copy.  This will allow those
tools to pause their normal actions as the files are changing and defer them
until the end of the operation.

In addition to sending the enter/leave signals for the state, we are able to
publish useful metadata along the same channel.  In this case we are passing
the following pieces of information:

1. destination revision hash
2. An estimate of the distance between the current state and the target state
3. A success indicator.
4. Whether it is a partial update

The distance is estimate may be useful to tools that wish to change their
strategy after the update has complete.  For example, a large update may be
efficient to deal with by walking some internal state in the subscriber rather
than feeding every individual file notification through its normal (small)
delta mechanism.

We estimate the distance by comparing the repository revision number.  In some
cases we cannot come up with a number so we report 0.  This is ok; we're
offering this for informational purposes only and don't guarantee its accuracy.

The success indicator is only really meaningful when we generate the
state-leave notification; it indicates the overall success of the update.
2016-03-10 16:04:09 +00:00
liscju
24726136ad largefiles: add abstract methods in remotestore class
Methods _put, _get, _stat were used in remotestore class as
abstract expecting that subclass would implement them. This
commit makes this fact explicit.
2016-03-10 10:56:02 +01:00
Augie Fackler
f277693a68 largefiles: use iterbatch instead of batch
This actually makes the code a little cleaner to read.
2016-03-02 13:13:05 -05:00
Martijn Pieters
34a3e2eb62 fsmonitor: new experimental extension
Extension to plug into a Watchman daemon, speeding up hg status calls by
relying on OS events to tell us what files have changed.

Originally developed at https://bitbucket.org/facebook/hgwatchman
2016-03-03 14:29:19 +00:00
Martijn Pieters
64a4b2e8cf fsmonitor: dependencies for new experimental extension
In preparation for the filesystem monitor extension, include the pywatchman
library. The fbmonitor extension relies on this library to communicate with
the Watchman service. The library is BSD licensed and is taken from
https://github.com/facebook/watchman/tree/master/python.

This package has not been updated to mercurial code standards.
2016-03-02 16:25:12 +00:00
Pierre-Yves David
a74c6e1e14 mq: restrict generated patch name to 75 characters (issue5117)
Super long first line in description lead to very long file name that
windows is unhappy about. We restrict the name to 75 char to avoid the
issue.

75 seems fine and leave some extra room for '__#' suffix in case of conflict.

I does not seems worthwhile to add a dedicated config option to configure the
length. It can be done in the future if there is an actual user demand for it.
2016-03-09 22:21:08 +00:00
FUJIWARA Katsunori
4a0bc54a73 doc: remove deprecated option from synopsis of command help
Before this patch, deprecated options below are used in synopsis of
command help, even though they aren't listed up as available options
by default. These might confuse readers.

  - -n (no-op, now) of strip
  - -a/--active of branches
  - -f/--force of merge
2016-03-01 03:28:46 +09:00
Yuya Nishihara
61b45241f5 zeroconf: forward all arguments passed to ui.configitems() wrapper
cf6cc5344afa added 'ignoresub' argument to ui.configitems(), but zeroconf
wrapper wasn't updated. It caused the following crash:

  Traceback (most recent call last):
    File "bin/hg", line 43, in <module>
      mercurial.dispatch.run()
    File "lib/python/mercurial/dispatch.py", line 54, in run
      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
    File "lib/python/mercurial/dispatch.py", line 120, in dispatch
      ret = _runcatch(req)
    File "lib/python/mercurial/dispatch.py", line 191, in _runcatch
      return _dispatch(req)
    File "lib/python/mercurial/dispatch.py", line 924, in _dispatch
      cmdpats, cmdoptions)
    File "lib/python/mercurial/dispatch.py", line 681, in runcommand
      ret = _runcommand(ui, options, cmd, d)
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
    File "lib/python/hgext/zeroconf/__init__.py", line 180, in cleanupafterdispatch
      return orig(ui, options, cmd, cmdfunc)
    File "lib/python/mercurial/dispatch.py", line 1055, in _runcommand
      return checkargs()
    File "lib/python/mercurial/dispatch.py", line 1015, in checkargs
      return cmdfunc()
    File "lib/python/mercurial/dispatch.py", line 921, in <lambda>
      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
    File "lib/python/mercurial/util.py", line 991, in check
      return func(*args, **kwargs)
    File "lib/python/mercurial/commands.py", line 5405, in paths
      pathitems = sorted(ui.paths.iteritems())
    File "lib/python/mercurial/util.py", line 723, in __get__
      result = self.func(obj)
    File "lib/python/mercurial/ui.py", line 619, in paths
      return paths(self)
    File "lib/python/mercurial/ui.py", line 1099, in __init__
      for name, loc in ui.configitems('paths', ignoresub=True):
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
  TypeError: configitems() got an unexpected keyword argument 'ignoresub'

We have no test coverage for zeroconf, so I've added a minimal test that
could reproduce this problem.
2016-02-10 22:53:17 +09:00
timeless
2c0eb26137 rebase: update working directory when aborting (issue5084) 2016-02-05 01:56:46 +00:00
Siddharth Agarwal
69360ef583 rebase: don't preserve most extra fields
This backs out changeset 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:23:31 -08:00
Siddharth Agarwal
d6d688266e rebase: backout changeset 9b23739c41de
This is a dependency for a future backout of 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:24:47 -08:00
Siddharth Agarwal
82b2cbc2ee rebase: backout changeset 9fd8e3a61d6a
This is a dependency for a future backout of 5293d4f88aef.

See the previous patches for why.
2016-02-03 09:23:52 -08:00
Wagner Bruna
de70b03c22 histedit: fix typo in documentation 2016-02-03 11:01:11 -02:00
Martijn Pieters
9c233476de rebase: better way to detect non-detaching revisions (issue5044)
Rather than look for the lowest revision, see if the rebase state is tracking
the parents of this revision. Otherwise we can't handle multiple revisions in
one rebase that includes a merge revision.

Fixes issue5044.
2016-02-01 15:41:43 +00:00