Commit Graph

22074 Commits

Author SHA1 Message Date
Gregory Szorc
6799e4f38a posix: implement readpipe using non-blocking I/O (issue4336)
On Linux, fstat().st_size of a pipe always returns 0, even if the
pipe has data available for reading. This meant that reading from
and subsequently printing the stderr pipe content after wireproto
commands over SSH meant that available data wasn't being printed.

We now implement pipe reading on POSIX by doing a non-blocking
read for all available data.
2014-08-16 10:28:59 -07:00
Gregory Szorc
db57d5e9d6 platform: implement readpipe()
Reading all available data from a pipe has a platform-dependent
implementation.

This patch establishes platform.readpipe() by copying the
inline implementation in sshpeer.readerr(). The implementations
for POSIX and Windows are currently identical. The POSIX
implementation will be changed in a subsequent patch.
2014-08-15 20:02:18 -07:00
Pierre-Yves David
89e39a0c90 exchange: remove duplicated addition to pushop.stepdone
Not sure how it got there but it is useless.
2014-08-15 19:18:21 -07:00
Augie Fackler
ab198a5534 exchange: drop superfluous parens 2014-08-18 20:23:37 -04:00
Pierre-Yves David
a047d46203 push: add bookmarks to the unified bundle2 push
We use the `pushkey` part to exchange bookmark updates within the unified
bundle2 push. Note that this only applies on update (moving a bookmark known on both
sides) since bookmark export (creation of a new bookmark on remote) is apparently
done outside of the _push function.
2014-08-15 19:03:42 -07:00
Pierre-Yves David
4b35f98746 test-bundle2: add bookmark movement to the push test
If we add bookmarks to bundle2, we need a way to test the new code.
Tests are changed beforehand to highlight that inclusion of bookmarks in bundle
does not introduce any behavior changes.
2014-08-15 19:03:33 -07:00
Pierre-Yves David
698a1a6825 push: use stepsdone to control bookmark push
If bookmark are to be integrated in the unified bundle2, we need a way to disable
the old-style push.
2014-08-15 18:40:57 -07:00
Pierre-Yves David
f2ec8aebea push: move bookmark discovery with other discovery steps
The discovery of necessary bookmark updates is now done within the "discovery
phase". This opens the door to the inclusion of bookmarks in a unified bundle2
push.
2014-08-15 18:39:39 -07:00
Pierre-Yves David
1840ea298f pushbookmark: split an ultra-long line into a saner version
We make a temporary variable for the remote bookmark data and we do not expand
all elements from `bookmark.compare` since we are going to use only one.
2014-08-15 18:02:54 -07:00
Pierre-Yves David
6fc35a917d revert: drop dead code for untracked files
Untracked files are handled through status now.
2014-06-25 00:02:17 +01:00
Pierre-Yves David
6f03c922f1 revert: handle unknown files through status
This will allow us to drop the code dedicated to this special case.
2014-06-25 00:01:30 +01:00
Pierre-Yves David
aee89be787 revert: drop more dead code
Now that we detect all clean files, we do not need this clause anymore.
2014-06-24 23:55:43 +01:00
Pierre-Yves David
f409864957 revert: add a message to noop action
This prepares for the arrival of a second "not touching file" action:
revert of an untracked file.
2014-08-02 13:07:01 -07:00
Pierre-Yves David
5dc6cf75e9 revert: simplify loop conditional
The two breaks can be joined into one. The code gains one level of indent.
2014-08-01 11:41:56 -07:00
Pierre-Yves David
84467bf1a9 revert: explode the action tuple in the for loop
noop is about to gain a message.
2014-06-24 18:04:13 +01:00
Pierre-Yves David
110f9a614a revert: use actions[...] in all disptable cases
1. Special cases are not special enough

2. There are two cases where nothing is done and a message is displayed. This
   prepares it.
2014-08-02 12:45:34 -07:00
Pierre-Yves David
5b69082d6e revset: factorize backup decision
The conditional controlling the creation of backup is fairly big. We move config
related decisions outside of the loop.
2014-06-24 17:54:33 +01:00
Pierre-Yves David
8af395dddd revert: use a flat dispatch table
Now that the table is simpler, remove one level of depth from it. This
simplifies its usage in the for loop.
2014-06-24 17:44:31 +01:00
Pierre-Yves David
c881935cf8 pushbookmark: do not attempt to update bookmarks if the push failed (BC)
Before this patch, there was always an attempt to update bookmark even if prior
steps of the push failed. I cannot see a good semantic reason to do so. We
disable this possibility to simplify the push flow with bundle2. Bookmarks will
be included in the bundle and fail with other steps.
2014-08-15 18:26:21 -07:00
Pierre-Yves David
a6180e3cd6 pushbookmark: remove a <cond> and <val> or <other> construct
We make the conditional explicit for the sake of readability.
2014-08-15 17:58:15 -07:00
Pierre-Yves David
3727918ac1 pushbookmark: stop unrolling ancestors
Now that ancestors has the same boolean property as a list, we can stop unrolling
the set of ancestors. This should provide a significant speedup to this step as
ancestor objects are smart and lazy.
2014-08-15 16:31:06 -07:00
Pierre-Yves David
f84025d2b5 ancestors: add a __nonzero__ method
This allows using the object in a conditional the same way we can use list.
2014-08-15 15:57:50 -07:00
Pierre-Yves David
45e2e4b993 push: update bookmarks within the remote lock
Updating bookmarks is part of the push. It should be done within the same lock
as the other steps of the push.
2014-08-15 15:25:12 -07:00
Gregory Szorc
22de18c0d3 hgweb: refresh repository using URL not path (issue4323)
hgweb detects out-of-date repository instances (using a highly
suspect mechanism that should probably be fixed) and obtains a new
repository object if needed.

This patch changes the repository object copy to use the repo URL
(instead of path). This preserves more information about the source
repository and allows bundles to be served through hgweb.

A test verifying that bundles can now be served properly via
`hg serve` has been added.
2014-08-18 12:12:57 -07:00
Pierre-Yves David
3b78721608 obsmarker: add date as an explicit field
The markers are now 5-item tuples (concluded by the date). The obsstore.fields
contents have been updated accordingly.

There is no change to the on-disk format yet, so the date has to be extracted
every time we read binary markers and re-injected each team we write them. This
introduces a slowdown that will be solved when a new version of the format is
added. Such a slowdown was already introduced by the evolve extension anyway.
2014-08-19 10:01:06 -07:00
Pierre-Yves David
971ae35ea3 obsstore: add fields attribute to track each field in a marker
We are going to increase the amount of data explicitly stored in obsolescence
markers. This mean we are going to have a longer tuple and some values will be
shuffled around. So we add a ``fields`` attribute to the obsstore class to
keep track of what entry is what. This will be useful for extensions and for
documentation purpose.
2014-08-12 01:49:38 -07:00
Pierre-Yves David
a3e6a74916 debugobsolete: explicitly display date in the output
As the date is becoming a first-class citizen, we are displaying it in an
explicit field. As a bonus it is now readable by humans.
2014-08-13 23:42:36 -07:00
Pierre-Yves David
f43f2ce984 obsolete: add a date argument to the createmarkers function
The function is now just passing the value to create markers.
2014-08-14 12:59:48 -07:00
Pierre-Yves David
7fc91f5ad7 debugobsolete: use the new date argument on obsstore.create
Now that we have this new argument, we can just use it.
2014-08-13 23:25:07 -07:00
Pierre-Yves David
a9a2652690 obsstore: add an explicit date argument to obsstore.create
The date will become an official field in the markers (and ultimately
in the on-disk format). We start by making it an official argument for
the function.
2014-08-13 22:44:47 -07:00
Pierre-Yves David
3b69b7e067 obsolete: explicitly pass metadata argument using keyword argument
We are about to add more arguments to this function (date, parents, etc).
Passing metadata as a keyword argument gives us more flexibility when adding
them.
2014-08-14 01:53:07 -07:00
Pierre-Yves David
b1789db911 obsmarker: add a flags method
We introduce a proper method to access the flag information.
2014-08-15 09:41:30 -07:00
Pierre-Yves David
4a47cfe509 test-treediscovery: update output after merge
Recent change in the push process introduced an extra listing of the phase
name space before the push (on default). Meanwhile on default, a fix introduced
a new test with debug output.

We update the test output to be correct.
2014-08-15 14:19:15 -07:00
Pierre-Yves David
fbb01f1dde revert: add an XXX about rename tracking
We check for rename information in the dirstate. This is probably not enough to
preserve this behavior when using an explicit target rev.

I just spotted this while working on this code, but this is outside the scope
of my series so I'm just adding a comment to highlight this suspicious
situation.
2014-06-24 16:59:40 +01:00
Pierre-Yves David
429f2742a7 revert: inline a now useless closure
Now that a single call site remains, we can just inline its content.
2014-06-24 17:39:43 +01:00
Pierre-Yves David
6088f7f0d0 revert: remove code killed by the double status
All those checks were here to catch cases where files were not modified in
dirstate but were different in the target revision. This is now properly handled
by calling status on the target node too.
2014-06-24 17:37:24 +01:00
Pierre-Yves David
c1c198f25f revert: drop missingmodified set
There cannot be any elements in this set since:

    dsmodified &= modified
2014-06-24 17:36:49 +01:00
Pierre-Yves David
032cc9974f revert: detect files added during a merge
In case of merge, file that are actually added can be reported as modified. This
is currently handled by special-case code. We detect it beforehand instead. This
will lets use remove the special-case code at some point in the future.
2014-06-24 17:28:20 +01:00
Pierre-Yves David
9f80242186 revert: simplify handling of added files
There are multiple possible cases for added files. But it's all handled by magic
much lower in the stack. We document them, simplify the codes and move on.
2014-08-02 11:32:24 -07:00
Matt Mackall
92e0debc2b merge with stable 2014-08-15 11:48:05 -05:00
FUJIWARA Katsunori
e51e2fef65 rebase: use "rebase.collapse" as "editform" for "--collapse" always
Before this patch, if both "--message" and "--collapse" are specified
for "hg rebase", "rebaes.normal" is used as "editform" unexpectedly.

Unlike patches before and after in this series for improvement, this
is bug fix patch.
2014-08-15 23:05:53 +09:00
FUJIWARA Katsunori
e8856bc78d ui: invoke editor for committing with HGEDITFORM environment variable
At the external editor invocation for committing, the value specified
as "editform" for "cmdutil.getcommiteditor" is in "HGEDITFORM".

This enables external editor to do own customization according to
commit types.
2014-08-15 23:05:53 +09:00
Mads Kiilerich
440a607ef9 cleanup: name unused variables using convention of leading _
This helps checker tools ... and readability for those who knows and follows
the convention.
2014-08-15 04:37:46 +02:00
Mads Kiilerich
ecd224f8a0 cleanup: rename check-translation.py checker function - don't hide global var 2014-08-15 16:20:47 +02:00
Mads Kiilerich
3947517b04 cleanup: remove some unused / duplicate imports 2014-08-15 04:37:45 +02:00
Mads Kiilerich
b778f12731 cleanup: fix some list comprehension redefinitions of existing vars
In all the remaining cases the comprehension variable is used for the same
thing as a previous loop variable.

This will mute some pyflakes "list comprehension redefines" warnings.
2014-08-15 04:37:46 +02:00
Mads Kiilerich
5d377a8588 cleanup: avoid local vars shadowing imports
This will mute some pyflakes "import ... shadowed by loop variable" warnings.
2014-08-15 16:20:47 +02:00
Mads Kiilerich
23da6c1d98 cleanup: avoid _ for local unused tmp variables - that is reserved for i18n
_ is usually used for i18n markup but we also used it for I-don't-care
variables.

Instead, name don't-care variables in a slightly descriptive way but use the _
prefix to designate unused variable.

This will mute some pyflakes "import '_' ... shadowed by loop variable"
warnings.
2014-08-15 16:20:47 +02:00
Mads Kiilerich
5d1360e0ed cleanup: make sure we always access members of imported modules
This will make sure we get import errors, even if demandimport is enabled.

This will also mute some pyflakes 'imported but unused' warnings.
2014-08-15 04:37:45 +02:00
FUJIWARA Katsunori
3288a3b80d largefiles: update lfdirstate for unchanged largefiles during linear merging
Before this patch, linear merging of modified largefiles causes
an unexpected result, if (1) largefile collides with same-name normal one
in the target revision and (2) "local" largefile is chosen, even
though branch merging between such revisions works correctly.

Expected result of such linear merging is marking the largefile as
(re-)"added", but the actual result is marking it as "modified".

The standin of modified "local largefile" is not changed by linear
merging, and updating/merging update lfdirstate entries only for
largefiles of which standins are changed.

This patch adds the code path to update lfdirstate only for largefiles
of which standins are not changed.

In this case, "synclfdirstate" should be invoked with True as
"normallookup" argument always to force using "normallookup" on
dirstate for "n" files, because "normal" may mark target files as
"clean" unexpectedly.

To reduce cost of "lfile not in filelist", this patch converts
"filelist" to a "set" object: "filelist" is used only in (1) the newly
added code path and (2) the next line of "filelist = set(filelist)".

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, "lfdirstate" should
be updated with "dirstate" simultaneously during "merge.update"
execution: maybe by hooking "recordupdates" (+ total refactoring
around lfdirstate handling)
2014-08-15 20:28:51 +09:00