Commit Graph

10704 Commits

Author SHA1 Message Date
Pierre-Yves David
b563457396 rebase: do not crash in panic when cwd disapear in the process (issue4121)
Before this patch rebase crashed badly when it happend. (not abort, crash).

Fix courtesy of Matt Mackall.
2014-01-31 15:13:15 -08:00
Angel Ezquerra
83f28887f2 help: improve description of phases.checksubrepos setting
The existing description was a bit hard to understand.
2014-01-29 15:16:36 +01:00
Pierre-Yves David
6265090dee clone: do not turn hidden changeset public on publishing clone (issue3935)
Before this changeset local clone of a repo with hidden changeset would include
then in the clone (why not) and turn them public (plain wrong). This happened
because the copy clone publish by dropping the phaseroot file entirely making
everything in the repo public (and therefore immune to obsolescence marker).

This changeset takes the simplest fix, we deny the copy clone in the case of hidden
changeset falling back to pull clone that will exclude them from the clone and
therefore not turning them public.

A smarter version of copy clone could be done, but I prefer to go for the
simplest solution first.
2014-01-30 11:52:38 -08:00
Julien Cristau
e78105c48a dispatch: take --hidden from individual commands into account
The command server would otherwise ignore that option, since the repo
object is only created once.
2014-01-27 10:57:20 +01:00
FUJIWARA Katsunori
870ab22a06 doc: fix mistake about matching against directories in "pattern.txt"
This fixes mistake of documentation about matching against directories
in "pattern.txt" introduced by b99923dc748f.

".hgignore" treats specified "glob:" pattern as same as one specified
for "-X" option: it can match against directories, too.

For reference, extra regexp string appended to specified pattern for
each types are listed below: see also "match.match()" and
"match._regex()" for detail.

  ============= ========== ===============
  type          cmdline    -I/-X
  ============= ========== ===============
  glob/relglob  '$'        '(?:/|$)'
  path/relpath  '(?:/|$)'  '(?:/|$)'
  re/relre      (none)     (none)
  ============= ========== ===============

Appending '$' means that the specified pattern should match against
only files.
2014-01-30 15:03:36 +09:00
FUJIWARA Katsunori
0b98e91e90 dispatch: make "_checkshellalias()" invoke "findcmd()" with "strict=True"
Before this patch, shell alias may be executed by abbreviated command
name unexpectedly, even if abbreviated command name matches also
against the command provided by extension.

For example, "rebate" shell alias is executed by "hg reba", even if
rebase extension (= "rebase" command) is enabled. In this case, "hg
reba" should be aborted because of command name ambiguity.

This patch makes "_checkshellalias()" invoke "cmdutil.findcmd()"
always with "strict=True" (default value).

If abbreviated command name matches against only one shell alias even
after loading extensions, such shell alias will be executed via
"_parse()".

This patch doesn't remove "_checkshellalias()" invocation itself,
because it may prevent shell alias from loading extensions uselessly.
2014-01-29 23:47:54 +09:00
Angel Ezquerra
9d9e80e852 subrepo: make it possible to update to hidden subrepo revisions
When a subrepo revision was hidden it was considered missing and mercurial was
unable to update to the corresponding parent revision. Instead warn the user of
the problem and let it choose what to do (the default is to udpate anyway).
2013-11-24 02:17:17 +01:00
Angel Ezquerra
c5703b123e subrepo: remove unnecessary else clause in hgsubrepo._get
This revision has no behaviour change. It simply removes an unnecessary else
that follows an if / return block. The change looks big because a big chunk of
code has been unindented one level.
2013-11-24 02:13:00 +01:00
Angel Ezquerra
6a8a8a8e21 subrepo: do not try to get hidden revisions
If a subrepo revision is hidden (because it was amended, for example) it does
not make sense to try to "get" it from the remote subrepository.

Note that in order to avoid making the change look bigger than it is, this adds
an unnecessary else clause. This will be removed on a follow up patch.
2013-11-24 02:10:14 +01:00
David Soria Parra
e5be8c59d8 parsers: fix 'unsigned expression is always true' warning (issue4142)
On Mac OS gcc-llvm throws an -Wtautological-compare warning because flen
is defined as an unsigned integer, therefore flen < 0 is always true.
2014-01-23 19:08:26 +01:00
Pierre-Yves David
4a16e8a21b phase: properly compute ancestors of --rev on push (issue3786)
Now that discovery is working on unfiltered changeset, I had a good occasion to
look at that bug again. This let me realise that a trivial node vs rev
comparision was the cause of this two years old bugs…

Happy second birthday phases!
2013-01-28 15:16:49 +01:00
Simon Heimberg
f9ed3a6ac4 templater: selecting a style with no templates does not crash (issue4140)
Running `hg log --style compact` (or any other style) raised a traceback when
no template directory was there. Now there is a message:

Abort: style 'compact' not found
(available styles: no templates found, try `hg debuginstall` for more info)


There is no test because this would require to rename the template directory.
But this would influence other tests running in parallel. And when the test
would be aborted the wrong named directory would remain, especially a problem
when running with -l.
2014-01-23 01:29:50 +01:00
Matt Mackall
47af0ab954 localrepo: drop dead comment 2014-01-19 22:58:33 -06:00
Pierre-Yves David
0420ab83f5 phases: add a formal note that hash of secret changeset may leak out
For technical reason (discovery, obsolescence marker) the hash of secret
changeset are communicated outside of your repo. We clarifie that in the help so
that people does not used hash of secret changeset as nuclear launch code.
2013-11-17 11:30:17 -05:00
Mads Kiilerich
3ee1a27c56 diff: search beyond ancestor when detecting renames
This removes an optimization that was introduced in 5a644704d5eb but was too
aggressive - as indicated by how it changed test-mq-merge.t .

We are walking filelogs to find copy sources and we can thus not be sure to hit
the base revision and find the renamed file there - it could also be in the
first ancestor of the base ... in the filelog.

We are walking the filelog and can thus not easily know when we hit the first
ancestor of the base revision and which filename to look for there. Instead, we
use _findlimit like mergecopies do: The lower bound for how far we have to go
is found from the lowest changelog revision that is an ancestor of only one of
the compared revisions. Any filelog ancestor with a revision number lower than
that revision will be the ancestor of both compared revisions, and there is
thus no reason to go further back than that.
2013-11-16 15:46:29 -05:00
Durham Goode
8db38e4850 cat: increase perf when catting single files
Special case the single file case in hg cat. This allows us to avoid
parsing the manifest, which shaves 15% off hg cat perf. This is worth
it, since automation often uses hg cat for retrieving single files.
2014-01-14 13:38:16 -08:00
Durham Goode
ffaaebd787 changectx: increase perf of walk function
When running 'hg cat -r . <file>' it was doing an expensive ctx.walk(m) which
applied the regex to every file in the manifest.

This changes changectx.walk to iterate over just the files in the regex, if no
other patterns are specified. This cuts hg cat time by 50% in our repo and
probably benefits a few other commands as well.
2014-01-14 13:49:19 -08:00
Lucas Moscovicz
178ffcb15d url: added authuri when login information is requested (issue3209)
When users are using a revset they can get multiple password prompts.
This prompts have no extra information about which password is being requested
so I added the authuri to the prompt to make it recognizable.

As in:
$ hg log -r "outgoing('https://bitbucket.org/mg/test') -
outgoing('https://bitbucket.org/nesneros/test')"
http authorization required
realm: Bitbucket.org HTTP
user: interrupted!

I changed it to describe the url when prompting for password.
As in:
$ hg log -r "outgoing('https://bitbucket.org/mg/test') -
outgoing('https://bitbucket.org/nesneros/test')"
http authorization required for https://bitbucket.org/mg/test
realm: Bitbucket.org HTTP
user: interrupted!
2014-01-15 16:46:20 -08:00
FUJIWARA Katsunori
f7f94c0f06 doc: add description about pattern matching against directories
Before this patch, there is no explicit description about pattern
matching against directories, even though users may understand it from
"plain examples" in "hg help patterns".

This patch adds description about pattern matching against
directories.
2014-01-17 23:55:11 +09:00
FUJIWARA Katsunori
9baf47cf1a revset: add explanation about the pattern without explicit kind
Before this patch, online help of "adds()", "contains()", "filelog()",
"file()", "modifies()" and "removes()" predicates doesn't explain
about how the pattern without explicit kind like "glob:" is treated,
even though each predicates treat it differently:

  - as "relpath:" by "adds()", "modifies()" and "removes()"

  - as "glob:" by "file()"

  - as special by "contains()" and "filelog()"
    - be relative to cwd, and
    - match against a file exactly
      ("relpath:" matches also against a directory)

This may confuse users.

This patch adds explanation about the pattern without explicit kind
to these predicates.
2014-01-17 23:55:11 +09:00
FUJIWARA Katsunori
92ff577d38 revset: use "canonpath()" for "filelog()" pattern without explicit kind
Before this patch, revset predicate "filelog()" uses "match.files()"
to get filename also for the pattern without explicit kind.

But in such case, only canonicalization of relative path is required,
and other initializations of "match" object including regexp
compilation are meaningless.

This patch uses "pathutil.canonpath()" directly for "filelog()"
pattern without explicit kind like "glob:", for efficiency.

This patch also does below as a part of introducing "canonpath()":

  - move location of "matchmod.match()" invocation, because "m" is no
    more used in "if not matchmod.patkind(pat)" code path

  - omit passing "default" argument to "matchmod.match()", because
    "pat" should have explicit kind of pattern in this code path
2014-01-17 23:55:03 +09:00
FUJIWARA Katsunori
4d5d9b1517 revset: avoid loop for "match.files()" having always one element for efficiency
This patch avoids the loop for "match.files()" having always one
element in revset predicate "filelog()" for efficiency: "match" object
"m" is constructed with "[pat]" as "patterns" argument.
2014-01-17 23:42:12 +09:00
FUJIWARA Katsunori
7e4fbdb87b revset: make default kind of pattern for "contains()" rooted at cwd
Before this patch, default kind of pattern for revset predicate
"contains()" is treated as the exact file path rooted at the root of
the repository. This decreases usability, because:

  - all other predicates taking pattern argument (also "filelog()")
    treat such pattern as the path rooted at the current working
    directory

  - "contains()" doesn't describe this difference in its help

  - this difference may confuse users

    for example, this prevents revset aliases from sharing same
    argument between "contains()" and other predicates


This patch makes default kind of pattern for revset predicate
"contains()" be rooted at the current working directory.

This patch uses "pathutil.canonpath()" instead of creating "match"
object for efficiency.
2014-01-17 23:42:12 +09:00
FUJIWARA Katsunori
43338be810 revset: narrow scope of the variable referred only in specific code path
This patch narrows scope of the variable "m" in the function for
revset predicate "contains()", because it is referred only in "else"
code path of "if not matchmod.patkind(pat)" examination.
2014-01-17 23:42:12 +09:00
Sean Farley
673b0dd879 commands: use bookmarks.validdest instead of duplicating logic
Now that bookmarks.py has grown a validdest method that even handles successor
changesets, we use that instead of duplicating the logic in commands.py
2014-01-15 17:55:13 -06:00
Sean Farley
8973f827ab update: consider successor changesets when moving active bookmark
Previously, when an obsolete changeset was bookmarked, successor changesets were not considered
when moving the bookmark forward. Now that a bare update will move to the tip most of the
successor changesets, we also update the bookmark logic to allow the bookmark to move with this
update.

Tests have been updated and keep issue4015 covered as well.
2014-01-15 17:48:48 -06:00
Sean Farley
eb5399916a merge: consider successor changesets for a bare update
Previously, a bare update would ignore any successor changesets thus
potentially leaving you on an obsolete head. This happens commonly when there
is an old bookmark that hasn't been moved forward which is the motivating
reason for this patch series.

Now, we will check for successor changesets if two conditions hold: 1) we are
doing a bare update 2) *and* we are currently on an obsolete head.

If we are in this situation, then we calculate the branchtip of the successor
set and update to that changeset.

Tests coverage has been added.
2014-01-15 16:41:18 -06:00
Sean Farley
17f6cfcd6f merge: refactor initialization of variables in update
There is no code change here but this helps prepare for future commits that
will fix a bare update with obsolete markers.
2013-11-06 17:02:07 -06:00
Sean Farley
26332808a6 merge: update comment for future devs 2013-11-06 10:26:25 -06:00
Sean Farley
ef93a468a7 obsolete: clarify documentation for succcessorssets 2014-01-15 18:14:12 -06:00
Pierre-Yves David
605b367f84 backout: add a message after backout that need manual commit
In some case Backout silently succeeded to back out but left all the change
uncommitted. This may be confusing for user so this changeset  add a note
reminding to commit. Other backout case already actively informs the user about
created commit.
2014-01-08 17:23:26 -08:00
Pierre-Yves David
75c6a1c8fa backout: avoid update on simple case.
Before the changeset the backout process was:
1) go to <target>
2) revert to <target> parent
3) update back to changeset we came from

The two update steps can takes a very long time to move back and forth unrelated
file change between <target> and current working directory.

The new process is just merging current working directory with the parent of
<target> using <target> as ancestor. This give the very same result but skip
the two updates. On big repo with a lot of files and changes that save a lots of
time (x20 for one week window).

The "merge" version (hg backout --merge) is still done with upgrades. We could
imagine using in memory commit to speed it up but this is another fish.
2014-01-08 14:53:46 -08:00
FUJIWARA Katsunori
1629d4ee7f ui: add "extractchoices()" to share the logic to extract choices from prompt 2013-12-02 00:50:29 +09:00
Pierre-Yves David
f0e0234ea1 branchmap: use set for update code
We are doing membership test and substraction. new code is marginally faster.
2014-01-06 15:19:31 -08:00
Pierre-Yves David
fc97641ca7 branchmap: simplify update code
We drop iterrevs which are not needed anymore. The know head are never a
descendant of the updated set. It was possible with the old strip code. This
simplification make the code easier to read an update.
2014-01-06 14:26:49 -08:00
Pierre-Yves David
7641136888 branchmap: stop useless rev -> node -> rev round trip
We never use the node of new revisions unless in the very specific case of
closed heads. So we can just use the revision number.

So give another handfull of percent speedup.
2014-01-03 16:44:23 -08:00
Pierre-Yves David
4a3c0bd301 branchmap: stop membership test in update logic
Now that no user try to update the cache on a truncated repo we can drop the
extra lookup. Give an handfull percent speedup on big branchmap update.
2013-01-15 20:04:12 +01:00
Pierre-Yves David
f4aa184d64 branchmap: remove silly line break
The line fit in 80 character limit without it. It is even shorter without it.
2014-01-03 17:06:07 -08:00
Takumi IINO
22fc622e5e hgweb: infinite scroll support for coal style 2014-01-08 00:47:45 +09:00
Takumi IINO
95ecbefdae hgweb: infinite scroll support for monoblue style 2014-01-08 00:47:44 +09:00
Takumi IINO
e51fef56f2 hgweb: infinite scroll support for gitweb style 2014-01-08 00:47:43 +09:00
Takumi IINO
db72b3b5e8 hgweb: avoid invalid infinity scroll request when overwritten web.style
Infinity scroll is broken when you override the web.style in the following ways:

    $ hg --config='web.style=gitweb' serve
    $ open http://localhost:8080/shortlog?style=paper

ajaxScrollInit should use http://localhost:8080/shortlog/%next%?style=paper.
however, http://localhost:8080/shortlog/%next% is used actually.
It is missing style parameter.

This patch add style parameter to request url.
2014-01-08 00:35:03 +09:00
Takumi IINO
96e1c44734 hgweb: fix regexp for other styles like monoblue
Some styles have indentation.
2014-01-08 00:26:55 +09:00
Mads Kiilerich
1428b73c06 help: branch names primarily denote the tipmost unclosed branch head
Was the behavior correct and the description wrong so it should be updated as
in this patch? Or should the code work as the documentation says?

Both ways could make some sense ... but none of them are obvious in all cases.

One place where it currently cause problems is when the current revision has
another branch head that is closer to tip but closed. 'hg rebase' refuses to
rebase to that as it only see the tip-most unclosed branch head which is the
current revision.

/me kind of likes named branches, but no so much how branch closing works ...
2013-11-21 15:17:18 -05:00
Mads Kiilerich
771c21f193 util: introduce util.debugstacktrace for showing a stack trace without crashing
This is often very handy when hacking/debugging.

Calling util.debugstacktrace('hey') from a place in hg will give something like:
  hey at:
   ./hg:38                                     in <module>
   /home/user/hgsrc/mercurial/dispatch.py:28   in run
   /home/user/hgsrc/mercurial/dispatch.py:65   in dispatch
   /home/user/hgsrc/mercurial/dispatch.py:88   in _runcatch
   /home/user/hgsrc/mercurial/dispatch.py:740  in _dispatch
   /home/user/hgsrc/mercurial/dispatch.py:514  in runcommand
   /home/user/hgsrc/mercurial/dispatch.py:830  in _runcommand
   /home/user/hgsrc/mercurial/dispatch.py:801  in checkargs
   /home/user/hgsrc/mercurial/dispatch.py:737  in <lambda>
   /home/user/hgsrc/mercurial/util.py:472      in check
...
2014-01-12 23:28:21 +01:00
Mads Kiilerich
9f5571e9f8 bisect: --command without --noupdate should flag the parent rev it tested
b33db384a66e not only introduced the 'bisect(current)' revset predicate, it
also changed how the 'current' revision is used in combination with --command.
The new behaviour might be ok for --noupdate where the working directory and
its revision shouldn't be used, but it also did that when --command is used to
run a command on the currently checked out revision then it could register the
test result on the wrong revision.

An example:

Before, bisect with --command could use the wrong revision when recording the
test result:

  $ hg up -qr 0
  $ hg bisect --command "python \"$TESTTMP/script.py\" and some parameters"
  changeset 31:58c80a7c8a40: bad
  abort: inconsistent state, 31:58c80a7c8a40 is good and bad

Now it works as before and as expected and uses the working directory revision
for the --command result:

  $ hg up -qr 0
  $ hg bisect --command "python \"$TESTTMP/script.py\" and some parameters"
  changeset 0:b99c7b9c8e11: bad
  ...
2013-11-16 15:46:29 -05:00
Mads Kiilerich
48b69add79 context: drop caching 'copies' method
The 'copies' method has no test coverage and calls copies.pathcopies with an
incorrect number of parameters and is thus (fortunately) not used. Kill it.
2013-11-16 15:46:29 -05:00
Siddharth Agarwal
c88be819e2 commands.bookmarks: move hexfn to inside list block
This isn't used outside this block, nor is it expected to be.
2013-11-19 12:43:29 -08:00
Siddharth Agarwal
cc6a9ec3f3 commands.bookmarks: move cur initialization to inside wlock
This is more correct because we now fetch '.' while nothing else can interfere
with it.
2013-11-19 12:42:17 -08:00
Siddharth Agarwal
6504db9dff commands.bookmarks: pass cur in explicitly to checkconflict
cur will be moved inside the wlock in a future patch, so we need to pass it
into checkconflict explicitly.
2013-11-21 17:11:04 -08:00