Commit Graph

31560 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
068a31b4e7 largefiles: omit updating newly added standin at linear merging
Updating standin for newly added largefile is needed, only if same
name largefile exists in destination context at linear merging. In
such case, updated standin is used to detect divergence of largefile
at overridefilemerge().

Otherwise, standin doesn't have any responsibility for its content
(usually, it is empty).
2017-03-27 09:44:34 +09:00
FUJIWARA Katsunori
6fcd56dea5 largefiles: reuse hexsha1() to centralize hash calculation logic into it
This patch also renames argument of hexsha1(), not only for
readability ("data" isn't good name for file-like object), but also
for reviewability (including hexsha1() code helps reviewers to confirm
how these functions are similar).

BTW, copyandhash() has also similar logic, but it can't reuse
hexsha1(), because it writes read-in data into specified fileobj
simultaneously.
2017-03-27 09:44:34 +09:00
Yuya Nishihara
b599e74213 py3: prove second commit works
Finally it works.
2017-03-26 19:11:41 +09:00
Yuya Nishihara
6286308d03 py3: fix manifestdict.fastdelta() to be compatible with memoryview
This doesn't look nice, but a straightforward way to support Python 3.
bytes(m[start:end]) is needed because a memoryview doesn't support ordering
operations. On Python 2, m[start:end] returns a bytes object even if m is
a buffer, so calling bytes() should involve no additional copy.

I'm tired of trying cleaner alternatives, including:

 a. extend memoryview to be compatible with buffer type
    => memoryview is not an acceptable base type
 b. wrap memoryview by buffer-like class
    => zlib complains it isn't bytes-like
2017-03-26 19:06:48 +09:00
Jun Wu
6b0a252616 crecord: use ProgrammingError 2017-03-26 17:00:23 -07:00
Jun Wu
8b5d63a796 transaction: use ProgrammingError 2017-03-26 16:59:30 -07:00
Jun Wu
b99bc99ff6 bundle2: use ProgrammingError 2017-03-26 16:57:25 -07:00
Jun Wu
f331a9612f merge: use ProgrammingError 2017-03-26 16:55:56 -07:00
Jun Wu
809dfffea4 repair: use ProgrammingError 2017-03-26 16:53:28 -07:00
Yuya Nishihara
2a7deb97d4 py3: abuse r'' to preserve str-ness of literals passed to __setattr__() 2017-03-26 16:33:12 +09:00
Yuya Nishihara
5a92909ce0 py3: fix slicing of byte string in revlog.compress()
I tried .startswith('\0'), but data wasn't always a bytes nor a bytearray.
2017-03-26 17:12:06 +09:00
Yuya Nishihara
cb9a6405bb py3: use bytes() to cast to immutable bytes in changelog.appender.write() 2017-03-26 16:31:01 +09:00
Yuya Nishihara
7109431581 py3: use bytes() to cast to immutable bytes in pure.bdiff.bdiff() 2017-03-26 16:16:45 +09:00
Yuya Nishihara
b24f9e13b8 bdiff: drop support for array.array argument from pure.bdiff.bdiff()
Thanks to 54d8e724da64, we no longer pass array.array('c') object to
bdiff().
2017-03-26 16:14:04 +09:00
Pierre-Yves David
7f7216e1a9 histedit: test that an aborted histedit can be rerun (with obsolete)
In the future, this should help catching issue as the one introduced in
33e44341bb82.
2017-03-26 15:55:34 +02:00
Pierre-Yves David
26848e81da histedit: backout changeset 33e44341bb82
Before 33e44341bb82, histedit (like rebase) was only creating markers on final
success from the old-rewritten node to the newly created nodes (as of before
33e44341bb82). In case of abort the aborted attempt were stripped to restore the
repository in its state prior to the attempt.

This use of strip was on purpose. Using markers in this case introduces various
issues. The main one is that keeping the partial result of histedit as obsolete
prevents us to recreates the same nodes in a second attempt. The same operation
will lead to an identical results, using an identical node that already exists
in the repository as obsolete.

To conclude, we cannot and should not switch to obsolescence markers creation on
histedit --abort and we backout 33e44341bb82. A test to catch this class of
issue will be introduced in the next changeset.
2017-03-26 15:46:09 +02:00
Pierre-Yves David
28c534388d histedit: backout changeset bcd3d9060a3a
Its parent is about to be backedout so this one needs to be removed too.
2017-03-26 15:34:39 +02:00
Augie Fackler
653b207160 revsetlang: fix _quote on int on python3
Thanks to Yuya for spotting the need.
2017-03-26 16:48:29 -04:00
Jun Wu
0c169b3296 runtests: unset editor and pager related environment variables
Those environment variables could affect some configuration and future
tests. Drop them to avoid issues.
2017-03-26 20:58:54 -07:00
Jun Wu
fea7f2c74c debugfsinfo: improve case-sensitive testing
Previously the case-sensitive test was for the current directory, and is
fragile with errors, and could remove a real file called ".debugfsinfo".

This patch improves the case-sensitive testing so it test the given path
using a unique temporary file, and does not crash on errors.
2017-03-26 17:59:33 -07:00
Jun Wu
00bc5a1203 debugfsinfo: show fstype for given path 2017-03-26 17:29:37 -07:00
Pulkit Goyal
1f79d54f45 test-check-py3-commands: cleanup tests related to hg status
We were testing hg status on Python 3 at two places in the test. Cleaned up
one of them.
2017-03-26 21:10:25 +05:30
Pulkit Goyal
eb657f47dd diff: use pycompat.{byteskwargs, strkwargs} to switch opts b/w bytes and str 2017-03-26 20:58:21 +05:30
Pulkit Goyal
dbbae871d3 patch: make regular expressions bytes by adding b'' 2017-03-26 20:54:50 +05:30
Pulkit Goyal
dbc47c9005 dispatch: use pycompat.maplist() instead of map() to get a list 2017-03-26 20:49:18 +05:30
Matt Harbison
ca74aac810 color: fix grammar in help text 2017-03-25 13:29:23 -04:00
Jun Wu
dc9779bcfc statfs: detect more filesystems on Linux
Previously, the code only has what manpager says. In <linux/magic.h>, there
are more defined. This patch adds filesystems that appear in the current
Arch Linux's /proc/filesystems (autofs, overlay, securityfs) and f2fs, which
was seen in news.
2017-03-25 12:58:55 -07:00
Matt Harbison
721da7fc07 repair: use context manager for lock management
If repo.lock() raised inside of the try block, 'tr' would have been None in the
finally block where it tries to release().  Modernize the syntax instead of just
winching the lock out of the try block.

I found several other instances of acquiring the lock inside of the 'try', but
those finally blocks handle None references.  I also started switching some
trivial try/finally blocks to context managers, but didn't get them all because
indenting over 3x for lock, wlock and transaction would have spilled over 80
characters.  That got me wondering if there should be a repo.rwlock(), to handle
locking and unlocking in the proper order.

It also looks like py27 supports supports multiple context managers for a single
'with' statement.  Should I hold off on the rest until py26 is dropped?
2017-03-23 23:47:23 -04:00
Gregory Szorc
ee826b7708 gitweb: use monospace font for commit messages
Commit messages often contain vertically aligned text. The default
paper style already uses monospace fonts for rendering commit messages.
And, AFAICT, a number of Git servers also render commit messages
with monospace. It seems like the reasonable thing to do.

This commit converts all instances of the full commit message
in the gitweb style to render with monospace.
2017-03-24 19:52:43 -07:00
Matt Harbison
bbf17f3e32 pager: improve support for various flavors of more on Windows
Hardcoding 'more' -> 'more.com' means that 'more.exe' from MSYS would need to be
configured with its *.exe extension.  This will resolve to either one, as
cmd.exe would have done if the command ran through the shell.

Something that's maybe problematic with this is it comes after 'pageractive' and
various ui configs have been set by the calling method.  But the other early
exits in this method don't undo those changes either.
2017-03-24 22:40:08 -04:00
Jun Wu
43184506ff statfs: avoid static allocation
Previously we have "static struct statfs" to return a string. That is not
multiple-thread safe. This patch moves the allocation to the caller to
address the problem.
2017-03-24 15:05:42 -07:00
Jun Wu
3633e80713 statfs: change Linux feature detection
Previously we check three things: "statfs" function, "linux/magic.h" and
"sys/vfs.h" headers. But we didn't check "struct statfs" or the "f_type"
field. That means if a system has "statfs" but "struct statfs" is not
defined in the two header files we check, or defined without the "f_type"
field, the compilation will fail.

This patch combines the checks (2 headers + 1 function + 1 field) together
and sets "HAVE_LINUX_STATFS". It makes setup.py faster (less checks), and
more reliable (immutable to the issue above).
2017-03-24 14:59:19 -07:00
Martin von Zweigbergk
6a886bd950 rebase: don't require destination if commands.rebase.requiredest=False 2017-03-24 16:20:10 -07:00
Martin von Zweigbergk
1781d7139a tests: add tests with commands.{update,rebase}.requiredest=False
This shows how rebase is currently broken with
commands.rebase.requiredest=False.
2017-03-24 16:20:04 -07:00
Durham Goode
de02ce8716 rebase: move state serialization to use unfiltered repo
Now that rebasestate is serialized as part of the transaction, the repo state it
sees is the version at the end of the transaction, which may have hidden nodes.
Therefore, it's possible parts of the rebase commit set are no longer visible by
the time the transaction is closing, which causes a filtered revision error in
this code. I don't think state serialization should be blocked from accessing
commits it knows exist, especially if all it's trying to do is get the hex of
them, so let's use an unfiltered repo here.

Unfortunately, the only known repro is with the fbamend Facebook extension, so
I'm not sure how to repro it in core Mercurial for a test.
2017-03-12 12:33:35 -07:00
FUJIWARA Katsunori
7f301613fe largefiles: avoid redundant standin() invocations
There are some code paths, which apply standin() on same value
multilpe times instead of using already standin()-ed value.

"fstandin" is common name for "path to standin file" in lfutil.py, to
avoid shadowing "standin()".
2017-03-24 22:29:22 +09:00
FUJIWARA Katsunori
319a3de075 largefiles: replace hashrepofile by hashfile (API)
There is only one user for the former, and repo.wjoin()-ed value is
alread known by that user.
2017-03-24 22:29:22 +09:00
FUJIWARA Katsunori
b0cce9d114 largefiles: call readstandin() with changectx itself instead of rev or node
readstandin() takes "node" argument to get changectx by "repo[node]".

There are some readstandin() invocations, which use ctx.node(),
ctx.rev(), or '.' as "node" argument above, even though corresponded
changectx object is already looked up on caller side.

This patch calls readstandin() with already known changectx itself, to
avoid meaningless re-construction of changectx (indirect case via
copytostore() is also included).

BTW, copytostore() uses "rev" argument only for readstandin()
invocation. Therefore, this patch also renames it to "revorctx" to
indicate that it can take not only revision ID or so but also
changectx, for readability.
2017-03-24 22:26:34 +09:00
FUJIWARA Katsunori
0813b4a24f largefiles: omit redundant splitstandin() invocations
There are 3 splitstandin() invocations in updatestandin() for same
"standin" value.
2017-03-24 22:24:59 +09:00
FUJIWARA Katsunori
9222f27b6b largefiles: replace splitstandin() by isstandin() to omit str creation
If splitstandin()-ed str itself isn't used, isstandin() should be
used instead of it, to omit meaningless str creation.
2017-03-24 22:24:59 +09:00
FUJIWARA Katsunori
53a96c883c largefiles: omit redundant isstandin() before splitstandin()
There are many isstandin() invocations before splitstandin().

The former examines whether specified path starts with ".hglf/". The
latter returns after ".hglf/" of specified path if it starts with that
prefix, or returns None otherwise.

Therefore, value returned by splitstandin() can be used for
replacement of preceding isstandin(), and this replacement can omit
redundant string comparison after isstandin().
2017-03-24 22:24:58 +09:00
FUJIWARA Katsunori
aaa8db9cef misc: update descriptions about removed file for filectxfn
Since 2eef89bfd70d, filectxfn for memctx should return None for
removed file instead of raising IOError.
2017-03-24 22:13:23 +09:00
Augie Fackler
2c0fcba7fe osx: always purge build/mercurial before starting build
This prevents stray files from previous builds from polluting newer builds.
2017-03-20 17:58:44 -04:00
Augie Fackler
2d61fb35c8 osx: use more paranoid quoting in test 2017-03-20 17:49:47 -04:00
Augie Fackler
9e6dae6142 osx: install completion scripts using install(1) to avoid umask badness
This actually fixes some tests that were showing us umask badness that
had been overlooked.
2017-03-20 17:50:05 -04:00
Martin von Zweigbergk
2e8637ffda merge with stable 2017-03-24 08:37:26 -07:00
Gregory Szorc
6fb64a9cca changegroup: store old heads as a set
Previously, the "oldheads" variable was a list. On a repository at
Mozilla with 46,492 heads, profiling revealed that list membership
testing was dominating execution time of applying small changegroups.

This patch converts the list of old heads to a set. This makes
membership testing significantly faster. On the aforementioned
repository with 46,492 heads:

$ hg unbundle <file with 1 changeset>
before: 18.535s wall
after:   1.303s

Consumers of this variable only check for truthiness (`if oldheads`),
length (`len(oldheads)`), and (most importantly) item membership
(`h not in oldheads` - which occurs twice). So, the change to a set
should be safe and suitable for stable.

The practical effect of this change is that changegroup application
and related operations (like `hg push`) no longer exhibit an O(n^2)
CPU explosion as the number of heads grows.
2017-03-23 19:54:59 -07:00
Simon Farnsworth
ddbe7287e7 subrepo: move prompts out of the if (issue5505)
Prompts weren't available in the else clause
2017-03-20 04:36:55 -07:00
Augie Fackler
e788062ad2 py3: prove `hg {add,addremove,commit} all work
We can't do a second commit in a repo yet, because pure-Python bdiff
is broken on Python 3. That is probably a good next step.
2017-03-19 01:47:56 -04:00
Augie Fackler
b00133b3e1 revsetlang: perform quoting using ui.escapestr instead of repr()
This changes one of the doctest results, but I'm pretty sure on
inspection that it's an equivalent result.
2017-03-23 10:46:50 -04:00