Commit Graph

27364 Commits

Author SHA1 Message Date
Gregory Szorc
3c89ffe42f templates: differentiate between partial and full topic name
In order to support sub-topics, we need to support linking to a full
topic name while displaying the base topic name. Change the {helpentry}
template to grab the display name from an optional seperate variable
(which will be defined in a future patch).
2015-12-30 17:01:28 -07:00
Gregory Szorc
627d3b55af templates: make earlycommands and othercommands optional
We now have sub-topics in the help system. The "helptopics" template
serves as a mechanism for displaying an index of help topics.
Previously, it was only used to show the top-level list of help topics,
which includes special groupings of topics.

In the near future, we'll adapt "helptopics" for showing the index
of sub-topics. In this patch, we optionally render {earlycommands} and
{othercommands} since they aren't present on sub-topics.
2015-12-30 17:12:59 -07:00
Laurent Charignon
901d6a2088 rebase: better error message when rebased changes are all in destination
Before this patch, when rebasing a set of obsolete revisions that were plain
pruned or already present in the destination, we were displaying:

abort: no matching revisions

This was not very helpful to understand what was going on, instead we replace
the error message by:

abort: all requested changesets have equivalents or were marked as obsolete
(to force the rebase, set the config experimental.rebaseskipobsolete to False)
2015-12-29 15:32:12 -08:00
Eric Sumner
c24dabdde6 lrucachedict: add copy method
This diff implements the standard dict copy() method for lrucachedicts, which
will be used in the pushrebase extension to make a copy of the manifestcache.
2015-12-30 13:10:53 -08:00
Matt Mackall
725a0fc8db merge with stable 2015-12-31 09:55:56 +01:00
Yuya Nishihara
f69357a4da push: restore old behavior of default-push (issue5000)
This effectively backs out 163c899d1e46 and f44b0edaab90.

We can't handle "default-push" just like "default:pushurl" because it is a
stand-alone named path. Instead, I have two ideas to work around the issue:

 a. two defaults: getpath(dest, default=('default-push', 'default'))
 b. virtual path: getpath(dest, default=':default')

(a) is conservative approach and will have less trouble, but callers have
to specify they need "default-push" or "default". (b) generates hidden
":default" path from "default" and "default-push", and callers request
":default". This will require some tricks and won't work if there are
conflicting sub-options valid for both "pull" and "push".

I'll take (a) for default branch. This patch should NOT BE MERGED to default
except for tests because it would break handling of "pushurl" sub-option.
2015-12-26 15:18:16 +09:00
timeless
895fc55886 tests: add test-check-execute.t
Try to prevent people from adding files with incorrect execute bits
2015-12-22 11:05:56 +00:00
timeless
04b3592b35 parents: correct help revset replacements
Implementing `hg parents -r REV FILE` correctly is hard.

The output can be 0, 1, or 2 revs.

First, you can't use parents(), because it sorts its output...

Consider:
echo $a
echo par@rev: `hg log -r "parents($a)" -q`
echo p12@rev: `hg log -r "p1($a)+p2($a)" -q`
echo parents: `hg parents -q -r $a`

(Merge 1 into 0)
3
par@rev: 0:d9612eafe8ec 1:070fe4290d06
p12@rev: 0:d9612eafe8ec 1:070fe4290d06
parents: 0:d9612eafe8ec 1:070fe4290d06

(Merge 4 into 5)
6
par@rev: 4:db73392995c3 5:c26e7dd67644
p12@rev: 5:c26e7dd67644 4:db73392995c3
parents: 5:c26e7dd67644 4:db73392995c3

(Merge 7 into 8)
9
par@rev: 7:d84f47462f70 8:9597bcab36e0
p12@rev: 8:9597bcab36e0 7:d84f47462f70
parents: 8:9597bcab36e0 7:d84f47462f70

You also can't use parents or/p1/p2 alone with a set, as in:
-r "parents(::REV and file(FILE))"
-r "parents(::REV - REV and file(FILE))"
... because each will return all parents for each candidate revision,
and the :: gives too many candidates.

Thus, we need a max and a p1/p2.

Also, anything of this form:
max(::REV - REV and file(FILE))
... is wrong, because max will return only one revision, and for
a proper parents, you need to return two occasionally.

Lastly, it doesn't help that `hg parents -r REV FILE` is buggy
due to a quirk in filelogs.

Here's a repository to consider when evaluating whether your
revset is correct:

$ hg log -G --template '{rev} {files}\n';
@  10 a
|
o    9 a b
|\
| o  8 a
| |
o |  7 a
| |
+---o  6 b
| |/
| o  5 b
| |
o |  4 b
| |
+---o  3
| |/
+---o  2
| |/
| o  1 b
|
o  0 a

revs 4 and 5 create a conflict.
The conflict is resolved in the same way by both 6 and 9.

You would hope that parents around 9/10 would point to 9,
but `hg parents` will point to 6 due to the aforementioned bug.

Here's the winning solution test script and its output.

echo $a;
echo rp12-max: `hg log -r "max(::p1($a) and file(b)) + max(::p2($a) and file(b))" -q` 2> /dev/null;
echo expected: `hg parents -q -r $a b` 2> /dev/null;

Note that for 10, the output differs, but again, this is because
of the aforementioned bug. The rp12-max output is "correct",
whereas "expected" is just an unfortunate bug. The abort output
is due to something else. I'm not sure why someone thought it
was important to abort to stdio instead of stderr, but that's
really not my problem here.

10
rp12-max: 9:184ebefc2fce
expected: 6:dd558142b03f
9
rp12-max: 5:c26e7dd67644 4:db73392995c3
expected: 5:c26e7dd67644 4:db73392995c3
8
rp12-max: 5:c26e7dd67644
expected: 5:c26e7dd67644
7
rp12-max: 4:db73392995c3
expected: 4:db73392995c3
6
rp12-max: 5:c26e7dd67644 4:db73392995c3
expected: 5:c26e7dd67644 4:db73392995c3
5
rp12-max: 1:070fe4290d06
expected: 1:070fe4290d06
4
rp12-max:
abort: 'b' not found in manifest!
expected:
3
rp12-max: 1:070fe4290d06
expected: 1:070fe4290d06
2
rp12-max: 1:070fe4290d06
expected: 1:070fe4290d06
1
rp12-max:
abort: 'b' not found in manifest!
expected:
0
rp12-max:
abort: 'b' not found in manifest!
expected:
2015-12-23 19:07:34 +00:00
timeless
2a6d0ff53a run-tests: avoid double counting server fails 2015-12-28 16:01:31 +00:00
Sean Farley
972541224f crecord: stop raising error.Abort if curses is not found (issue5008)
On some servers, python curses support is disabled. This patch not only fixes
that but provides a fallback on other machines (e.g. Windows) when curses is
not found.

The previous code was actually flawed logic and relied on wcurses throwing an
ImportError which demandimport wouldn't throw. So, this patch also fixes that
problem.
2015-12-16 10:39:00 -08:00
Sean Farley
b03ec18822 cmdutil: use crecordmod.checkcurses
Instead of blindly trusting the user's experimental.crecord, we use checkcurses
to abstract that logic so that we can handle the case where python was not
built with curses.
2015-12-15 16:01:45 -08:00
Sean Farley
38fab65a09 crecord: ensure that curses is False if not imported
This provides no functional change but makes the next two patches easier to
review.
2015-12-15 16:00:06 -08:00
Sean Farley
db61c5aa1f crecord: add helper function to determine if we should use curses
To fix issue5008 properly, we need a helper function to determine if curses is
imported and also if the user has enabled the experimental flag.
2015-12-15 15:56:10 -08:00
Sean Farley
e8a52b93c0 crecord: use try/except for import of curses
Not only does this improve fragility with 'if os.name == ...' it will help
future patches enable the behavior to fallback to use plain record when curses
is unavailable (e.g. python compiled without curses support).
2015-12-16 10:33:19 -08:00
FUJIWARA Katsunori
4d3a0ec7d1 mq: use fallback patch name if no alpha-numeric in summary line (issue5025)
Before this patch, "hg qimport -r REV" fails, if the summary line of
description of REV doesn't contain any alpha-numeric bytes.

In this case, all bytes in the summary line 'title' are dropped from
'namebase' by the code path below.

     namebase = re.sub('[\s\W_]+', '_', title.lower()).strip('_')

'makepatchname()' immediately returns this empty string as valid patch
name, because patch name conflicting against empty string never
exists.

Then, "hg qimport -r REV" is aborted at creation of patch file with
empty filename.

This situation isn't so rare. For example, ordinary texts in Japanese
often consist of non alpha-numeric bytes in UTF-8.

This patch makes 'makepatchname()' use fallback patch name if the
summary line of imported revision doesn't contain any alpha-numeric
bytes.
2015-12-23 22:28:52 +09:00
Martin von Zweigbergk
0a6dbcd4ad revlog: fix bad indentation (replace tab by space) 2015-12-18 20:54:41 -08:00
Gregory Szorc
2632a8c77a revlog: seek to end of file before writing (issue4943)
Revlogs were recently refactored to open file handles in "a+" and use a
persistent file handle for reading and writing. This drastically
reduced the number of file handles being opened.

Unfortunately, it appears that some versions of Solaris lose the file
offset when performing a write after the handle has been seeked.

The simplest workaround is to seek to EOF on files opened in a+ mode
before writing to them, which is what this patch does.

Ideally, this code would exist in the vfs layer. However, this would
require creating a proxy class for file objects in order to provide a
custom implementation of write(). This would add overhead. Since
revlogs are the only files we open in a+ mode, the one-off workaround
in revlog.py should be sufficient.

This patch appears to have little to no impact on performance on my
Linux machine.
2015-12-17 17:16:02 -08:00
Yuya Nishihara
240828180d commandserver: reset state of progress bar per command
A progress bar is normally disabled in command-server session, but chg can
enable it. This patch makes sure the last-print time is measured per command.
Otherwise, progress.delay could be ineffective if a progbar was loaded before
forking worker process.

This patch is corresponding to the following change.

https://bitbucket.org/yuja/chg/commits/2dfe3e90b365
2015-12-14 23:50:02 +09:00
Yuya Nishihara
76486fd2e7 commandserver: do not set nontty flag if channel is replaced by a real file
This prepares for porting the chg server. In chg, a server receives client's
stdio over a UNIX domain socket to override server channels. This is because
chg should behave as if it is a normal hg command attached to tty. "nontty"
is not wanted.

This patch is corresponding to the following change. This doesn't test the
identity of "cin" object because the current version of chg reopens stdio
to apply buffering mode.

https://bitbucket.org/yuja/chg/commits/c48c7aed5fc0
2015-12-14 23:13:42 +09:00
timeless
da9e1e1cb0 run-tests: report missing feature for skipped tests 2015-12-22 08:00:03 +00:00
Yuya Nishihara
de1b826a0e paths: do not process default-push as pushurl of default path (issue5000)
It didn't work because "default-push" and "default" are independent named
items. Without this patch, "hg push default" would push to "default-push"
because paths["default"].pushloc was overwritten by "default-push".

Also, we shouldn't ban a user from doing "hg push default-push" so long as
"default-push" item is defined, not "default:pushurl". Otherwise, he would
be confused by missing "default-push" path.

Tests are included in a patch for stable branch.
2015-12-26 16:06:12 +09:00
Yuya Nishihara
2b215bf881 push: specify default-push and default as fallback paths
The next patch will remove the "default-push" hack from ui.paths so that
ui.paths["default"].pushurl can be different from "default-push".
2015-12-26 16:12:28 +09:00
Yuya Nishihara
171a817aca paths: make getpath() accept multiple defaults
This is necessary to handle "default-push" and "default" as fallback items.
We can't apply the same rule as "default:pushurl" because "default-push" is
a valid named path.

This series is for default branch. I have a simpler patch for stable.
2015-12-26 16:10:39 +09:00
timeless
8dd6ee4d9a check-code: improve test-check-code error diffs
Whenever check-code finds something wrong, the diffs it
generated were fairly hard to read.

The problem is that check-code before this change
would list files that were white listed using
no- check- code but without a glob marker.

Whereas, the test-check-code.t expected output has
no-che?k-code (glob) in order to avoid having itself
flagged as a file to skip.

Thus, in addition to any lines relating to things you
did wrong, all of the white-listed files are listed as
changed.

There is no reason for things to be this painful.

This change makes the output from check-code.py match
the expected output in test-check-code.t
2015-12-24 19:32:14 +00:00
Gregory Szorc
07328dec9f destutil: use scmutil.revrange for desthistedit (issue5001)
This allows user aliases to be expanded. It also prevents the
user-provided revset from being treated as a revset expression.
2015-12-24 10:16:30 -08:00
Matt Mackall
a323d9f732 pull: make a single call to obsstore.add (issue5006)
Prior to this, a pull of 90k markers (already known locally!) was
making about 2000 calls to obsstore.add, which was repeatedly building
a full set of known markers (in addition to other transaction
overhead). This quadratic behavior accounted for about 50 seconds of a
70 second no-op pull. After this change, we're down to 20 seconds.

While it would seem simplest to just cache the known set for
obsstore.add, this would also introduce issues of correct cache invalidation.
The extra pointless transaction overhead would also remain.
2015-12-18 13:53:50 -06:00
Danek Duvall
7653e06efa tests: Solaris diff -U also emits "No differences encountered"
This came up before, but the tests in check-code.py don't find -U (only -u)
and they don't work when the diff is inside a shell function.  This fixes
the offending tests and beefs up check-code.py.
2015-12-27 15:24:48 -08:00
Augie Fackler
3fdeab8ee1 test-glog: avoid check-code violation after next patch
Danek's patch will help us avoid spurious test breakages on
Solaris. This test wasn't broken on Solaris because of the grep(1)
use, but it will upset check-code. Use cmp to silence check-code since
it doesn't matter.
2015-12-29 18:11:14 -05:00
Yoshinari Takaoka
009206a571 hgweb: fixed invalid atom-log feed url in file log page
currently "subscribe to atom feed" link in file log page is as follows.

/atom-log/[revision]/[file]

This is invalid, because we could not get newer commit feed than [revision].
To fix this, atom-log feed url should be the following style.

atom-log/tip/[file]
2015-12-29 00:48:03 +09:00
Laurent Charignon
0a74ada9c5 repair: improves documentation of strip regarding locks
This patch adds a comment making it clear that we should hold a lock before
calling repair.strip. The wording is the same than what we have for
obsolete.createmarkers
2015-12-29 10:21:39 -08:00
timeless
b3c6047b46 help: remove stray double spaces from config help 2015-12-29 15:02:13 +00:00
timeless
d8d8593528 help: clarify that the config hook priority prefix includes a period 2015-12-29 15:00:04 +00:00
Anton Shestakov
59eebdc723 monoblue: correct feed links on /branches, /tags and /bookmarks 2015-12-29 01:40:34 +08:00
Anton Shestakov
7137a838ad gitweb: describe feed type in links on /branches, /tags and /bookmarks 2015-12-29 18:17:29 +08:00
Anton Shestakov
b34852a54b gitweb: link to the correct feeds from help pages 2015-12-29 18:16:09 +08:00
timeless
303f2b32c3 histedit: handle exceptions from node.bin in fromrule 2015-12-23 23:51:29 +00:00
timeless
2e291bf611 histedit: limit cleanup of histedit-last-edit.txt to success 2015-12-23 23:23:28 +00:00
timeless
f32fa41604 histedit: use parse-error exception for parsing 2015-12-27 03:33:09 +00:00
timeless
77bfa3d9b2 test-histedit-edit: test histedit with dirty repo 2015-12-11 07:08:36 +00:00
timeless
81170df509 histedit: limit mentioning histedit-last-edit.txt
Before histedit-last-edit.txt would be mentioned for any failure.
After, it should only be mentioned for failures relating to user
input.
2015-12-11 07:08:09 +00:00
timeless
d96f3f0401 histedit: check fold of public change during verify 2015-12-28 22:53:22 +00:00
timeless
9a911bf754 histedit: pass previous action to verify 2015-12-28 22:52:48 +00:00
timeless
08caed46f0 annotate: mention that -n is suppressed in help 2015-12-17 14:56:14 +00:00
Bryan O'Sullivan
41f0aebc57 test-bundle2-format: force gc so a GeneratorExit will be thrown
PyPy has looser semantics than CPython for when a generator's close
method will be called.  Forcing the gc causes it to be called at
the right moment.
2015-12-23 16:22:20 -08:00
Bryan O'Sullivan
d17fc62ed2 test-bad-extension: account for PyPy/CPython error difference 2015-12-23 16:22:20 -08:00
Bryan O'Sullivan
f129ac305b demandimport: update obsolete comment 2015-12-23 16:22:20 -08:00
Bryan O'Sullivan
167ae23759 demandimport: add support for PyPy
PyPy's implementation of __import__ differs subtly from that of CPython.
If invoked without a name or fromlist, it throws an ImportError,
whereas CPython returns a reference to the level-appropriate importing
package.

Here, we achieve the same behaviour by hand.
2015-12-23 16:22:20 -08:00
Bryan O'Sullivan
3002054ec0 test-demandimport: ensure that relative imports are deferred
This adds a test not just at our local "top level" (the mercurial
package), but also one level deeper (mercurial.hgweb).
2015-12-23 16:22:20 -08:00
Bryan O'Sullivan
dd14bb51a5 histedit: don't bother with cPickle, demand-load pickle
We're unlikely to ever need the pickle module, so there's no good
reason to force loading of its faster cousin.
2015-12-23 16:22:20 -08:00
Matt Mackall
798e034a3c merge with stable 2015-12-28 10:11:48 -06:00