Commit Graph

29500 Commits

Author SHA1 Message Date
Hannes Oldenburg
475307efcd cmdutil: remove duplicated badmatch call in cat()
Subrepo logic is handled in ctx.walk().
2016-08-07 14:06:20 +00:00
Pierre-Yves David
57c92b937c statichttprepo: do not try to write caches
The static http repository are read only, there is no hope in any cache
writing attempt.
2016-08-05 15:48:09 +02:00
FUJIWARA Katsunori
50f6fbab75 demandimport: omit default value of "level" at construction of _demandmod
This makes construction of _demandmod require explicit level value,
and helps to avoid issues like issue5208 in the future.
2016-08-06 22:24:33 +09:00
FUJIWARA Katsunori
21c1b2af7c demandimport: import sub-module relatively as expected (issue5208)
Before this patch, importing sub-module might (1) fail or (2) success
but import incorrect module, because demandimport tries to import
sub-module with level=-1 (on Python 2.x) or level=0 (on Python 3.x),
which is default value of "level" argument at construction of
"_demandmod" proxy object.

  (1) on Python 3.x, importing sub-module always fails to import
      existing sub-module

  (2) both on Python 2.x and 3.x, importing sub-module might import
      same name module on root level unintentionally

      On Python 2.x, existing sub-module is prior to this unexpected
      module. Therefore, this problem hasn't appeared.

To import sub-module relatively as expected, this patch specifies "1"
as import level explicitly at construction of "_demandmod" proxy
object for sub-module.
2016-08-06 22:24:33 +09:00
Gregory Szorc
6fcb5a026b wireproto: remove gboptslist (API)
This variable has been unused since 4e11f86d8ce7, which was over
2 years ago. gboptsmap should be used instead.

Marking as API because this could break extensions.
2016-08-06 15:00:34 -07:00
Gregory Szorc
b3c092eb61 wireproto: unescape argument names in batch command (BC)
Clients escape both argument names and values when using the
batch command. Yet the server was only unescaping argument values.

Fortunately we don't have any argument names that need escaped. But
that isn't an excuse to lack symmetry in the code.

Since the server wasn't properly unescaping argument names, this
means we can never introduce an argument to a batchable command that
needs escaped because an old server wouldn't properly decode its name.
So we've introduced an assertion to detect the accidental introduction
of this in the future. Of course, we could introduce a server
capability that says the server knows how to decode argument names and
allow special argument names to go through. But until there is a need
for it (which I doubt there will be), we shouldn't bother with adding
an unused capability.
2016-08-06 13:55:21 -07:00
Gregory Szorc
7315f10dde wireproto: consolidate code for obtaining "cmds" argument value
Both wireproto.py and sshpeer.py had code for producing the value to
the "cmds" argument used by the "batch" command. This patch extracts
that code to a standalone function and uses it.
2016-08-06 13:46:28 -07:00
Augie Fackler
b3e5d375f6 revlog: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 15:35:02 -04:00
Augie Fackler
7ad0dae82c md5sum: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:56 -04:00
Augie Fackler
a1cb15c378 util: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:46 -04:00
Augie Fackler
be01ef28d0 url: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:39 -04:00
Augie Fackler
454d692407 sshserver: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:30 -04:00
Augie Fackler
15bb27e43f sshpeer: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:22 -04:00
Augie Fackler
e02d5adf5a patch: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:14 -04:00
Augie Fackler
09340590e2 commands: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 14:00:08 -04:00
Augie Fackler
715ea0d1cc changegroup: use iter(callable, sentinel) instead of while True
This is functionally equivalent, but is a little more concise.
2016-08-05 13:59:58 -04:00
Yuya Nishihara
84f406e3b9 extdiff: isolate path variable of saved command to independent paragraph
Otherwise, the whole paragraph wouldn't be translated.
2016-07-27 21:44:49 +09:00
Yuya Nishihara
22ee04a3ca extdiff: export __doc__ of saved command for translation 2016-07-27 21:42:24 +09:00
Yuya Nishihara
fe246a4d88 extdiff: refactor closure of saved diff command as a top-level class
This allows us to collect __doc__ for translation.
2016-07-27 21:40:42 +09:00
Yuya Nishihara
146f5e3a27 i18n: use inspect.getsourcelines() to obtain lineno from func or class
Before, func must be a function object. I want to make it parse docstring
of classes, too.
2016-07-27 21:53:14 +09:00
Yuya Nishihara
6c0a0f348a chg: just take it as EOF if recv() returns 0
hgc->sockfd is a blocking stream socket. recv() should never return 0 other
than EOF.

See 4ff8628991ea for the original problem.
2016-08-05 21:21:33 +09:00
Pierre-Yves David
afdcdcbe8e vfs: use propertycache for open
The current open method is currently behaving like a property cache. We use our
utility decorator to make this explicit.
2016-08-04 16:56:50 +02:00
Augie Fackler
127114bb19 check-commit: allow underbars in cffi_-prefix function names
It seems reasonable to give cffi functions slightly more verbose names
in some circumstances, given the way they interface with C.
2016-08-05 17:27:51 -04:00
Augie Fackler
ba4d11b62e bundlerepo: add support for treemanifests in cg3 bundles
This is a little messier than I'd like, and I'll probably come back
and do some more refactoring later, but as it is this unblocks
narrowhg. An alternative approach (which I may do as part of the
mentioned refactoring) would be to construct *all* dirlog instances up
front, so that we don't have to keep track of the linkmapper
method. This would avoid a reference cycle between the bundlemanifest
and the bundlerepository, but I was hesitant to do all the work up
front like that.

With this change, it's possible to do 'hg incoming' and 'hg pull' from
bundles in .hg/strip-backup in a treemanifest repository. Sadly, this
doesn't make it possible to 'hg clone' one of those (if you do 'hg
strip 0'), because the cg3 in the bundle gets written without a
treemanifest flag. Since that's going to be an involved refactor in a
different part of the code (which I *suspect* won't touch any of the
code I've just written here), let's leave it as an idea for Later.
2016-08-05 13:08:11 -04:00
Augie Fackler
7e6d830e94 auditvfs: forward options property from nested vfs
This was breaking my ability to use treemanifests in bundlerepos, and
was deeply mysterious. We should probably just make the options
property a formal part of the vfs API, and make it a required
construction parameter. Sadly, I don't have time to dive into that
refactor right now.
2016-08-05 11:19:22 -04:00
Augie Fackler
7b4dc2c6d6 bundlerepo: use supportedincomingversions instead of allsupportedversions
Since bundlerepo is really a pull-like operation, this is the correct
method to use here.
2016-08-04 14:13:35 -04:00
Augie Fackler
7c233d9381 bundlerepo: introduce method to find file starts and use it
This moves us to the modern iter() technique instead of the `while
True` pattern since it's easy. Factored out as a function because I'm
about to need this in a second place.
2016-08-05 13:07:58 -04:00
Augie Fackler
ce135bfec2 bundlerevlog: use for loop over iterator instead of while True
The iter() builtin has a neat pattern where you give it a callable of
no arguments and a sentinel value, and you can then loop over the
function calls like a normal iterator. This cleans up the code a
little.
2016-08-05 13:09:50 -04:00
Augie Fackler
3bb87a6688 bundlerepo: use for loop over iterator instead of while True
The iter() builtin has a neat pattern where you give it a callable of
no arguments and a sentinel value, and you can then loop over the
function calls like a normal iterator. This cleans up the code a
little.
2016-08-05 13:09:24 -04:00
Augie Fackler
aa68b8b2d6 localrepo: jettison now-unused dirlog() method from localrepo 2016-08-05 12:47:03 -04:00
Augie Fackler
cc39e93327 repair: build dirlogs using manifest, rather than repo shortcut method
As before, this was rarely used, so let's get rid of the convenience method.
2016-08-05 13:01:01 -04:00
Augie Fackler
b5edcbb2f6 cmdutil: open dirlogs via manifest property, not via repo
This was a convenience method that was rarely used, so let's get rid of it.
2016-08-05 13:00:33 -04:00
Augie Fackler
d19a4d923c wirepeer: rename confusing source parameter
It's named "url" everyplace else this method is defined, so let's be
consistent.
2016-08-05 16:34:30 -04:00
Pierre-Yves David
15e8baf199 develwarn: use the lock helper in local repo
We have a helper function to know if a lock is taken. When checking lock usage
we now use it instead of manually accessing the locks.
2016-08-05 13:44:17 +02:00
Yuya Nishihara
dbb4c18c54 debugextension: change "testedwith" to a list (BC)
It wasn't a list since the formatter couldn't process a list. We have no
such problem now and the -T option is experimental, so we can change it.
2016-03-19 17:19:03 -07:00
Yuya Nishihara
de8bc280b9 debugextensions: unindent nested if 2016-07-10 22:07:34 +09:00
Yuya Nishihara
fc753f3836 debugextensions: give short name to util.version() 2016-07-10 22:06:13 +09:00
Yuya Nishihara
c68b0f691e debugextensions: simply keep testedwith variable as a list
There should be no need to distinguish [] and None.
2016-07-10 21:59:43 +09:00
Augie Fackler
a445a45d1d test-treemanifest: ensure manifest command isn't broken
I realized we weren't testing this while hunting a broken manifest
command bug that ended up being narrowhg's fault.
2016-07-28 16:27:35 -04:00
Pulkit Goyal
7a4ee4f18a py3: use unicode literals in pure/osutil.py
The first element of _fields_ tuples must be a str in Python 3.
Also fix some function calls that were also expecting str.
2016-08-04 00:32:19 +05:30
Pulkit Goyal
d6e3ff1be2 py3: use unicode literals in crecord.py 2016-08-04 00:21:14 +05:30
Pulkit Goyal
5ea942af2d py3: use unicode literals in changelog.py
collections.namedtuple type and field names must be str in Python 3.
Our custom module importer was rewriting them to bytes literals,
making this fail.

In addition, __slots__ values must also be unicode.
2016-08-04 00:15:39 +05:30
Maciej Fijalkowski
c98b11e3dd mpatch: write a cffi version of mpatch.patches 2016-07-25 15:10:52 +02:00
Maciej Fijalkowski
8d7ca5fe20 mpatch: remove dependency on Python.h in mpatch.c
Now all the CPython-related stuff are referenced only from
mpatch_module.c with mpatch.c being freely usable from
a future cffi module
2016-07-22 17:28:05 +02:00
Maciej Fijalkowski
3bdeeb5959 mpatch: split mpatch into two files 2016-07-18 19:02:30 +02:00
Maciej Fijalkowski
3d64f15242 mpatch: provide things that will be exported later with a prefixed name
For cffi a bunch of mpatch functions need to be visible through a .h file.
This change renames them so it won't create potential c namespace conflicts.
2016-07-18 16:25:14 +02:00
Maciej Fijalkowski
43e619711a mpatch: change Py_ssize_t to ssize_t in places that will be later copied 2016-07-18 15:14:40 +02:00
Gregory Szorc
9f5f743c8a discovery: move code to create outgoing from roots and heads
changegroup.changegroupsubset() contained somewhat low-level code for
constructing an "outgoing" instance from a list of roots and heads
nodes. It feels like discovery.py is a more appropriate location for
this code.

This code can definitely be optimized, as outgoing.missing will
recompute the set of changesets we've already discovered from
cl.between(). But code shouldn't be refactored during a move, so
I've simply inserted a TODO calling attention to that.
2016-08-03 22:07:52 -07:00
Pierre-Yves David
000dd50a40 bundle2: remove 'experimental.bundle2-exp' boolean config (BC)
All users are migrated to 'devel.legacy.exchange', we can clean up the
experimental namespace.

Marking as (BC) because I know some large installation have bundle2 off and I
want to make sure they notice the change.
2016-08-03 16:23:26 +02:00
Pierre-Yves David
a8616bb250 tests: remove all remaining usage of experimental.bundle2-exp
The only remaining usage of the experimental config were enforcing bundle2 on.
These are very old remains of when bundle2 was off by default. This was also
useful to highlight the fact that this was a bundle2 run and that a bundle1 one
was nearby. However, we want a future developer working on bundle3 to notice
possible output/behavior change on these tests and take them in account.  So we
do not enforce bundle2 for these runs. We leave a comment around to make sure
dev still notice the bundle1 version.
2016-08-03 15:52:11 +02:00