Commit Graph

5737 Commits

Author SHA1 Message Date
Mads Kiilerich
d18a73f120 largefiles: clarify variable name holding file mode
A follow-up to 9ce3ccc6ef9c.

'st' sounds like the whole stat result while 'mode' is a better name for the
actual file mode.
2016-10-18 16:45:39 +02:00
Yuya Nishihara
db11160c56 histedit: use ui.fin to read commands from stdin
stdin is wrapped by channeledinput in command-server session.
2016-03-18 17:15:06 -07:00
Yuya Nishihara
3ea0560e2b convert: have debugsvnlog obtain standard streams from ui
This will help porting to Python 3, where sys.stdin/out/err are unfortunately
unicode streams so we can't use them directly.
2015-10-03 14:34:56 +09:00
Yuya Nishihara
3f27064dab convert: remove superfluous setbinary() calls from debugsvnlog
0f20f68c768c made standard streams set to binary mode globally.
2015-10-03 14:29:13 +09:00
Mads Kiilerich
4409f61ab2 largefiles: handle that a found standin file doesn't exist when removing it
I somehow ended up in a situation where hg crashed on an unlink I introduced in
8fd3fc1ef4c6.

I don't know how it happened and can't reproduce it. It seems like it only can
happen when the file is removed between the time of check in a working
directory context walk that finds a standin file, and the time of use when we
try to remove it because the corresponding largefile doesn't exist.

But better safe than sorry: replace the plain unlink with unlinkpath with
ignoremissing=True. That will also remove remaining empty directories, which
arguably is more correct.
2016-10-27 20:06:33 +02:00
Kevin Bullock
734a4f1625 merge default into stable for 4.0 code freeze 2016-10-18 14:15:15 -05:00
Mads Kiilerich
8f6d6ccc08 largefiles: fix 'deleted' files sometimes persistently appearing with R status
A code snippet that has been around since largefiles was introduced was wrong:
Standins no longer found in lfdirstate has *not* been removed -
they have probably just been deleted ... or not created.

This wrong reporting did that 'up -C' didn't undo the change and didn't sync
the two dirstates.

Instead of reporting such files as removed, propagate the deletion to the
standin file and report the file as deleted.
2016-10-17 17:12:24 +02:00
Mads Kiilerich
231fdaf8a2 largefiles: more safe handling of interruptions while updating modifications
Largefiles are fragile with the design where dirstate and lfdirstate must be
kept in sync.

To be less fragile, mark all clean largefiles as unsure ("normallookup") before
updating standins. After standins have been updated and we know exactly which
largefile standins actually was changed, mark the unchanged largefiles back to
clean ("normal").

This will make the failure mode more safe. If interrupted, the next command
will continue to perform extra hashing of all largefiles. That will do that all
largefiles that are out of sync with their standin will be marked dirty and
they will show up in status and can be cleaned with update --clean.
2016-10-16 02:29:45 +02:00
Mads Kiilerich
39f2a13215 util: increase filechunkiter size to 128k
util.filechunkiter has been using a chunk size of 64k for more than 10 years,
also in years where Moore's law still was a law. It is probably ok to bump it
now and perhaps get a slight win in some cases.

Also, largefiles have been using 128k for a long time. Specifying that size
multiple times (or forgetting to do it) seems a bit stupid. Decreasing it to
64k also seems unfortunate.

Thus, we will set the default chunksize to 128k and use the default everywhere.
2016-10-14 01:53:15 +02:00
Mads Kiilerich
f926541834 largefiles: always use filechunkiter when iterating files
Before, we would sometimes use the default iterator over large files. That
iterator is line based and would add extra buffering and use odd chunk sizes
which could give some overhead.

copyandhash can't just apply a filechunkiter as it sometimes is passed a
genuine generator when downloading remotely.
2016-10-12 12:22:18 +02:00
Danek Duvall
5572888746 color: add some documentation for custom terminfo codes 2016-10-15 15:01:14 -07:00
Danek Duvall
3d2001514d color: debugcolor should emit the user-defined colors
This also fixes a long-standing bug that reversed the sense of the color
name and the label used to print it, which was never relevant before.
2016-10-13 13:10:01 -07:00
Danek Duvall
36e57eb638 color: ignore effects missing from terminfo
If terminfo mode is in effect, and an effect is used which is missing from
the terminfo database, simply silently ignore the request, leaving the
output unaffected rather than causing a crash.
2016-10-13 12:01:41 -07:00
Danek Duvall
fb575a9782 color: allow for user-configurable terminfo codes for effects
If the entry in the terminfo database for your terminal is missing some
attributes, it should be possible to create them on the fly without
resorting to just making them a color.  This change allows you to have

    [color]
    terminfo.<effect> = <code>

where <effect> might be something like "dim" or "bold", and <code> is the
escape sequence that would otherwise have come from a call to tigetstr().
If an escape character is needed, use "\E".  Any such settings will
override attributes that are present in the terminfo database.
2016-10-13 11:48:17 -07:00
Pierre-Yves David
8f6b267699 eol: make sure we always release the wlock when writing cache
If any exception were to happen after we acquired the wlock, we could leave it
unreleased. We move the wlock release in a 'finally:' close as it should be.
2016-10-13 13:47:47 +02:00
Philippe Pepiot
fd197b867c record: return code from underlying commit 2016-10-12 12:22:54 +02:00
Mads Kiilerich
7afa73604d largefiles: use context for file closing
Make the code slightly smaller and safer (and more deeply indented).
2016-10-08 00:59:41 +02:00
Mads Kiilerich
73724460ec largefiles: when setting/clearing x bit on largefiles, don't change other bits
It is only the X bit that it matters to copy from the standin to the largefile
in the working directory. While it generally doesn't do any harm to copy the
whole mode, it is also "wrong" to copy more than the X bit we care about. It
can make a difference if someone should try to handle largefiles differently,
such as marking them read-only.

Thus, do similar to what utils.setflags does and set the X bit where there are
R bits and obey umask.
2016-10-08 00:59:40 +02:00
Mads Kiilerich
cb6727b739 eol: on update, only re-check files if filtering changed
Before, update would mark all files as 'normallookup' in dirstate if .hgeol
changed so all files would get the new filtering applied. That takes some time
... and is pointless if the filtering for that file didn't change.

Instead, keep track of the old filtering and only check files where the
filtering is changed.

To keep the old filtering, change to write the applied .hgeol content to
.hg/eol.cache instead of just touching it. That change is backwards/forwards
compatible.

In a real world test, this takes an update that is changing .hgeol and 30000
files from 12s to 4s - where the remaining eol overhead is 1-2s.
2016-10-09 15:54:49 +02:00
Mateusz Kwapich
f97c61b781 py3: use raw strings in line continuation (convert ext)
Our py2 to py3 string translations marks those as bytestrings.
2016-10-10 05:31:31 -07:00
Mateusz Kwapich
41dd071f2f py3: namedtuple takes unicode (journal ext)
namedtuple usage consistent with changelog.py:141
2016-10-10 05:30:14 -07:00
Mads Kiilerich
7fc89d4630 eol: store and reuse pattern matchers instead of creating in tight loop
More "right" and more efficient.
2016-10-09 15:54:42 +02:00
Mads Kiilerich
e84c500b99 eol: fix variable naming - call it _eolmatch instead of _eolfile
It is not the file but a match object based on it.
2016-10-09 15:42:42 +02:00
Pierre-Yves David
0d0d0a7af9 mq: release lock after transaction in qrefresh
The transaction should be closed within the lock.
2016-08-11 15:05:17 +02:00
Martin von Zweigbergk
cb58483f81 histedit: avoid converting nodeid to context and back again
It looks like this became unnecessary in 8166e7073157 (histedit: fix
preventing strips during histedit, 2015-04-04).
2016-09-27 22:09:28 -07:00
Xidorn Quan
a5b2da437e rebase: rebase changesets in topo order (issue5370) (BC)
There are two reasons that rebase should be done this way:
1. This would make rebasing faster because it would minimize the total
   number of files to be checked out in the process, as it don't need
   to switch back and forth between branches.
2. It makes resolving conflicts easier as user has a better context.

This commit changes the behavior in "Test multiple root handling" of
test-rebase-obsolete.t. It is an expected change which reflects the new
behavior that commits in a branch are grouped together when rebased.
2016-09-17 17:02:56 +10:00
timeless
04798f0fb8 histedit: use single quotes in use warning 2016-09-20 23:45:25 +00:00
timeless
8cd11bcddf keyword: use single quotes in use warning 2016-09-20 23:45:15 +00:00
timeless
80ebd8528d mq: use single quotes in use warning 2016-09-20 23:44:59 +00:00
timeless
64dce2c2d7 pager: use single quotes in use warning 2016-09-20 23:44:49 +00:00
timeless
1be7bec44c rebase: use single quotes in use warning 2016-09-20 23:44:28 +00:00
Durham Goode
769d2595c4 convert: move svn config initializer out of the module level
The svn_config_get_config config call was being called at the module level, but
had the potential to throw permission denied errors if ~/.subversion/servers was
not readable. This could happen in certain test environments where the user
permissions were very particular.

This prevented the remotenames extension from loading, since it imports
convert's hg module, which imports convert's subversion module, which calls
this. The config is only ever used from this one constructor, so let's just move
it in to there.
2016-08-01 17:38:01 -07:00
FUJIWARA Katsunori
7a8d36afcf doc: trim newline at the end of exception message 2016-08-01 06:08:25 +09:00
Christian Ebert
6e0f6b6bd8 keyword: avoid traceback when kwdemo is run outside a repo
68ae3063a47d causes a fatal AttributeError if kwdemo is run outside a repo
because in the temporary repo creation repo is None and therefore cannot have a
baseui attribute.
In this case fall back to using ui.

Add test case.
2016-07-27 13:57:51 +01:00
Matt Mackall
01b803db22 extdiff: escape path for docstring (issue5301)
The existing code (a) assumed path would be specified in
encoding.encoding and (b) assumed unicode() objects wouldn't cause
other parts of Mercurial to blow up. Both are dangerous assumptions.

Since we don't know the encoding of path and can't pass non-ASCII
through docstrings, just escape the path and drop the early _(). Will
have to suffice until we can teach docstrings to handle UTF-8b
escaping.

This has the side-effect that the line containing the path is now
variable by the time it reaches _() and thus can't be translated.
2016-07-18 16:25:35 -05:00
Kevin Bullock
99e7f64512 convert: update use of deprecated bzrlib property
The inventory property was deprecated in favor of root_inventory in bzr
2.5.0. Current version is 2.7.0.

I noticed this when testing locally on Python 2.6.9, which has warnings
turned on by default. The failure that occurs without this patch can be
seen on Python 2.7 by running with warnings enabled:

     $ PYTHONWARNINGS=::DeprecationWarning make 'test-convert-bzr*'
2016-07-19 11:00:32 -05:00
Simon Farnsworth
196af0f28e rebase: turn rebase revs into set before filtering obsolete
When the inhibit extension from mutable-history is enabled, it attempts to
iterate over the rebaseset to prevent the nodes being rebased from being
marked obsolete. This happens at the same time as rebase's
_filterobsoleterevs function trying to iterate over the rebaseset to figure
out which ones are obsolete. The two of these iterating over the same
revset generatorset cause a 'generator already executing' exception. This is
probably a flaw in the revset implementation, since iterating over the same
set twice should be supported.

This regression was introduced in 5d16ebe7b14, since it changed
_filterobsoleterevs to be called before the rebaseset was turned into a
set(). For now let’s just make the rebaseset an actual set again before
calling that function. This was caught by the inhibit tests.

The relevant call stack from test-inhibit.t:

   File "/tmp/hgtests.jgjrN5/install/lib/python/hgext/rebase.py", line 285, in _preparenewrebase
     obsrevs = _filterobsoleterevs(self.repo, rebaseset)
   File "/data/hgbuild/facebook-hg-rpms/mutable-history/hgext/inhibit.py", line 197, in _filterobsoleterevswrap
     r = orig(repo, rebasesetrevs, *args, **kwargs)
   File "/tmp/hgtests.jgjrN5/install/lib/python/hgext/rebase.py", line 1380, in _filterobsoleterevs
     return set(r for r in revs if repo[r].obsolete())
   File "/tmp/hgtests.jgjrN5/install/lib/python/hgext/rebase.py", line 1380, in <genexpr>
     return set(r for r in revs if repo[r].obsolete())
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 3079, in _iterordered
     val2 = next(iter2)
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 3417, in gen
     yield nextrev()
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 3424, in _consumegen
     for item in self._gen:
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 71, in iterate
     cl = repo.changelog
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/repoview.py", line 319, in changelog
     revs = filterrevs(unfi, self.filtername)
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/repoview.py", line 261, in filterrevs
     repo.filteredrevcache[filtername] = func(repo.unfiltered())
   File "/data/hgbuild/facebook-hg-rpms/mutable-history/hgext/directaccess.py", line 65, in _computehidden
     hidden = repoview.filterrevs(repo, 'visible')
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/repoview.py", line 261, in filterrevs
     repo.filteredrevcache[filtername] = func(repo.unfiltered())
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/repoview.py", line 175, in computehidden
     hideable = hideablerevs(repo)
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/repoview.py", line 33, in hideablerevs
     return obsolete.getrevs(repo, 'obsolete')
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/obsolete.py", line 1097, in getrevs
     repo.obsstore.caches[name] = cachefuncs[name](repo)
   File "/data/hgbuild/facebook-hg-rpms/mutable-history/hgext/inhibit.py", line 255, in _computeobsoleteset
     if getrev(n) not in blacklist:
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 3264, in __contains__
     return x in self._r1 or x in self._r2
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 3348, in __contains__
     for l in self._consumegen():
   File "/tmp/hgtests.jgjrN5/install/lib/python/mercurial/revset.py", line 3424, in _consumegen
     for item in self._gen:
 ValueError: generator already executing
2016-07-19 03:29:53 -07:00
Yuya Nishihara
5cb7d27917 chgserver: rename private functions and variables of chgunixservicehandler
self.address has been reanmed to self._realaddress to clarify that it can
be different from the address argument.
2016-05-21 18:16:39 +09:00
Yuya Nishihara
73cb9f2e99 chgserver: refactor initialization of real/base addresses
Instead of overwriting self.address, calculate it from the address argument,
which is the base address.
2016-05-22 14:06:37 +09:00
Yuya Nishihara
fa171b462e chgserver: reorder functions in chgunixservicehandler
This should make it slightly easier to follow the call path.
2016-05-22 14:05:34 +09:00
Yuya Nishihara
9641a7ff4f chgserver: use ui.debug() to print server debug messages
commandserver.log() is noop at this time because no client connection is
established.
2016-05-21 18:15:20 +09:00
Yuya Nishihara
e51719b422 commandserver: unindent superfluous "if True" blocks 2016-05-21 18:14:13 +09:00
Kostia Balytskyi
847780e6fe rebase: remove sortedstate-related confusion
The following rebase implementation details are frustrating:
- storing a list of sorted revision numbers in a field named sortedstate
- having sortedstate be a field of the rebaseruntime class
- using sortedstate[-1] as opposed to a more intuitive max(self.state) to
  compute the latest revision in the state

This commit fixes those imperfections.
2016-07-14 03:12:09 -07:00
Kostia Balytskyi
1c4ad1d1d3 rebase: replace extrafn field with _makeextrafn invocations
As per Yuya's advice, we would like to slightly reduce the amount of state
which is stored in rebaseruntime class. In this case, we don't need to store
extrafn field, as we can produce the necessary value by calling _makeextrafn
and the perf overhead is negligible.
2016-07-14 02:59:27 -07:00
Yuya Nishihara
cbf8b420cf chgserver: switch to new forking service
Threading and complex classes are no longer necessary. _autoexitloop() has
been replaced by polling cycle in the main thread.
2016-05-22 13:36:37 +09:00
Yuya Nishihara
ad9977e54c chgserver: extract stub factory of service object
The class inheritance will be replaced by composition. See the next patch
for details.
2016-05-22 13:13:04 +09:00
Yuya Nishihara
692e073582 chgserver: reorder service classes to make future patches readable
Includes no functional change.
2016-05-22 13:08:30 +09:00
Yuya Nishihara
d298dc2539 commandserver: extract function that serves for the current connection
This will be used by new server implementation.
2016-05-22 12:49:22 +09:00
Yuya Nishihara
be6319726b commandserver: manually create file objects from socket
Prepares for moving away from SocketServer. See the subsequent patches for
why.
2016-05-22 12:44:25 +09:00
Kostia Balytskyi
e27abece5f shelve: make unshelve be able to abort in any case 2016-07-13 16:16:18 +01:00