Commit Graph

154 Commits

Author SHA1 Message Date
Bryan O'Sullivan
bac2c7da41 inotify: on Python < 2.6, socket.error lacks errno 2012-12-20 11:40:04 -08:00
Bryan O'Sullivan
783a54d437 inotify: pacify pestiferous pyflakes precipitously 2012-12-19 16:56:26 -08:00
Bryan O'Sullivan
3a10142595 posix: move server side of unix domain sockets out of inotify
We also turn the unix domain socket into a class, so that we have a
sensible place to hang its logically related attributes and behaviour.

We'll shortly want to reuse this in other code.
2012-12-18 17:15:13 -08:00
Bryan O'Sullivan
e063b46f80 inotify: don't fall over just because of a dangling symlink
Previously, the inotify server failed to start if .hg/inotify.sock was
a symlink that pointed to a non-existent path. This behaviour does not
seem to make any sense.

Now, if we encounter a broken symlink, we unlink it and continue.
2012-12-18 17:33:32 -08:00
Mads Kiilerich
ac8e1fc147 check-code: there must also be whitespace between ')' and operator
The check pattern only checked for whitespace between keyword and operator.

Now it also warns:
 >     x = f(),7
 missing whitespace after ,
 >     x = f()+7
 missing whitespace in expression
2012-12-09 23:33:16 +01:00
Bryan O'Sullivan
dc9ede17dc Merge spelling fixes 2012-09-11 08:36:09 -07:00
timeless@mozdev.org
345b9606c8 en-us: Initialize 2012-08-17 13:58:19 -07:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Thomas Arendsen Hein
567734318a inotify: catch SignalInterrupt during shutdown (issue3351)
When inotify.repowatcher.shutdown() is called, mercurial.error.SignalInterrupt
exception is thrown by mercurial.dispatch._runcatch.catchterm(), therefore
socketlistener.shutdown() is not called.

Catching this allows cleanup action (removing the socket file) to proceed.
2012-04-04 10:57:48 +02:00
Nikolaj Sjujskij
7548a4a762 building: build inotify for sys.platform='linux*'
If Python interpreter was built under Linux 3.x kernel, it reports
sys.platform to be 'linux3' (it is fixed for Python 3, but not for 2.x).
This cancels building inotify extension, which was built only for 'linux2'
platform. Improved test checks if sys.platform begins with 'linux', and together
with test for kernel version to be greater than 2.6 it seems to cover all known
cases.
2011-09-20 15:21:27 +03:00
Augie Fackler
3fddb45056 hgext: replace uses of hasattr with util.safehasattr 2011-07-25 20:37:12 -05:00
Matt Mackall
f3854e5d82 hgext: fixup a couple missed file().read() instances 2011-05-03 21:53:13 -05:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Martin Geisler
a76e121863 backout of e4cb9628354c
Matt and a majority of crew did not like this approach.
2011-01-27 11:15:08 +01:00
Martin Geisler
d23e1973c2 specify C indention style using Emacs file local variables 2011-01-26 12:05:01 +01:00
Nicolas Dumazet
afb08fe68c inotify: raise correct error if server is already started in a deep repository
When path is too long to be an Unix socket address, we create a socket in a
temporary directory and link from the long path to the shorter one.
But checks in server code at startup were insufficient in this case, and used
to raise an unclear "tried linking .hg/inotify.sock to a temporary socket but
.hg/inotify.sock already exists"
2010-10-09 15:41:53 +02:00
Brodie Rao
0f9d940cb9 cleanup: remove unused variables 2010-08-27 13:32:40 -04:00
Greg Ward
41733adeb2 inotify: show the exact command used to start the server 2010-08-13 13:16:34 -04:00
David Soria Parra
c66423f7bc inotify: remove unused variable 2010-07-24 22:15:22 +02:00
Matt Mackall
33994da433 Merge with stable 2010-07-20 15:07:10 -05:00
Greg Ward
08b5f707c3 inotify: make inotifydirstate.status() returns a tuple of lists.
This makes it consistent with dirstate.status(), which is important if
there are other extensions messing with the output of status().  Those
extensions can safely assume that dirstate.status() returns a tuple of
lists, because its docstring says it does.  But
inotifystatus.dirstate() returns a list of lists, which can break
those other extensions.
2010-07-20 14:00:47 -04:00
Renato Cunha
b6d6b8775c removed exception args indexing (not supported by py3k)
Py3k removed __getitem__ for exception classes. The correct way of
getting the exception arguments is by using the args method.
2010-07-14 23:03:21 -03:00
Nicolas Dumazet
658e3fee6a merge with stable 2010-07-13 22:56:01 +09:00
Renato Cunha
6de8a70a9d inotify: check all components of filenames against hgignore (issue884)
With inotify enabled, files that should be ignored could be detected as
untracked by mercurial. This behavior was wrong because inotify's filestatus
implementation only matched filenames against ignore patterns, instead of
checking if other elements of their paths matched them. This patch fixes the
behavior by checking the file paths against the ignore patterns.

A new test has also been added to the main inotify test to prevent any
regressions.
2010-07-06 22:22:18 -03:00
Renato Cunha
f1db4f7c25 inotify: Port of the C module to py3k.
This patch accomplishes the port of the inotify C module to py3k by #including
mercurial's util.h file, and by defining the necessary boilerplate code
required by py3k through conditional compilation.
2010-07-02 16:22:59 -03:00
Renato Cunha
e091197571 inotify: Better implementation of the event string representation.
This patch reimplements the event_repr function. It got mostly rewritten to
eliminate the need for conditional compilation of the module when building in
py3k. The trick there (thanks to Antoine Pitrou) is to use the % operator to
let the python interpreter format the string to be returned.
2010-07-02 16:21:46 -03:00
Renato Cunha
d43bcc0e6e inotify: make proper use of Python API to get object size.
In older python versions, it was ok to access an object's type by accessing its
ob_type "member". With python 2.6+, the proper way of accessing it is via
Py_TYPE(object). This patch implements the correct call for the inotify
extension. When under python < 2.6, this macro is defined in mercurial's
util.h.
2010-07-02 16:21:42 -03:00
FUJIWARA Katsunori
ce06b102df help: show value requirement and multiple occurrence of options
this helps users to know what kind of option is:

  - no value is required(flag option)
  - value is required
  - value is required, and multiple occurrences are allowed

each kinds are shown as below:

 -f --force              force push
 -e --ssh CMD            specify ssh command to use
 -b --branch BRANCH [+]  a specific branch you would like to push

if one or more 3rd type options are shown, explanation for '[+]' mark
is also shown as footnote.
2010-06-06 17:25:00 +09:00
Greg Ward
f43d8c7735 inotify: expose the same dirstate.status() interface as dirstate.
The real dirstate.status() does not have any keyword args.  For
consistency, wrappers or subclasses should not have them either.
2010-03-07 13:10:23 -05:00
Benoit Boissinot
060818ca9f inotify/inserve: implement --timeout-idle option (issue885)
hg inserve was ignoring and miscomputing the --timeout-idle option (seconds
vs. minutes).

Thanks to Jesse Glick for the bugreport and the initial patch.
2010-02-17 20:44:49 +01:00
Benoit Boissinot
9399306905 regression: missing arg from 3067d5de9e6c dirstate.{walk,status} changes 2010-02-17 20:30:57 +01:00
Brodie Rao
892ba5a830 remove unused imports 2010-02-14 01:52:31 -05:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Patrick Mezard
48eee05938 Find right hg command for detached process
On Windows, Mercurial can be run from the python script of from a frozen
executable. In the first case, we have to call the python interpreter since the
script is not executable. Frozen executable can be called directly.

Fix 3/3 for issue421
2010-01-06 21:11:58 +01:00
Nicolas Dumazet
7639059665 inotify: improve error messages
* prefix messages by inotify-(client|server)
* make sure that all warning and abort messages use the same format.
* in the case where inotify.sock is an old broken symlink, say so and abort
  instead of trying to overwrite the already existing link
2009-11-19 11:06:01 +09:00
Nicolas Dumazet
696edec52d inotify: add a inotify.pidfile configuration possibility
This will mainly help us in our tests to log pids of inotify servers
started implicitely, to make sure that unkilled inotify daemons do not clutter
the output of unrelated tests.

Also desactivate the workaround introduced in 37824a274d63
2009-11-17 15:36:09 +09:00
Nicolas Dumazet
fd600dc328 inotify: Do not access inotify when dirstate is dirty (issue1811)
Original patch was provided by Simon Heimberg

It delegates dirstate computation to dirstate.status when dirstate is dirty:
better be slow from time to time instead of using wrong data.

This solves issue1719. As the last component, issue1810, is still not solved,
test-inotify-dirty-dirstate will fail for now. It emphasizes a regression due
to e8efd88001e7:

changeset:   9515:e8efd88001e7
user:        Nicolas Dumazet <nicdumz.commits@gmail.com>
date:        Sun Aug 16 11:11:37 2009 +0900
summary:     inotify: use cmdutil.service instead of local daemonizing code

Ancestors of 7c01599dd30 are passing the test, when applied this patch.
Regression has to be investigated, but this patch is important since it affects
often mq operations.
2009-11-11 14:38:59 +09:00
Nicolas Dumazet
800658e086 inotify: mark directories visited during lookup (issue1844)
Emulate the match.dir calls that are made in dirstate.walk:
 * first mark the visited directories on the server side
 * then extend the transmitted response to include this directory list
 * and lastly call match.dir on each directory
2009-11-13 08:31:10 +09:00
Nicolas Dumazet
072c9e497b inotify: use cmdutil.service instead of local daemonizing code 2009-08-16 11:11:37 +09:00
Martin Geisler
9f1896c083 do not attempt to translate ui.debug output 2009-09-19 01:15:38 +02:00
Patrick Mezard
f6c5bd6fa1 Merge with crew-stable 2009-09-05 19:39:46 +02:00
Nicolas Dumazet
a9906a6b8c inotify: _inotify.c: bugfix: remove_watch has to return PyNone on success
We are not currently using that API function in inotify, hence the reason
for the "silent" bug. But returning NULL here causes the interpreter to crash.
Let's keep code clean for reusers :)

The whole "bail" logic was unneeded here.
2009-08-27 11:55:21 +02:00
Nicolas Dumazet
2478119a2e inotify: remove unused import 2009-08-16 11:09:21 +09:00
Nicolas Dumazet
30ca20c99b inotify: repo is not referenced from server, remove the weakref 2009-06-29 01:33:26 +09:00
Nicolas Dumazet
1ff8f59473 inotify: client: no repo use 2009-06-29 01:27:34 +09:00