Commit Graph

10530 Commits

Author SHA1 Message Date
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
Matt Mackall
6e88e21cca date: allow %z in format (issue4040) 2013-11-07 15:24:23 -06:00
Siddharth Agarwal
5fa78a0d83 merge: move forgets to the beginning of the action list
Forgets need to be in the beginning of the action list, same as removes. This
lets us avoid clashes in the dirstate where a directory is forgotten and a
file with the same name is added, or vice versa.
2013-11-06 10:20:18 -08:00
Durham Goode
64d690fd9a rebase: fix rebase aborts when 'tip-1' is public (issue4082)
When aborting a rebase where tip-1 is public, rebase would fail to undo the merge
state. This caused unexpected dirstate parents and also caused unshelve to
become unabortable (since it uses rebase under the hood).

The problem was that rebase uses -2 as a marker rev, and when it checked for
immutableness during the abort, -2 got resolved to the second to last entry in
the phase cache.

Adds a test for the fix. Add exception to phase code to prevent this in the
future.
2013-11-04 19:59:00 -08:00
Johan Bjork
6055bcdec2 patch: ensure valid git diffs if source/destination file is missing (issue4046)
This is arguably a workaround, a better fix may be in the repo to
ensure that it won't list a file 'modified' unless there is a file
context for the previous version.
2013-10-13 08:38:30 -04:00
Pavlos Touboulidis
7e1d441f10 doc: fix internal date sample (issue4072) 2013-10-29 21:54:49 +02:00
Matt Mackall
a40dbdbbc6 bdiff: avoid a memory error on malloc failure 2013-10-30 16:03:42 -05:00
FUJIWARA Katsunori
2151b431ba doc: put text into header of 1st column in table to generate page correctly
>From the table without header text of 1st column, docutils generates
the table with fully empty header row.
2013-10-25 01:14:18 +09:00
FUJIWARA Katsunori
23f95aaedb doc: use double quotation mark to quote arguments in examples for Windows users
On Windows, only double quotation mark can quote command line
arguments.

So, this patch uses double quotation mark to quote command line
arguments in all examples of online help document.
2013-10-25 01:14:18 +09:00
FUJIWARA Katsunori
19e586921c doc: end line preceding command line example with double colon 2013-10-25 01:14:18 +09:00
Takumi IINO
56ac953b3c hgweb: add missing semicolon 2013-10-24 21:37:13 +09:00
Mads Kiilerich
eabc047878 spelling: random spell checker fixes 2013-10-24 01:49:56 +08:00
Yuya Nishihara
4a2a9b7d3a cmdutil: fix makefileobj not to clobber default modemap dict
Problem occurs if "hg cat -o" is invoked more than once in the same process.
The output of "hg cat" will be appended because of modemap[fn] = 'ab'.
2013-10-22 23:38:58 +09:00
Matt Mackall
6ddd78602b help: minor tweak to push help 2013-10-21 10:26:38 -07:00
FUJIWARA Katsunori
9246c0599a discovery: revise hint message introduced by changeset 49ed20ea8da0
This patch revises hint message from "for detail about" introduced by
changeset 49ed20ea8da0 to "for details about", to unify it with the
hint message introduced by proceeding patch.
2013-10-03 23:16:07 +09:00
FUJIWARA Katsunori
ad1b5de6ff push: add more detailed explanation about "--force" to online help document
This patch adds more detailed explanation about "--force" to online
help document of "hg push" to prevent novice users to execute "push
--force" easily without understanding about problems of multiple
branch heads in the repository.
2013-10-03 23:16:06 +09:00
FUJIWARA Katsunori
3198fa3830 push: hide description about "-f" in the hint to prevent from using it easily
"use push -f to force" in the hint at abortion of "hg push" may cause
novice users to execute "push -f" easily without understanding about
problems of multiple branch heads in the repository.

This patch hides description about "-f" in the hint, and leads into
seeing "hg help push" for details about pushing new heads.
2013-10-03 23:16:06 +09:00
FUJIWARA Katsunori
d01f604fec demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.

For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.

Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.

This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.

This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.

    - invocation of "_import()" when root module imports sub-module by
      absolute path without "fromlist"

      for example, "import a.b" in "a.__init__.py".

      extensions are loaded with "hgext_" prefix, and this causes
      execution of another (= fixed by this patch) code path.

    - invocation of "_origimport()" when "level != -1" with "fromlist"

      for example, importing after "from __future__ import
      absolute_import" (level == 0), or "from . import b" or "from .a
      import b" (0 < level),

      for portability between python versions and environments,
      extensions shouldn't cause "level != -1".
2013-10-05 01:02:22 +09:00
FUJIWARA Katsunori
24ac3edef8 demandimport: support "absolute_import" for external libraries (issue4029)
Before this patch, demandimport of Mercurial may fail to load external
libraries using "from __future__ import absolute_import": for example,
importing "foo" in "bar.baz" module will load "bar.foo" if it exists,
even though "absolute_import" is enabled in "bar.baz" module.

So, extensions for Mercurial can't use such external libraries.

This patch saves "level" of import request for on-demand module
loading in the future: default value of level is -1, and level is 0
when "absolute_import" is enabled.

"level" value is passed to built-in import function in
"_demandmod._load()" and it should load target module correctly.

This patch changes only one "_demandmod" construction case other than
cases below:

    - construction in "_demandmod._load()"

      this code path should be used only in relative sub-module
      loading case

    - constructions other than patched one in"_demandimport()"

      these code paths shouldn't be used in "level != -1" case
2013-10-05 01:02:22 +09:00
Siddharth Agarwal
69eb5c00b0 merge: exit early during a no-op update (BC)
hg update . (or equivalents) are effectively no-ops in just about all
circumstances.  These sorts of updates can be especially common in a
bookmark-oriented workflow. This saves us a status check and a manifest
decompression, which means that on a repo with over 210,000 files, this brings
hg update . down from 2.5 seconds to 0.15.

There is one change in behavior: a file that was added, not committed, and then
deleted but not removed used to be removed from the dirstate. With this patch
it isn't. This is what causes the change in test-mq-qpush-exact.t. This seems
like it's enough of an edge case to not be worth handling.

The output of test-empty.t changes because those files are not yet created.
2013-10-01 17:43:54 -07:00
FUJIWARA Katsunori
fb1d8fd59b localrepo: invoke only feature setup functions for enabled extensions
Before this patch, each feature setup functions for localrepository
class should examine whether corresponding extension is enabled or not
by themselves.

This patch invokes only feature setup functions defined in module of
enabled extensions, and it makes implementation of feature setup
functions easier and simpler.
2013-10-17 21:45:17 +09:00
Yuya Nishihara
a87a5e29b1 lock: handle race in trylock/testlock on Windows
readlock may raise IOError if the system does not support symlink.
2013-10-02 21:16:40 +09:00
Mads Kiilerich
a971393dbd commands: refactor 'serve', extract the http service class 2013-10-10 04:32:36 +02:00
Siddharth Agarwal
7decbaaad4 dirstate.status: return explicit unknown files even when not asked
dirstate.walk will return unknown files that were explicitly requested, even
if listunknown is false. There's no point in dropping these files on the
floor in dirstate.status.

This has no effect on any current callers, because all of them assume the
unknown list is empty and ignore it. Future callers may find it useful,
though.
2013-10-14 00:25:29 -04:00
Alexander Plavin
836ffef4a8 hgweb: fix unstoppable loading of graph when no more results
When a user reaches the end of repo history with graph view, it (unsuccessfully)
tried to load more entries. This patch disables further loading attempts.
2013-10-12 11:29:28 +04:00
Alexander Plavin
24f9b953ea hgweb: remove now unnecessary explicit header() and footer()
They became unnecessary after allowing custom-named entries in templates.
2013-07-24 03:20:26 +04:00
Alexander Plavin
06d5dbdf36 hgweb: replace 'shortlog' with 'changelog' in raw changelog template 2013-08-16 21:41:19 +04:00
FUJIWARA Katsunori
0b2abf8689 store: use "vfs.exists()" instead of "os.path.exists()" 2013-10-15 00:51:05 +09:00
FUJIWARA Katsunori
52c2363e13 context: use "vfs.lstat()" to examine target path instead of "os.path.*"
This patch gets stat object of target path by "vfs.lstat()", and
examines stat object to know the type of it. This follows the way in
"workingctx.add()".

This should be cheaper than original implementation invoking
"lexists()", "isfile()" and "islink()".
2013-10-15 00:51:05 +09:00
FUJIWARA Katsunori
269961e114 context: use "vfs.lstat()" instead of "os.lstat()" 2013-10-15 00:51:04 +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
6d7cc2f5e0 changelog: use "vfs.rename()" instead of "util.rename()" 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
Mads Kiilerich
c47c81f0e5 cmdutil: use None as default value for "function pointer" instead of False
Less type confusion.
2013-10-03 18:01:21 +02:00
Mads Kiilerich
86ecd7ae1f graft: make skip messages more helpful
This makes it possible for the user to understand and accept or work around
what is happening.
2013-10-03 18:01:21 +02:00
Matt Mackall
397a3b5d72 merge with stable 2013-10-09 14:15:34 -07:00
Matt Mackall
e1cd16976f hgweb: add escaping of tags and bookmarks in graph view 2013-10-09 12:02:32 -07:00
Matt Mackall
23bced957e json: add more paranoid escaping 2013-10-09 11:50:19 -07:00
Matt Mackall
4b0ea6e3c8 ui: send password prompts to stderr again (issue4056) 2013-10-09 11:27:59 -07:00
Matt Mackall
1b8efe2652 hgweb: escape branch names in graph view 2013-10-07 15:21:17 -07:00
Durham Goode
f6186031f7 changegroup: don't run changegroup hooks if nodes are gone
The changegroup hook runs when the repo lock is released, but it's possible that
multiple transactions have happened during that single lock and therefore the
commits the hook was for may be gone. This is the case in the shelve extension
where it adds a commit and strips it in the same lock but different
transactions (which results in warning messages during unshelve on hgsubversion
repos).

A real fix would be to attach the hook to the transaction instead, but that
might have unknown consequences. Since we're this close to code-freeze, this fix
just prevents the hook from running if the commit disappeared.
2013-10-07 11:45:01 -07:00
Augie Fackler
cdf1bbd9e1 merge with stable 2013-10-07 17:47:55 -04:00
Johan Bjork
bbce7855f8 patch: Fix nullid for binary git diffs (issue4054)
The index for an empty file in git is not 0, but sha-1("blobl 0\0").
2013-10-07 17:47:19 -04:00
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02:00
Siddharth Agarwal
0b1ce7709c cmdutil.service: move pidfile writing to the parent in daemon mode
There is a potential race here, which I suspect I've spotted in the wild, where
something reads the pid file after the parent exits but before the child has
had a chance to write to it. Moving writing the file to the parent causes this
to no longer be an issue.
2013-10-02 15:20:49 -07:00
Siddharth Agarwal
e4986d8e9e cmdutil.service: move pidfile writing to a local function
An upcoming patch will reuse this code.
2013-10-02 15:17:50 -07:00
David Soria Parra
4e97756fe4 hgweb: log headers only if headers were successfully parsed
The headers attribute is not initialized in certain error situations
(e.g. http 400 bad request). Check for self.headers before we attempt
to access it.
2013-10-01 09:54:46 +02:00