Commit Graph

168 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
4956966646 vfs: add "mkstemp()" 2014-03-09 01:03:28 +09:00
Pierre-Yves David
ce5b702bdf revpair: smartset compatibility
Since recent revset changes, revrange now return a smartset. This smart set
probably does not support indexing (_addset does not). This led to crash.
Instead when the smartset is ordered we use the `min` and `max` method of
smart set. Otherwise we turn is into a list and use indexing on it.

The tests have been updated to catch such regression.
2014-03-20 18:44:25 -07:00
Mads Kiilerich
914cc822c9 repo: rephrase the "missing requirement" error message
Unknown requirements will now be reported as:
  abort: repository requires features unknown to this Mercurial: largefiles!
  (see http://mercurial.selenic.com/wiki/MissingRequirement for more information)

Some features of this phrasing:
* avoid double ':' in abort message
* make it more clear who requires and knows what
* don't quote the requirement names - it is not something the user entered or
  need the exact spelling of ... and it is "identifiers" that are unambiguous
  anyway
* remove double hint by removing "(upgrade Mercurial)" comment
* don't mention upgrading Mercurial without mentioning enabling the feature -
  instead, just refer to wiki page for both
* don't just talk about "details", talk about "more information"
2014-03-19 00:18:30 +01:00
Pierre-Yves David
c515a37f0e revpair: drop useless conditional
The `if not revs:` case is tested at the beginning of the function.
2014-03-20 17:34:02 -07:00
Durham Goode
c173245d83 scmutil: fix revrange when multiple revs are specified
revrange was trying to add a list to a revset class, but revset classes only
support adding with other revset classes. So wrap the lists in basesets.
2014-03-20 09:55:44 -07:00
Matt Mackall
2dfc464098 revrange: pass repo to revset parser
This allows handling of hyphenated symbols for command-line revsets.
2014-03-18 17:56:27 -05:00
Pierre-Yves David
4b1a4196e2 require: provide a link to a wiki page in addition of suggesting upgrade
The wiki page is intended to describe several solution to the requirement issue.
Some of those solutions does not involve upgrading mercurial. That is very
useful for people that can't easily upgrade they Mercurial in some place.
2011-06-25 02:46:23 +02:00
Matt Mackall
b93e6d4112 merge with stable 2014-03-13 12:05:08 -05:00
Cristian Zamfir
c85ed151ff hg log: solves bug regarding hg log -r 0:null (issue4039)
'hg log -r 0:null' was showing only one changeset(the '-1' one) instead of the first two changesets.
2014-03-12 10:26:48 +02:00
Lucas Moscovicz
5e0ec4bc97 scmutil: changed revrange code not to use append
Removed one call to the append method
2014-02-24 09:27:32 -08:00
Lucas Moscovicz
ec3c3a2803 scmutil: changed revrange to return lazysets for new style revsets
When there is an old style revset or both it will still return a baseset. This
may be changed in later patches.
2014-02-12 15:30:27 -08:00
Lucas Moscovicz
ba7cfe4ed4 revset: changed revsets to use spanset
Performance Benchmarking:

$ hg perfrevset "first(all())"
! wall 0.304936 comb 0.300000 user 0.280000 sys 0.020000 (best of 33)

$ ./hg perfrevset "first(all())"
! wall 0.175640 comb 0.180000 user 0.160000 sys 0.020000 (best of 56)
2014-02-03 10:15:15 -08:00
Augie Fackler
8bfe6ea1ed itersubrepos: move to scmutil to break a direct import cycle 2014-02-03 18:36:00 -05:00
Lucas Moscovicz
ef8bd69f5f revset: added baseset class (still empty) to improve revset performance
This class is going to be used to cache the set that is created from this list
in many cases while evaluating a revset.
2014-01-21 11:39:26 -08:00
FUJIWARA Katsunori
f2d55c7c7d vfs: add "makelock()" and "readlock()" 2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
f39330457a vfs: add "chmod()" 2013-11-12 16:23:52 +09:00
FUJIWARA Katsunori
d6fa8a9bfa vfs: add "isfile()" 2013-11-12 16:23:52 +09:00
Siddharth Agarwal
25418f3155 scmutil.filecache: support watching over multiple files 2013-11-16 13:29:39 -08:00
Siddharth Agarwal
fceaf0623e scmutil: introduce a filecacheentry that can watch multiple paths 2013-11-16 13:24:26 -08:00
Siddharth Agarwal
3585a23345 scmutil: rename filecacheentry to filecachesubentry
Upcoming patches will allow the file cache to watch over multiple files, and
call the decorated function again if any of the files change.

The particular use case for this is the bookmark store, which needs to be
invalidated if either .hg/bookmarks or .hg/bookmarks.current changes. (This
doesn't currently happen, which is a bug. This bug will also be fixed in
upcoming patches.)
2013-11-16 13:19:06 -08:00
Siddharth Agarwal
cb19f2bbbe scmutil.filecacheentry: make stat argument to constructor mandatory
There's no real upside to making stat optional -- this constructor has just two
callers.
2013-11-16 13:33:33 -08:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00
FUJIWARA Katsunori
d759404236 scmutil: skip checks in "casecollisionauditor" if filename is already checked
Before this patch, almost all of check code in
"casecollisionauditor.__call__()" is executed, even if specified
filename is already checked, because "f in self._newfiles" is examined
lastly.

In addition to it, adding "fl" to "self._loweredfiles" and "f" to
"self._newfiles" are also redundant in such case.

This patch checks "f in self._newfiles" first, and returns immediately
to avoid execution of check code for efficiency.
2013-11-12 00:07:23 +09:00
FUJIWARA Katsunori
770590e67f context: use "vfs.lstat()" instead of "os.lstat()"
This patch also changes paths added to "rejected" list from full path
(referred by "p") to relative one (referred by "f"), when type of
target path is neither file nor symlink.

This change should be reasonable, because the path added to "rejected"
list is relative one, when "OSError" is raised at "lstat()".
2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
61a538d89f changelog: use "vfs.fstat()" instead of "util.fstat()"
Just invoking "os.fstat()" with "file.fileno()" doesn't require non
ANSI file API, because filename is not used for invocation of
"os.fstat()".

But "util.fstat()" should invoke "os.stat()" with "fp.name", if file
object doesn't have "fileno()" method for portability, and "fp.name"
may cause invocation of non ANSI file API.

So, this patch makes the constructor of appender class invoke
"util.fstat()" via vfs, to encapsulate filename handling.
2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
49c8ebb7ec vfs: add "open()" for newly added code paths which open files via vfs
This patch replaces "open()" by own "__call__()" defined in derived
classes at the first invocation, for efficiency of succeeding
invocations.
2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
23a7a98972 bookmarks: use "vfs.utime()" instead of "os.utime()" 2013-10-15 00:51:04 +09:00
FUJIWARA Katsunori
33e3348b3e bookmarks: use "vfs.unlink()" instead of "util.unlink()" 2013-10-15 00:51:04 +09:00
Siddharth Agarwal
4f7171d11d addremove: don't do full walks
Full walks are only necessary when the caller needs the list of clean files.
addremove by definition doesn't need them.

With this patch and an extension that produces a subset of results for
dirstate.walk when full is False, on a repository with over 200,000 files, hg
addremove drops from 2.8 seconds to 0.5.
2013-09-04 18:42:55 -07:00
Matt Mackall
fac649fcb2 revsingle: fix silly API issue (issue2992) 2013-07-26 15:42:10 -05:00
Siddharth Agarwal
c944ae0c27 scmutil: add a function to mark that files have been operated on
Several places use scmutil.addremove as a means to declare that certain files
have been operated on. This is ugly because:
- addremove takes patterns relative to the cwd, not paths relative to the root,
  which means extra contortions for callers.
- addremove doesn't make clear what happens to files whose status hasn't
  changed.

This new method accepts filenames relative to the repo root, and has a much
clearer contract. It also allows future modifications that do more with files
whose status hasn't changed.
2013-04-04 13:38:28 -07:00
Siddharth Agarwal
9ad5c8f0a6 scmutil.addremove: factor out code to mark added/removed/renames
An upcoming patch will reuse this code in another function.
2013-04-03 15:53:59 -07:00
Siddharth Agarwal
c89587db25 scmutil.addremove: factor out code to find renames
This code will be used in a different context in upcoming patches.
2013-04-03 16:32:41 -07:00
Siddharth Agarwal
76d8b6d164 scmutil.addremove: rename local 'copies' to 'renames'
An upcoming patch will refactor some code out into a method called
_findrenames. Having a line saying "copies = _findrenames..." is confusing.
Besides, 'renames' is a more precise name for this local anyway.
2013-04-03 15:32:15 -07:00
Siddharth Agarwal
5839ae6e69 scmutil.addremove: factor out dirstate walk into another function
Upcoming patches will reuse and expand on this function for other purposes.
2013-04-02 17:19:36 -07:00
Durham Goode
1b7b932cfc translations: change label integer error to not specify the kind of label
The current error message used the kind (bookmark, branch, tag) in the message.
Unfortunately this isn't easily translatable since some languages give different
genders to these words. The fix is to not specify it at all, since it should be
implicit based on the command the user just ran.

Relevant discussions around this area:
http://selenic.com/pipermail/mercurial-devel/2012-October/045567.html
http://selenic.com/pipermail/mercurial-devel/2012-October/045600.html
2013-04-19 10:55:11 -07:00
FUJIWARA Katsunori
2dcdc7d9fa localrepo: use "vfs.setflags()" instead of "util.setflags()" 2013-04-15 01:22:15 +09:00
FUJIWARA Katsunori
721696db5d localrepo: use "vfs.readlink()" instead of "os.readlink()" 2013-04-15 01:22:15 +09:00
FUJIWARA Katsunori
bc43776a26 localrepo: use "vfs.islink()" instead of "os.path.islink()" 2013-04-15 01:22:15 +09:00
FUJIWARA Katsunori
8e88b218bd localrepo: use "vfs.rename()" instead of "util.rename()" 2013-04-15 01:22:15 +09:00
FUJIWARA Katsunori
0860626b09 vfs: split "expand" into "realpath"/"expandpath" to apply each separately
Before this patch, vfs constructor applies both "util.expandpath()"
and "os.path.realpath()" on "base" path, if "expand" is True.

This patch splits it into "realpath" and "expandpath", to apply each
functions separately: this splitting can allow to use vfs also where
one of each is not needed.
2013-04-15 01:22:15 +09:00
Bryan O'Sullivan
8f78d582d5 scmutil: rewrite dirs in C, use if available
This is over twice as fast as the Python dirs code. Upcoming changes
will nearly double its speed again.

perfdirs results for a working dir with 170,000 files:
  Python     638 msec
  C          244
2013-04-10 15:08:27 -07:00
Bryan O'Sullivan
c1db508ee8 scmutil: add a dirs class
This encapsulates the "multiset of directories" structures that are
currently open-coded (and duplicated) in both the dirstate and
context modules.

This will be used, and optionally replaced by a C implementation,
in upcoming changes.
2013-04-10 15:08:26 -07:00
Bryan O'Sullivan
00ff38c9c3 scmutil: migrate finddirs from dirstate 2013-04-10 15:08:25 -07:00
Siddharth Agarwal
070b188489 scmutil.addremove: use iteritems on walk results
Now that we no longer sort all the walk results, using iteritems becomes
possible.

This is a relatively minor speedup: on a large repository with 170,000 files,
perfaddremove goes from 2.13 seconds to 2.10.
2013-04-02 14:50:50 -07:00
Siddharth Agarwal
cf3792485f scmutil.addremove: stop sorting all walk results
The only place where the order matters is in printing out added or removed
files. We already sort that set.

On a large repository with 170,000 files, this speeds up perfaddremove from
2.34 seconds to 2.13.
2013-04-02 14:50:31 -07:00
Siddharth Agarwal
eff1b30357 scmutil.addremove: pull ui.status printing out of the loop
This will let us stop sorting all the results in an upcoming patch.

This also permits future refactorings where the same code consumes
dirstate.walk results but doesn't print anything out.

An argument could be made that printing out results as we go along is more
responsive UI-wise. However, at this point iterating through walk results is
actually faster than sorting them, so once we stop sorting all the results the
argument ceases to be valid.
2013-04-02 10:56:24 -07:00
Siddharth Agarwal
c4b1cf0480 scmutil.addremove: remove redundant directory and symlink checks
dirstate.walk only does lstats and never returns stat objects for directories.

On a large repository with 170,000 files, this speeds perfaddremove up from
2.40 seconds to 2.34.
2013-04-02 14:49:34 -07:00
Siddharth Agarwal
392b6d1872 scmutil.addremove: pull repo.dirstate fetch out of the loop
On a large repository with 170,000 files, this speeds up perfaddremove from
2.78 seconds to 2.40.
2013-04-02 14:46:55 -07:00
Siddharth Agarwal
64922bc1af scmutil: remove dead updatedir code
This code has not been used in a long while.
2013-04-01 20:38:37 -07:00