Commit Graph

2766 Commits

Author SHA1 Message Date
Mads Kiilerich
8a80de42d5 resolve: keep wlock while resolving
This will make resolve use correct locking and thus make it more safe.

Resolve is usually a long running command spending a lot of time waiting for
user input on hard problems. It is thus a real world scenario to start multiple
resolves at once or run other commands (such as up -C and merge) while resolve
is running. Proper locking prevents that.
2014-05-26 19:02:11 +02:00
Matt Mackall
10039fb244 bookmarks: properly align multi-byte characters 2014-05-27 15:16:52 -07:00
Pierre-Yves David
7bcfb6a103 graft: do not use .remove on a smart set (regression)
Revset calls use to return a list. Graft use to mutate that list. We cannot do
this anymore leading to a crash when grafting multiple changeset with a revset.

    File ".../mercurial/commands.py", line 3117, in graft
      revs.remove(rev)
    AttributeError: '_addset' object has no attribute 'remove'

We are late in code-freeze so we make the shortest possible fix by turning it
back to a list.
2014-04-28 17:25:36 -07:00
Wagner Bruna
359de9734a commands: fix typo in --graph description 2014-04-22 10:12:21 -03:00
Lucas Moscovicz
2794920df6 log: changed implementation to use graphlog code
Now that revsets work in a lazy way, log code can be changed to parse every
option into a revset and then evaluate it lazily.

Now expressions like

  "hg log -b default -b ."

are converted into a revset using the same code as graphlog.
2014-02-28 15:10:56 -08:00
Mads Kiilerich
d2c13e7d3c backout: use commonancestorsheads for checking linear heritage
If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.
2014-04-17 20:01:39 +02:00
Sean Farley
1002b6c612 memfilectx: call super.__init__ instead of duplicating code
This patch changes the calling signature of memfilectx's __init__ to fall in
line with the other file contexts.

Calling code and tests have been updated accordingly.
2013-08-15 16:49:27 -05:00
Matt Mackall
95a0ecfb91 merge with stable 2014-05-27 17:41:20 -07:00
Pierre-Yves David
b7c330c46d import: add --partial flag to create a changeset despite failed hunks
The `hg import` command gains a `--partial` flag. When specified, a commit will
always be created from a patch import. Any hunk that fails to apply will
create .rej file, same as what `hg qimport` would do. This change is mainly
aimed at preserving changeset metadata when applying a patch, something very
important for reviewers.

In case of failure with `--partial`, `hg import` returns 1 and the following
message is displayed:

    patch applied partially
    (fix the .rej files and run `hg commit --amend`)

When multiple patches are imported, we stop at the first one with failed hunks.

In the future, someone may feel brave enough to tackle a --continue flag to
import.
2014-05-08 17:08:17 -07:00
Mads Kiilerich
8244be3a60 update: introduce --tool for controlling the merge tool
Update is a kind of merge and may also need a merge tool and should have the
options described in the merge-tools help.
2014-05-19 01:53:34 +02:00
Siddharth Agarwal
265738b91b resolve: don't abort resolve -l even when no merge is in progress
This broke some internal automation that was quite reasonably checking for
unresolved files as a way to determine whether a merge happened cleanly. We
still abort for resolve --mark etc.
2014-05-23 13:10:31 -07:00
Durham Goode
653de51193 graft: customize graft conflict markers (BC)
Changes the graft conflict markers to be 'graft' and 'local' to make it
more intuitive which side is which.
2014-05-09 18:15:02 -07:00
Matt Harbison
479cfafe7a cat: explicitly document the supported formatter rules
The previous documentation pointed to the export command, but even if the user
recognized that instead of only reading the cat specific list of rules, not all
of the export rules applied anyway (specifically %N, %n and %m).  The new items
are a copy/paste from export's list.  These rules have existed since at least
version 0.5.

Note that %m gets substituted with 'None' because the commit message isn't
passed to cmdutil.makefilename().  %R and %r are currently effectively the same,
since no revwidth is passed, however they both work.

There aren't any existing tests for these rules, so they are added to prevent
future regression.
2014-04-15 23:29:19 -04:00
Pierre-Yves David
c9703fe999 bundle2: add a ui argument to readbundle
The bundle2 unbundler needs a ui argument. We are now passing this information
to `readbundle`.
2014-04-14 15:45:30 -04:00
Pierre-Yves David
009e9f6c33 bundle2: move readbundle into the exchange module
The `readbundle` function is going to understand the bundle2 header. We move the
function to a more suitable place before making any other changes.
2014-04-14 15:33:50 -04:00
FUJIWARA Katsunori
63865524f1 outgoing: introduce "outgoinghooks" to avoid redundant outgoing check
This patch introduces "outgoinghooks" to avoid redundant outgoing
check for "hg outgoing" in other than "commands.outgoing" (or utility
functions used by it).
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
f962e484fd hg: make "_outgoing()" return peer object for remote repository
This patch makes "_outgoing()" return peer object for remote
repository, to avoid re-execution "expandpath()", "parseurl()", and
"peer()" on caller side for specified URL.
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
7c3a219e15 hg: make "_outgoing()" return empty list instead of "None"
This patch makes "_outgoing()" return empty list instead of "None", if
there are no outgoing changesets, because:

  - returning "None" requires callers to examine whether returned
    value is "None" or not explicitly, if callers want to execute loop
    on returned value, but

  - there are no explicit needs to return "None"
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
090a597dc7 summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
This patch introduces "summaryremotehooks" to avoid redundant
incoming/outgoing check for "hg summary" in other than
"commands.summary".

Only if "--remote" is not specified for "hg summary", hooks registered
in "summaryremotehooks" are invoked with "None" as "changes" argument
at first, and they should return tuple of two booleans meaning
"whether incomings are needed" and "whether outgoings are needed".

If no hooks return tuple containing "True", "hg summary" does nothing
any more, because incoming/outgoing check is not needed.

Otherwise, hooks are invoked again: at this time, "changes" argument
refers the result of incoming/outgoing check.

This patch also prevents RepoError from being raised if "--remote" is
not specified for "hg summary", because of backward compatibility for
"hg summary --large" without "--remote".
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
16b89197f7 summary: separate checking incoming/outgoing and showing remote summary
This patch separates checking incoming/outgoing and showing remote
summary, as a preparation for refactoring in succeeding patches,
because:

  - checking incoming/outgoing may be needed, even if "--remote" is
    not specified for "hg summary"

  - checking incoming/outgoing may not be needed simultaneously

"hg summary --large" without "--remote" is typical case for these.
2014-04-16 00:37:24 +09:00
Matt Harbison
615b124547 cat: support cat with explicit paths in subrepos
The cat command with an explicit path into a subrepo is now handled by invoking
cat on the file, from that subrepo.  The previous behavior was to complain that
the file didn't exist in the revision (of the top most repo).  Now when the file
is actually missing, the revision of the subrepo is named instead (though it is
probably desirable to continue naming the top level repo).

The documented output formatters %d and %p reflect the path from the top level
repo, since the purpose of this is to give the illusion of a unified repository.
Support for the undocumented (for cat) formatters %H, %R, %h, %m and %r was
added long ago (I tested back as far as 0.5), but unfortunately these will
reflect the subrepo node instead of the parent context.

The previous implementation was a bit loose with the return value, i.e. it would
return 0 if _any_ file requested was cat'd successfully.  This maintains that
behavior.
2014-03-14 21:32:05 -04:00
Matt Harbison
cb793b21fa cat: move most of the implementation into cmdutils.cat()
This will allow access to the reusable parts from subrepos, similar to add(),
forget(), etc.
2014-03-13 23:45:18 -04:00
FUJIWARA Katsunori
6737a23301 amend: invoke editor forcibly when "--edit" option is specified
1fc59036a99b introduces "--edit" option into "hg commit", but it
doesn't work for "hg commit --amend", because 1fc59036a99b prepares
for editor invocation only around "commitfunc()" internal function,
which is used only for temporary amend commit by "cmdutil.amend()".

Actual commit message editing is executed in "cmdutil.amend()".

This patch invokes editor forcibly when "--edit" option is specified
for "hg commit --amend", even if commit message is specified
explicitly by "--message" or "--logfile".

This patch also removes useless handling for commit message and editor
invocation around "commitfunc()" internal function.
2014-04-16 02:38:11 +09:00
FUJIWARA Katsunori
c448280b69 commit: abolish useless "--force-editor" internal option for "hg commit"
"--force-editor" option for "hg commit" has been useless since
074e6345f65e, which makes "commands.tag()" invoke "cmdutil.commit()"
directly instead of "commands.commit()" with "--force-editor" internal
option.

This patch abolishes useless "--force-editor" internal option for "hg
commit".
2014-04-16 02:04:41 +09:00
Matt Mackall
404e995f87 subrepo: return non-zero exit code when a subrepo push doesn't succeed 2014-04-15 14:15:35 -04:00
Mads Kiilerich
dde33b4102 debugrevlog: format columns (more) nicely when dumping index data 2014-03-19 00:13:38 +01:00
Bradley M. Kuhn
4cd8c219ba commit: --edit/-e to force edit of otherwise-supplied commit message
The --edit/-e option for the 'commit' command forces editor, even when a
commit message has been provided already by other means, such as by the -m or
-l options.
2013-09-08 19:02:08 -04:00
Takumi IINO
108a15e83e grep: highlight all matched words
"hg grep" highlights first matched word only.
This behavior is different from GNU grep.

This patch makes highlight all matched words.
2014-03-31 01:00:05 +09:00
Mads Kiilerich
723c536d44 backout: don't limit heritage check to a single ancestor
This do probably not make any real difference but is slightly more correct and
we would like to get rid of changelog.ancestor.
2014-04-07 23:17:51 +02:00
Pierre-Yves David
6b9778c026 localrepo: move the addchangegroup method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had few callers, not enough to be kept in local repo.
2014-04-01 15:27:53 -07:00
Pierre-Yves David
30f24fdb7a localrepo: move the getbundle method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had few callers, not enough to be kept in local repo.

The peer API remains unchanged.
2014-04-01 14:40:35 -07:00
Pierre-Yves David
47880ff5c9 localrepo: move the getlocalbundle method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.

The method had 3 callers total, far too few for being kept in local repo.
2014-04-01 14:33:23 -07:00
Matt Mackall
1e3dcd8d35 merge with stable 2014-04-01 17:59:06 -05:00
Matt Mackall
c9eb4517fa merge with stable 2014-04-01 15:11:19 -05:00
FUJIWARA Katsunori
01d8b27701 i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.
2014-04-01 02:46:03 +09:00
Yuya Nishihara
370defd044 backout: correct commit status of no changes made (BC) (issue4190)
If backout generated no changes to commit, it showed wrong status, "changeset
<target> backs out changeset <target>", and raised TypeError with -v option.

This changes the return code to 1, which is the same as "hg commit" and
"hg rebase".
2014-03-08 18:52:16 +09:00
Yuya Nishihara
d616c909d1 backout: document return code of merge conflict 2014-03-08 18:41:56 +09:00
Jordi Gutiérrez Hermoso
19098ea63d commit: propagate --secret option to subrepos (issue4182)
Before this patch, `hg commit --secret` was not getting propagated
correctly, and subrepos were not getting the commit in the secret
phase. The problem is that subrepos get their ui from the base repo's
baseui object and ignore the ui object passed on to them. This sets
and restores both ui objects with the appropriate option.
2014-03-17 14:57:13 -04:00
FUJIWARA Katsunori
3acb83dcfb tag: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg tag -e"
isn't saved into ".hg/last-message.txt" until it is saved by
"localrepository.savecommitmessage()" in "localrepository.commit()".

This may lose such commit message, if unexpected exception is raised.

This patch saves manually edited commit message for "hg tag -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m option (-l is not supported for "hg
tag") as same as other commands.

This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
70f9f39f84 commit: create new amend changeset as secret correctly for "--secret" option
Before this patch, "hg commit --amend --secret" doesn't create new
amend changeset as secret, even though the internal function
"commitfunc()" passed to "cmdutil.amend()" make "phases.new-commit"
configuration as "secret" temporarily.

"cmdutil.amend()" uses specified "commitfunc" only for temporary amend
commit, and creates the final amend commit changeset by
"localrepository.commitctx()" directly with memctx.

This patch creates new amend changeset as secret correctly for
"--secret" option, by changing "phases.new-commit" configuration
temporarily before "localrepository.commitctx()".
2014-03-13 19:48:41 +09:00
Yuya Nishihara
6edf7b4a6a phase: say "Returns 0" instead of "Return 0" like other command help 2014-03-03 15:50:45 +09:00
Pierre-Yves David
3eab08d896 resolve: use "other" changeset from merge state (issue4163)
We can use the "other" data from the recorded merge state instead of inferring
what the other could be from working copy parent. This will allow resolve to
fulfil its duty even when the second parent have been dropped.

Most direct benefit is fixing a regression in backout.
2014-02-25 18:45:01 -08:00
Piotr Klecha
0968676adc pull: close peer repo on completion (issue2491) (issue2797)
When pulling changes from a compressed bundle Mercurial first uncompresses it
to a temporary file in .hg directory. This file will not be deleted unless
the bundlerepo (other) is explicitly closed.

This is similar to cleanup that occurs after incoming.
2014-02-25 21:26:25 +01:00
FUJIWARA Katsunori
2add9630f2 grep: exit loop immediately, if matching is found in the file for "hg grep -l"
Before this patch, internal function "display()" of "hg grep" is not
efficient for "-l"/"--files-with-matches", because loop is continued,
even after the first matching is found in the specified file.

This patch exits loop immediately, if matching is found for
"--files-with-matches".

In this case, "before is None" is equal to "opts.get('files_with_matches')".
2014-02-15 19:54:14 +09:00
FUJIWARA Katsunori
e9f33efda3 grep: use "found" instead of "filerevmatches" examination for efficiency
Before this patch, internal function "display()" of "hg grep" stores
whether matching is already found or not into the dictionary
"filerevmatches" by "(fn, rev)" tuple as the key.

But this is redundant, because:

  - "filerevmatches" is local variable of "display()", so each
    "display()" invocations don't affect others

  - both "fn" and "rev" (gotten from "ctx" argument) are never changed
    in each "display()" invocations

Then, "filerevmatches" should have only one entry at most, and "(fn,
rev) in filerevmatches" should be equal to "found".

This patch uses "found" instead of "filerevmatches" examination for
efficiency.
2014-02-15 19:54:05 +09:00
FUJIWARA Katsunori
b011fa5100 grep: reuse the first "util.binary()" result for efficiency
Before this patch, to check whether the file in the specified revision
is binary or not, "util.binary()" is invoked via internal function
"binary()" of "hg grep" once per a line of "hg grep" output, even
though binary-ness is not changed in the same file.

This patch reuses the first "util.binary()" invocation result by
annotating internal function "binary()" with "@util.cachefunc".

Performance improvement measured by "hgperf grep -r 5e9e7af9ae01 vfs
mercurial/scmutil.py":

  before this patch:
    ! wall 0.024000 comb 0.015600 user 0.015600 sys 0.000000 (best of 118)

  after this patch:
    ! wall 0.023000 comb 0.015600 user 0.015600 sys 0.000000 (best of 123)

Status of recent(5e9e7af9ae01) "mercurial/scmutil.py":

  # of lines:     919 (may affect cost of search)
  # of bytes:   29633 (may affect cost of "util.binary()")
  # of matches:    22 (may affect frequency of "util.binary()")
2014-02-15 19:52:36 +09:00
Matt Mackall
cc86d3f245 help: add examples to incoming 2014-03-26 12:52:57 -05:00
Mads Kiilerich
eb672bcfce backout: improve confusing 'cannot backout change on a different branch' abort
These days 'branch' usually refer to a named branch.

Instead, abort with 'cannot backout change that not is an ancestor'.
2014-02-24 22:42:14 +01:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Matt Mackall
2b7a5581ef config: mention edit options and config topic in help 2014-03-18 18:57:19 -05:00
Matt Mackall
55a0f78973 config: add --global and --local flags
These start an editor on the system-wide or repository-level config files.
2014-03-18 18:49:30 -05:00
Matt Mackall
ea6ffc9a80 merge with stable 2014-03-18 14:25:28 -05:00
Matt Mackall
521c4ac54d debuginstall: change showing to checking for consistency and future checking 2014-03-14 16:00:11 -05:00
Chris Jerdonek
53c61a10f1 debuginstall: add Python information to debuginstall output (issue4128)
This change adds to the output of "hg debuginstall" information about the
Python being used by Mercurial.  It adds both the path to the Python
executable (i.e. the value of sys.executable) and the version of Python
(specifically the major, minor, and micro versions).

Below is an example of what the output looks like after this change.
The marked lines are the new output lines:

    $ hg debuginstall
    checking encoding (UTF-8)...
 -->showing Python executable (/Users/chris/.virtualenvs/default/bin/python)
 -->showing Python version (2.7.6)
    checking Python lib (/Users/chris/.virtualenvs/default/lib/python2.7)...
    checking installed modules (/Users/chris/mercurial)...
    checking templates (/Users/chris/mercurial/templates)...
    checking commit editor...
    checking username...
    no problems detected

Note that we use the word "showing" without an ellipsis for the new lines
because, unlike the other lines (except for "Python lib" which will be
adjusted in a subsequent commit), no check follows the display of this
information.
2013-12-31 00:37:16 -08:00
Matt Mackall
b93e6d4112 merge with stable 2014-03-13 12:05:08 -05:00
Matt Mackall
780917a5b2 templater: deprecate --style now that -T exists 2014-03-10 15:00:41 -05:00
Matt Mackall
a759f7ceae commands: add -T alternative to --template 2014-03-08 15:27:25 -06:00
Jordi Gutiérrez Hermoso
9884504502 config: clarify and exemplify the user name in the sample config file 2014-03-07 14:29:26 -05:00
Matt Mackall
292da19027 status: improve explanation of ' ' status
a) it shows for states other than 'A'
b) it only shows with --copies
2014-03-06 17:26:49 -06:00
Yuya Nishihara
b6eb1297a9 cmdserver: allow to start server without repository
Typical use case is to clone repository through command server.  Clone may
require user interaction, so command-server protocol is beneficial over
raw stdio channels.
2014-03-03 23:21:24 +09:00
Matt Mackall
c9e6159ca7 merge with stable 2014-03-03 15:34:09 -06:00
Matt Mackall
53c79c65e4 config: make repo optional again 2014-02-27 23:17:37 -06:00
Matt Mackall
59e35ecc4f merge with stable 2014-02-27 18:57:03 -06:00
Matt Mackall
9fadaa2173 merge with stable 2014-02-27 14:48:36 -06:00
Matt Mackall
d8695c608c config: add example config file when -e called with no config 2014-02-27 14:01:52 -06:00
Matt Mackall
6b078f60b5 config: add initial implementation of --edit
This launches the preferred editor on either:

a) the first non-empty user rc file found
b) the first user rc file in the search list
2014-02-27 13:46:32 -06:00
Matt Mackall
ae628826e6 config: move showconfig code and add config as primary alias
Preparation for adding config --edit to launch an editor
2014-02-27 12:42:09 -06:00
anuraggoel
aaf6714e39 push: provide a hint when no paths in configured (issue3692)
When user type "hg push" command then this patch helps user by
providing hint if no default path is configured.

Second patch is the test coverage, to test the change behaviour of
first patch.
2014-02-25 04:11:11 +05:30
Mads Kiilerich
670469e4bf log: describe graph symbols in the help
I wondered what 'x' meant and didn't find it described anywhere.
2014-02-12 23:44:30 +01: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
Pierre-Yves David
aa3270ed1f import: move tryone closure in cmdutil
We extract the `tryone` function into the `cmdutil` module. A lot of the command
context have to be passed to the utility function, but having and explicit
declaration will allow extension to wrap it. This will allows use to make
changeset evolution related experiment in dedicated extension.

Improving the API of this function is noble goal but outside of the scope of
this patches.
2014-02-11 16:52:36 -08:00
Siddharth Agarwal
bf7fddd84c commands.debugrevspec: add an option to print the optimized expression tree
This will be used in an upcoming patch to test that the optimizer works.
2014-02-13 13:52:45 -08:00
Pierre-Yves David
e54cd58994 debugobsolete: extract marker display in a dedicated function
We want to be able to reuse and extend it from other function or
extension while working on markers exchange.

This changeset is pure core movement.
2014-02-11 16:30:23 -08:00
Augie Fackler
888bc814fa commands: use ctx.getfileset instead of fileset.getfileset 2014-02-04 14:55:04 -05:00
Simon Heimberg
d11bb41a51 commands: hg debuginstall checks missing templates (issue4151)
Missing templates where not reported as a problem, only an empty bracket
were shown as indication of no found template directory:
  $ hg debuginstall
  *...some lines*
  checking templates ()...
  *...some lines*
  no problems detected

Now the problem is reported and extended with some information. The style
of the messages is adapted to the other messages of debuginstall.

When no templates directories exist, it writes:
  $ hg debuginstall
  *...some lines*
  checking templates ()...
   no template directories found
   (templates seem to have been installed incorrectly)
  *...some lines*
  1 problems detected, please check your install!

When the template map is not found, it writes:
  $ hg debuginstall
  *...some lines*
  checking templates (/path/to/mercurial/templates)...
   template 'default' not found
   (templates seem to have been installed incorrectly)
  *...some lines*
  1 problems detected, please check your install!

When the template map is buggy the message is the same as before. The error
message is shown before the line "(templates seem ...)".


No test is added because testing this failure is complicated. It would
require to modify the templates directory of the mercurial installation,
or to monkey patch a function (os.listdir or any from mercurial.templater)
by a test extension.
2014-01-27 11:17:07 +01:00
Stephen Lee
767b0ab60c update: show message when a bookmark is activated by update
When updating to a bookmark, mention that the bookmark is now
active.  This is a reminder that update does not move the
current bookmark if an explicit target is given - instead
it activates that target.
2013-03-07 14:17:56 +11:00
FUJIWARA Katsunori
4b34ba6872 tag: use the editor gotten by "getcommiteditor()" instead of "ui.edit()"
This patch also enhances "test-tag.t", because "hg tag" hasn't been
explicitly tested around editor invocation and "--edit" option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
67f9c7382a graft: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-graft.t", because "hg graft" hasn't
been explicitly tested around editor invocation and "--edit" option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
1c03d6273c commit: use "getcommiteditor()" instead of explicit editor choice
This patch also eliminates "forceeditor" no more referred.

This patch doesn't change any tests like as preceding patches, because
editor invocation is already tested well.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
0aeb4a2423 backout: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-backout.t", because "hg backout" hasn't
been explicitly tested around editor invocation and '--edit' option.
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
b7375a70de backout: avoid redundant message examination
Before this patch, "hg backout" examines "--message" and "--logfile"
options explicitly.

But this examination is redundant, because "commitfunc()" can receive
the result of same examination by "cmdutil.logmessage()" in
"cmdutil.commit()" through "message" argument.

This patch avoids redundant message examination by "message"
examination in "commitfunc()".
2014-05-11 00:49:35 +09:00
Siddharth Agarwal
1dfb639cc9 update: when deactivating a bookmark, print a message
This helps prevent user confusion when innocent-seeming commands like
'hg update -C .' are run.
2014-05-14 12:49:55 -07: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
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
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
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
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
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
Siddharth Agarwal
ee30e748c9 commands.bookmarks: hold wlock for write operations
Any invocations of bookmarks other than a plain 'hg bookmarks' will likely
cause a write to the bookmark store. These should be guarded by the wlock.

The repo._bookmarks read should be similarly guarded by the wlock if we're
going to be subsequently writing to it.
2013-11-19 12:33:14 -08:00
Siddharth Agarwal
e1850e1d79 commands.bookmarks: separate out 'no bookmarks set' status messages
Upcoming patches will acquire the wlock for write operations, such as make
inactive, but not read-only ones, such as list bookmarks. Separate out the
status messages so that the code paths can be separated.
2013-11-19 11:47:30 -08:00
Kevin Bullock
6a83843bd3 doc: bump copyright year 2014-01-10 16:26:11 -06:00
Brodie Rao
899e66fafb branches: simplify with repo.branchmap().iterbranches()
Running hg branches on the PyPy repo (with 996) over a busy NFS server,
before this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        1069            0      1.2955      1.2955   <open>
        1063            0      0.5576      0.5576   <method 'close' of 'file' objects>
        4122            0      0.1993      0.0449   mercurial.repoview:161(changelog)
        8240            0      0.0771      0.0299       mercurial.changelog:133(tip)
        4122            0      0.0422      0.0204       mercurial.localrepo:26(__get__)
        8240            0      0.0252      0.0131       <len>
        4122            0      0.0060      0.0037       mercurial.repoview:112(filterrevs)
        8240            0      0.0028      0.0028       <hash>
        3029            0      0.2139      0.0390   mercurial.context:202(__init__)
        3029            0      0.1402      0.0339       mercurial.repoview:161(changelog)
        3029            0      0.0240      0.0087       mercurial.changelog:183(rev)
        9087            0      0.0067      0.0067       <isinstance>
        1096            0      0.0025      0.0025       <binascii.unhexlify>
        4125            0      0.0015      0.0015       <len>
        4229            0      0.0344      0.0344   mercurial.revlog:296(rev)
        1061            0      0.0343      0.0343   <method 'seek' of 'file' objects>
        1063            0      0.0339      0.0339   <method 'read' of 'file' objects>
       40476        16488      0.0479      0.0311   <len>
       16488            0      0.0216      0.0168       mercurial.revlog:262(__len__)
        8240            0      0.0771      0.0299   mercurial.changelog:133(tip)
        8240            0      0.0281      0.0203       mercurial.changelog:190(node)
        8240            0      0.0191      0.0095       <len>
        1342            0      0.0278      0.0278   <zlib.decompress>
        1074            0      2.2143      0.0266   mercurial.changelog:270(read)
        1074            0      2.1328      0.0230       mercurial.revlog:907(revision)
        1073            0      0.0208      0.0108       mercurial.changelog:28(decodeextra)
        2148            0      0.0072      0.0072       <method 'split' of 'str' objects>
        2148            0      0.0211      0.0038       mercurial.encoding:61(tolocal)
        1074            0      0.0028      0.0028       <method 'index' of 'str' objects>
        1061            0      1.9811      0.0237   mercurial.revlog:817(_loadchunk)

real    0m2.742s
user    0m0.811s
sys     0m0.188s

After this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        2092            0      0.1444      0.0292   mercurial.context:202(__init__)
        2092            0      0.0908      0.0216       mercurial.repoview:161(changelog)
        2092            0      0.0164      0.0057       mercurial.changelog:183(rev)
        6276            0      0.0045      0.0045       <isinstance>
        1096            0      0.0024      0.0024       <binascii.unhexlify>
        3188            0      0.0013      0.0013       <len>
        2218            0      0.0230      0.0230   mercurial.revlog:296(rev)
        2111            0      0.1028      0.0218   mercurial.repoview:161(changelog)
        4218            0      0.0387      0.0146       mercurial.changelog:133(tip)
        2111            0      0.0238      0.0104       mercurial.localrepo:26(__get__)
        4218            0      0.0122      0.0062       <len>
        2111            0      0.0038      0.0021       mercurial.repoview:112(filterrevs)
        4218            0      0.0014      0.0014       <hash>
       20240         8444      0.0233      0.0149   <len>
        8444            0      0.0110      0.0084       mercurial.revlog:262(__len__)
        4218            0      0.0387      0.0146   mercurial.changelog:133(tip)
        4218            0      0.0144      0.0103       mercurial.changelog:190(node)
        4218            0      0.0097      0.0048       <len>
        2398            1      0.0271      0.0115   mercurial.localrepo:26(__get__)
        2398            1      0.0146      0.0046       mercurial.scmutil:939(__get__)
        2124            0      0.0009      0.0009       mercurial.localrepo:330(unfiltered)
         274            0      0.0002      0.0002       mercurial.repoview:192(unfiltered)
           4            0      0.1409      0.0112   mercurial.branchmap:19(read)
        1096            0      0.1113      0.0028       mercurial.localrepo:407(__contains__)
        1098            0      0.0020      0.0020       <method 'split' of 'str' objects>
        1097            0      0.0019      0.0019       <binascii.unhexlify>
        1096            0      0.0093      0.0018       mercurial.encoding:61(tolocal)
        1096            0      0.0010      0.0010       <method 'append' of 'list' objects>
        4349            0      0.0150      0.0105   mercurial.changelog:190(node)
        4349            0      0.0045      0.0045       mercurial.revlog:317(node)

real    0m0.362s
user    0m0.329s
sys     0m0.024s
2013-09-16 01:08:29 -07:00
Brodie Rao
38cd6d3329 debuglabelcomplete: simplify with repo.branchmap().iterbranches() 2013-09-16 01:08:29 -07:00
Stephen Lee
7b97b6250a bookmarks: allow push -B to create a new remote head (issue2372)
Push is currently allowed to create a new head if there is a remote
bookmark that will be updated to point to the new head. If the
bookmark is not known remotely then push aborts, even if a -B argument
is about to push the bookmark. This change allows push to continue in
this case. This does not require a wireproto force.
2013-11-11 21:16:54 +11:00
Brodie Rao
56709077ed branches: avoid unnecessary changectx.branch() calls
This requires reading from the changelog, which can be costly over NFS.

Note that this does not totally remove reading from the changelog; we
still do that when calling changectx.closesbranch(). That call will be
removed in a later patch.

Running hg branches on the PyPy repo (with 996) over a busy NFS server,
before this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        2042            0      2.2827      2.2827   <open>
        2036            0      0.9840      0.9840   <method 'close' of 'file' objects>
        2036            0      0.0464      0.0464   <method 'read' of 'file' objects>
        5233            0      0.1985      0.0453   mercurial.repoview:161(changelog)
       10462            0      0.0791      0.0314       mercurial.changelog:133(tip)
        5233            0      0.0388      0.0176       mercurial.localrepo:26(__get__)
       10462            0      0.0250      0.0126       <len>
        5233            0      0.0059      0.0039       mercurial.repoview:112(filterrevs)
       10462            0      0.0029      0.0029       <hash>
        2034            0      0.0444      0.0444   <method 'seek' of 'file' objects>
        5340            0      0.0390      0.0390   mercurial.revlog:296(rev)
        2582            0      0.0371      0.0371   <zlib.decompress>
        3155            0      0.1963      0.0366   mercurial.context:202(__init__)
        3155            0      0.1238      0.0306       mercurial.repoview:161(changelog)
        3155            0      0.0261      0.0080       mercurial.changelog:183(rev)
        9465            0      0.0061      0.0061       <isinstance>
        1096            0      0.0023      0.0023       <binascii.unhexlify>
        4251            0      0.0014      0.0014       <len>
        2059            0      3.7341      0.0332   mercurial.changelog:270(read)
        2059            0      3.6304      0.0307       mercurial.revlog:907(revision)
        2057            0      0.0262      0.0137       mercurial.changelog:28(decodeextra)
        4118            0      0.0094      0.0094       <method 'split' of 'str' objects>
        4118            0      0.0270      0.0048       mercurial.encoding:61(tolocal)
        2059            0      0.0040      0.0040       <method 'index' of 'str' objects>
       10462            0      0.0791      0.0314   mercurial.changelog:133(tip)
       10462            0      0.0289      0.0207       mercurial.changelog:190(node)
       10462            0      0.0188      0.0091       <len>
       52433        20932      0.0478      0.0310   <len>
       20932            0      0.0221      0.0168       mercurial.revlog:262(__len__)
        2059            0      3.6304      0.0307   mercurial.revlog:907(revision)

real    0m4.361s
user    0m0.986s
sys     0m0.237s

After this change:

$ time hg --profile branches > /dev/null
   CallCount    Recursive     Total(s)    Inline(s) module:lineno(function)
        1069            0      1.1098      1.1098   <open>
        1063            0      0.4865      0.4865   <method 'close' of 'file' objects>
        4122            0      0.1811      0.0404   mercurial.repoview:161(changelog)
        8240            0      0.0712      0.0272       mercurial.changelog:133(tip)
        4122            0      0.0378      0.0177       mercurial.localrepo:26(__get__)
        8240            0      0.0221      0.0115       <len>
        4122            0      0.0057      0.0033       mercurial.repoview:112(filterrevs)
        8240            0      0.0025      0.0025       <hash>
        3029            0      0.1979      0.0371   mercurial.context:202(__init__)
        3029            0      0.1278      0.0310       mercurial.repoview:161(changelog)
        3029            0      0.0230      0.0081       mercurial.changelog:183(rev)
        9087            0      0.0061      0.0061       <isinstance>
        1096            0      0.0026      0.0026       <binascii.unhexlify>
        4125            0      0.0014      0.0014       <len>
        4229            0      0.0337      0.0337   mercurial.revlog:296(rev)
        1061            0      0.0296      0.0296   <method 'seek' of 'file' objects>
        1063            0      0.0292      0.0292   <method 'read' of 'file' objects>
        8240            0      0.0712      0.0272   mercurial.changelog:133(tip)
        8240            0      0.0271      0.0196       mercurial.changelog:190(node)
        8240            0      0.0169      0.0083       <len>
       40476        16488      0.0422      0.0271   <len>
       16488            0      0.0193      0.0152       mercurial.revlog:262(__len__)
        1342            0      0.0241      0.0241   <zlib.decompress>
        9445            0      0.0336      0.0224   mercurial.changelog:190(node)
        9445            0      0.0112      0.0112       mercurial.revlog:317(node)
        1074            0      1.9102      0.0224   mercurial.changelog:270(read)
        1074            0      1.8397      0.0202       mercurial.revlog:907(revision)
        1073            0      0.0187      0.0099       mercurial.changelog:28(decodeextra)
        2148            0      0.0061      0.0061       <method 'split' of 'str' objects>
        2148            0      0.0184      0.0034       mercurial.encoding:61(tolocal)

real    0m2.402s
user    0m0.735s
sys     0m0.177s
2013-11-15 23:18:08 -05:00
Matt Mackall
4223982ebe merge with stable 2013-12-01 14:10:53 -06:00
Santiago Pay=C3=A0 i Miralta
42d271f1db help: fix backwards bisect help example 2013-11-27 22:32:01 +01:00
Sean Farley
5f6b3d5623 pathcomplete: remove ambiguous entries for sole completion on a directory
Previously, directories were added with the trailing slash and, if there was
only one completion, then another ambiguous entry was created using '.', as
follows:

$ hg rm mer<TAB>
mercurial/./  mercurial//

This was added in bc559aff745c (though, some logic existed before that) to work
around bash completion adding a space after the sole entry because we treated
directories and files the same. We no longer do that now so we remove this
unneeded code.

Tests have been updated to match this new behavior.
2013-11-25 12:12:42 -05:00
Martin Geisler
8b1b36c645 bisect: don't mention obsolete graphlog extension in help 2013-11-22 19:12:44 +01:00
Matt Mackall
05fd1f2542 merge with stable 2013-11-25 16:15:44 -06:00
Siddharth Agarwal
ac345dd993 commands.bookmark: use unsetcurrent instead of setcurrent with None
There are currently two different ways we can have no active bookmark:
.hg/bookmarks.current being missing and it being an empty file. This patch and
upcoming ones make an empty file the only way to represent no active bookmarks.
This is the right choice because it matches the state that a new repository
without bookmarks will be in.
2013-11-15 18:06:01 -08:00
Matt Mackall
40d3e4ba4e merge with stable 2013-11-22 17:26:58 -06:00
Martin Geisler
934da465b0 phase: better error message when --force is needed
When trying to turn a draft changeset into a secret changeset, I was
told:

  % hg phase -s .
  cannot move 1 changesets to a more permissive phase, use --force
  no phases changed

That message struck me as being backwards -- the secret phase feels
less permissive to me since it restricts the changesets from being
pushed.

We don't use the word "permissive" elsewhere, 'hg help phase' talks
about "lower phases" and "higher phases". I therefore reformulated the
error message to be

  cannot move 1 changesets to a higher phase, use --force

That is not perfect either, but more in line with the help text. An
alternative could be

  cannot move phase backwards for 1 changesets, use --force

which fits better with the help text for --force.
2013-11-08 11:49:13 +01:00
Sean Farley
a66d57e510 bookmarks: consider successor changesets when moving bookmark (issue4015)
Previously, this required -f because we didn't consider obsolete changesets
(and their children ... or successors of those children, etc.). We now use
obsolete.foreground to calculate acceptable changesets when advancing the
bookmark.

Test coverage has been added.
2013-11-06 19:01:14 -06:00
Mads Kiilerich
2dfba4c2b0 bisect: avoid confusing use of variables with same names in nested local scopes 2013-11-16 15:46:29 -05:00
Augie Fackler
fb91efd733 makememctx: move from patch to context to break import cycle 2013-11-06 22:09:15 -05:00
Augie Fackler
9f876f6c89 cleanup: move stdlib imports to their own import statement
There are a few warnings still produced by my import checker, but
those are false positives produced by modules that share a name with
stdlib modules.
2013-11-06 16:48:06 -05:00
FUJIWARA Katsunori
22784f4191 bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
This patch adds "pushtoremote()", which uses "compare()" to compare
bookmarks between the local and the remote repositories, to replace
pushing local bookmarks in "commands.push()".
2013-11-08 12:45:52 +09:00
Simon Heimberg
25ae76fc48 documentation: add an extra newline after note directive
Like this no docutils version interprets any line in the following text as
argument of note.
2013-11-05 08:59:55 +01: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
Matt Mackall
6ddd78602b help: minor tweak to push help 2013-10-21 10:26:38 -07: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
Mads Kiilerich
a971393dbd commands: refactor 'serve', extract the http service class 2013-10-10 04:32:36 +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
Mads Kiilerich
1e900bb145 check-code: check for spaces around = for named parameters 2013-10-03 14:50:47 +02:00
Siddharth Agarwal
663145e3f0 update: standardize error message for dirty update --check
This and following patches will standardize the error message for dirty working
directories to "uncommitted changes".
2013-09-23 20:33:02 -07:00
Siddharth Agarwal
3bfd19f5c2 pull: for pull --update with failed update, print hint if any
An upcoming patch will add a hint to the abort message, and we don't want to
lose that here.
2013-09-23 19:02:32 -07:00
Augie Fackler
f56544a399 commands: import hgweb.server in a way that 2to3 can rewrite 2013-09-19 15:28:26 -04:00
Matt Mackall
1e6f803e48 debugfs: add hardlink support reporting 2013-08-14 12:42:22 -05:00
Kevin Bullock
7e226a7735 bookmarks: pull --update updates to active bookmark if it moved (issue4007)
This makes `hg pull --update` behave the same wrt the active bookmark as
`hg pull && hg update` does as of 13ea5e437ff8. A helper function,
bookmarks.calculateupdate, is added to prevent code duplication between
postincoming and update.
2013-08-01 21:43:14 -05:00
Matt Mackall
6d0d30f28a checkunfinished: accommodate histedit quirk
Turns out histedit actually intends for commits (but not other
operations like update) to be possible during its operation.
2013-07-25 02:17:52 -05:00
Matt Mackall
54bbf86a7b heads: fix children/descendants in doc (issue3992) 2013-07-25 00:54:49 -05:00
Matt Mackall
72d6ff963c update: add tracking of interrupted updates (issue3113)
This takes advantage of the new checkunfinished infrastructure
2013-07-25 00:33:28 -05:00
Matt Mackall
1194d33a0a commands: add checks for unfinished operations (issue3955)
commands checked:
  backout
  bisect
  commit
  graft
  import
2013-07-24 23:51:40 -05:00
Matt Mackall
3e65ebe091 update: clear any clearable unfinished operations (issue3955)
Unclearable operations will cause an abort.
2013-07-24 23:30:24 -05:00
Matt Mackall
bae7de95b0 heads: modernize documentation (issue3992)
The old docs emphasized topological heads rather than branch heads and
incorrectly defined branch heads as not having children rather than
descendants.
2013-07-21 18:45:42 -05:00
Jordi Gutiérrez Hermoso
dc821f9523 commit: enable --secret option
At the moment, creating secret commits is slightly cumbersome. They
can either be created by changing the default commit phase to secret
or by doing `hg phase --secret --force`. Both of these make secret
commits appear to be like some kind of advanced feature.

Secret commits, however, should be a convenient feature for people who
want to work on a private branch without affecting anyone else. There
should therefore be a prominent and convenient method for creating
secret commits.

Since the default phase is draft and there is no need to use --force
to go from a secret phase to any other phase, this patch
intentionally does not add --draft and --public options.
2013-07-11 13:11:41 -04:00
Florence Laguzet
2a64618669 merge: deprecate the --force option
The --force option in merge does not make what people think it does so
it may not be visible to everyone.

I have local changes and want to pull one's changes which made 2 heads.
The --force option in help says

 -f --force      force a merge with outstanding changes

so I can expect that I can use it to force the merge and commit it in my
local repository without taking my local changes into account. But
merging with -f keeps local changes and "add" them: they must be
committed or reverted before doing the merge commit. The merge -f cannot
be reverted so it leads my repository in a bad state: cannot commit
merge and don't want to revert/commit local changes yet.

Message in help have been updated to emphasize the fact that local
changes are included in the merge.
2013-07-17 23:58:04 +02:00
Siddharth Agarwal
b40e1d442a version: bump copyright year 2013-07-17 17:34:30 -07:00
Martin Geisler
d2aa05d2bf rollback: add reference to "hg commit --amend"
Now that rollback is deprecated (yay!) users might need a pointer to
the alternative for 99% of the cases where I used rollback.
2013-07-17 10:49:34 +02:00
Matt Mackall
90ddfc6b4b rollback: mark as deprecated 2013-07-16 17:10:26 -05:00
Matt Mackall
d487ab0f65 tip: deprecate the tip command 2013-07-11 19:29:23 -05:00
Matt Mackall
14881de1b1 tag: remove incorrect reference to tip 2013-07-11 19:28:54 -05:00
Matt Mackall
a7f8535149 log: remove tip from example 2013-07-11 19:28:26 -05:00
Matt Mackall
8101748b15 cat: remove incorrect reference to tip 2013-07-11 19:28:01 -05:00
Siddharth Agarwal
4a9d798403 summary: use missing ancestors algorithm to find new commits
For a repository with around 520,000 commits and 190,000 files, this reduces
the time hg summary takes from 5.5 seconds to 2.75.
2013-07-15 15:19:43 -07:00
Simon Heimberg
9bef074106 summary: remove passing of rev because summary does not have this
The command summary does not have a rev argument, so passing this results
is None always. Therefore pass None explicitly.
2012-11-06 00:22:56 +01:00
Durham Goode
f9e0cf8458 parents: change parents command to use filectx
Changes the parents command to use filectx to look up the change node
instead of doing it manually.  This allows extensions to modify the
file-to-commit relationship behind the filectx api.
2013-06-18 13:05:16 -07:00
Matt Mackall
1035a87704 merge with stable 2013-06-07 16:59:59 -05:00
Matt Mackall
3491238eed merge with stable 2013-06-01 17:19:00 -05:00
Simon King
ca4986a596 graft: refuse to commit an interrupted graft (issue3667) 2013-05-30 22:32:10 +01:00
Matt Mackall
ae59675587 merge with stable 2013-05-23 17:52:21 -05:00
Matt Mackall
666687bde2 amend: complain more comprehensibly about subrepos 2013-05-23 17:39:33 -05:00
Matt Mackall
10bc3570e7 help: fix role/option confusion in RST
RST's role syntax means something different sometimes when it's in
some places that are poorly documented and vary betwen minirst and
docutils. Line wrapping will thus sometimes break everything.
2013-05-21 15:23:50 -05:00
Mike Williams
946c7811c1 help: stop documentation markup appearing in generated help
Markup for links to mercurial commands is appearing in the help
documentation.

This patch fixes the markup so mercurial command reference links are
correctly generated in the help documentation.
2013-05-15 22:19:12 +01:00
Yuya Nishihara
7976fca292 branch: strip whitespace before testing known branch name
Because dirstate._branch() strips leading/trailing spaces from .hg/branch,
"hg branch ' foo '" should abort if branch "foo" exists in another head.

tag command had a similar bug and fixed by 11d102903884.
2013-05-07 23:49:03 +09:00
Iulian Stana
b1c3535a9b commit: amending with --close-branch (issue3445)
You can't close a branch that hasn't got a head.
newbranch + commit --close-branch must fail
newbranch + commit + commit --amend --close-branch must fail

You must not be allowed to close a branch that is not defined.
2013-05-02 19:36:47 +03:00
Sean Farley
a7c7655a58 bookmarks: fix bug that activated a bookmark even with -r passed
If the current revision was the target revision of -r, then the bookmark would
be active. Test cases have been updated accordingly.
2013-05-01 15:24:21 -05:00
Sean Farley
a1b3b895c9 bookmarks: resolve divergent bookmark when moving across a branch
This patch resolves a single divergent bookmark if a divergent bookmark exists
in the target revision and it current bookmark is not an ancestor of the target
revision, else it would already be handled by the previous patch in this
series.

Test coverage is added.
2013-04-30 21:12:49 -05:00
Sean Farley
b0f6662132 bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant
This patch is a follow-up to 00b2764d68e4 that resolves divergent bookmarks
between the to-be-forwarded bookmark MARK and the new descendant. This
situation can happen when pulling new changesets, updating to the divergent
bookmark, abandoning the previous changesets with strip, and then moving MARK
to MARK@N.

Test coverage is added.
2013-05-01 15:31:39 -05:00
Matt Mackall
4c93c130ae merge with stable 2013-05-21 15:32:15 -05:00
Bryan O'Sullivan
5acd0ede31 summary: augment output with info from extensions 2013-05-14 11:23:15 -07:00
Matt Mackall
1fb1e9a700 merge with stable 2013-05-16 16:20:10 -05:00
Benoit Boissinot
a898b587b8 bundle-ng: add bundlecaps argument to getbundle() command 2013-02-09 23:42:03 +01:00
Kevin Bullock
025c39700e merge with stable 2013-05-13 13:02:01 -05:00
Kevin Bullock
21ed6a41e7 bookmarks: allow bookmark command to take multiple arguments
This change allows setting or deleting multiple bookmarks at once. If more than
one is being set and --inactive is not given, the first one is made active.
2013-05-02 21:28:18 -05:00
Pierre-Yves David
e661ab7a6c import: inline checkexact function
We have a sngle call now, no need to make it a function.
2013-04-17 10:25:14 +02:00
Pierre-Yves David
376dafed94 import: factor out checkexact
The two calls are strictly identical. We can simply move it after the if/else
clause.
2013-04-17 10:22:28 +02:00
FUJIWARA Katsunori
b29ea06623 summary: clear "commonincoming" also if branches are different
Before this patch, "commonincoming" calculated by
"discovery.findcommonincoming()" is cleared, only if "default" URL
without branch part (tail "#branch" of URL) differs from
"default-push" URL without branch part.

But common revisions in "commonincoming" calculated for a branch
doesn't include ones for another branch, even if URLs without branch
part are same. The result of "discovery.findcommonoutgoing()"
invocation with such "commonincoming" becomes incorrect in some cases.

This patch clears "commonincoming", also if branch part of "default"
differs from one of "default-push".

To avoid redundant looking up:

  - "ui.expandpath('default')" and "ui.expandpath('default-push',
    'default')" are not compared directly, even though they contain
    branch information, because they are not yet normalized by
    "hg.parseurl()": tail "/" of path, for example

  - "commonincoming" is not cleared, if branch isn't specified in
    "default" URL, because such "commonincoming" contains common
    revisions for all branches

This patch also tests "different path, same branch" pattern to check
careless degrading around comparison between source and destination.
2013-04-09 23:40:11 +09:00
FUJIWARA Katsunori
a5e9088b00 summary: make "incoming" information sensitive to branch in URL (issue3830)
Before this patch, "incoming" information of "hg summary --remote" is
not sensitive to the branch specified in the URL of the destination
repository, even though "hg pull"/"hg incoming" are so.

Invocation of "discovery.findcommonincoming()" without "heads"
argument treats revisions on branches other than the one specified in
the URL as incoming ones unexpectedly.

This patch looks head revisions, which are already detected by
"hg.addbranchrevs()" from URL, up against "other" repository, and
invokes "discovery.findcommonincoming()" with list of them as "heads"
to limit calculation of incoming revisions.
2013-04-09 23:40:11 +09:00
FUJIWARA Katsunori
70663e300c summary: make "outgoing" information sensitive to branch in URL (issue3829)
Before this patch, "outgoing" information of "hg summary --remote" is
not sensitive to the branch specified in the URL of the destination
repository, even though "hg push"/"hg outgoing" are so:

Invocation of "discovery.findcommonoutgoing()" without "onlyheads"
argument treats revisions on branches other than the one specified in
the URL as outgoing ones unexpectedly.

This patch looks head revisions, which are already detected by
"hg.addbranchrevs()" from URL, up against local repository, and
invokes "discovery.findcommonoutgoing()" with list of them as
"onlyheads" to limit calculation of outgoing revisions.
2013-04-09 23:40:10 +09:00
Mads Kiilerich
b81e3cdb96 debugrebuildstate: rename to debugrebuilddirstate
There is a lot of state, but this command is for rebuilding the dirstate.
2013-04-15 01:41:47 +02:00
Mads Kiilerich
a855980324 debugstate: rename to debugdirstate
There is a lot of state, but this command is for debugging the dirstate.
2013-04-15 01:41:27 +02:00
Mads Kiilerich
2c609377a2 debugrebuildstate: clarify that rev can't be specified without -r
-r has a default value of '' in the command line. The function default value of
'tip' is thus never used and any attempt at specifying revisions without -r
will fail.

It seems like then intended behavior was that 'hg debugrebuildstate' without
any parameters should set the parents to tip. That would be very confusing now
when the command primarily is used to recover from incorrect stat info.

It is apparently undocumented that '' is the same as '.' ... unless it is
passed in a place where revsets are used.
2013-04-15 01:39:02 +02:00
Mads Kiilerich
747e73f27d export: export working directory parent by default
A common usecase for export is to preview the patch that will be patchbombed or
to see what changed in a revision found by bisect. Showing the working
directory parent is thus a useful and obvious default.
2013-02-11 00:43:12 +01:00
Mads Kiilerich
7c13eeb821 commit: allow closing "non-head" changesets
Backout 308a153b9120. The changeset prevented closing non-head changesets but
did not provide any rationale or test case and I don't see what value it adds.
Users might have their reasons to commit something anywhere - and close it
immediately.

And contrary to the comment that is removed: The topo heads set is _not_
included in the branch heads set of the current branch. It do not include
closed topological heads.

The change thus prevented closing commits on top of closing commits. A valid
usecase for that is to merge closed heads to reduce the number of topological
heads.

The only existing test coverage for this is the failing double close in
test-revset.t. It was added in dc0e42c06b4e and seems to not be intentional.
2013-04-10 13:12:24 +02:00
Brodie Rao
3d16726725 amend: support amending merge changesets (issue3778) 2013-02-08 21:08:34 +00:00
Mads Kiilerich
c0e7f36590 tag: clarify cryptic error message when tagging null revision 2013-04-11 14:44:22 +02:00
Bryan O'Sullivan
738dd167db debuglabelcomplete: compute active branch heads correctly
The previous computation was simply wrong.
2013-04-09 09:40:40 -07:00
Siddharth Agarwal
7b731630aa graft: use missing ancestors algorithm to find earlier grafts
When the revisions to graft are numerically close to the destination, this
avoids two walks up the DAG, which for a repository with over 470,000
changesets translates to around 2.2 seconds.
2013-04-06 19:50:03 -07:00
Siddharth Agarwal
d16194fcaf graft: find ancestors of destination lazily
When the revisions to graft are numerically close to the destination, this
avoids one walk up the DAG, which for a repository with over 470,000
changesets translates to around 1.1 seconds.
2013-04-06 20:05:17 -07:00
Bryan O'Sullivan
82ca6ed101 merge with mpm 2013-04-02 08:58:42 -07:00
Siddharth Agarwal
262d694589 pull: list bookmarks before pulling changesets (issue3873)
Consider a bookmark B that exists both locally and remotely. If B is updated
remotely, and then a pull is performed where the pull set contains the new
location of B, the bookmark is updated locally. However, if remote B is
updated in the middle of a pull to a location not in the pull set, the
bookmark won't be updated locally at all.

To fix this, list bookmarks before pulling in changesets, not after. This
still leaves a race open if B gets moved in between listing bookmarks and
pulling in changesets, but the race window is much smaller. Fixing the race
properly would require a bundle format upgrade.

test-hook.t's output changes because we no longer do two listkeys calls during
pull, just one.

test-pull-http.t's output changes because we now search for bookmarks before
searching for changes.
2013-03-29 19:54:06 -07:00
Siddharth Agarwal
266855be39 pull: rename local rb to remotebookmarks
This local will become more important in an upcoming patch, so give it a more
descriptive name.
2013-03-29 19:06:23 -07:00
Simon Heimberg
da12bc2332 serve: pass on the repo instad of recreating it in hgweb
When we pass on the path to the repo, the repo is created in hgweb. But the
repo is already here, so pass it on.
2013-03-21 18:16:49 +01:00
Simon Heimberg
f4736156b4 serve: pass the prepared baseui to hgweb
The baseui was carefully prepared but not used.
ui can contain repo specific settings which can have unwanted effects.
2013-03-21 18:16:48 +01:00
Wagner Bruna
9e929db5bc commands: fix typo in debugobsolete docstring 2013-04-01 18:48:12 -03:00
FUJIWARA Katsunori
53db57bfeb bundle: treat branches created newly on the local correctly (issue3828)
Before this patch, "hg bundle --branch foo other" fails to create
bundle file, if specified "foo" branch is created newly on the local
repository.

"hg bundle" uses "hg.addbranchrevs(repo, other, ...)" to look branch
names up, even though other outgoing-like implementation uses
"hg.addbranchrevs(repo, repo, ...)". In the former invocation, "other"
repository recognizes such branches as unknown, so execution is
aborted.

This patch uses "hg.addbranchrevs(repo, repo, ..)" in "hg bundle" to
bundle revisions on such branches correctly.
2013-02-18 00:04:28 +09:00
Pierre-Yves David
042f644a5b debugobsolete: improve command help
The behavior without argument was not documented.
2013-02-09 23:28:42 +00:00
Kevin Bullock
95941cafe7 bookmarks: show active bookmark even if not at working dir
If the active bookmark doesn't point at a parent of the working dir
(e.g. a pull moved it out from under us), we nonetheless show it as
active. This follows on 13ea5e437ff8 in removing the dichotomy (at least
in the UI) between "current" and "active" bookmarks.
2013-01-27 11:29:14 -06:00
Kevin Bullock
573de12159 help: update verbose 'clone' help to include '@' bookmark 2013-01-25 16:11:16 -06:00
Kevin Bullock
e5bcfe1e27 help: document '@' bookmark in 'help bookmarks' and 'help clone' 2013-01-25 11:06:30 -06:00
Kevin Bullock
dc307a1121 update: update to current bookmark if it moved out from under us (issue3682)
If the current bookmark (the one listed in .hg/bookmarks.current)
doesn't point to a parent of the working directory, e.g. if it was moved
by a pull, use that as the update target instead of the tipmost
descendent.

A small predicate is (finally) added to the bookmarks module to check
whether the current bookmark is also active.
2013-01-21 13:47:10 -06:00
Pierre-Yves David
093fc83eab changectx: fix the handling of tip
We can not use `len(repo,changelog)`, it may be a filtered revision. We now use
`repo,changelog.tip()` to fetch this information.

The `tip` command is also fixed and tested

Thanks goes to Idan Kamara for the initial report.
2013-01-22 11:39:14 +01:00
Wagner Bruna
3b2e42fb86 debugsuccessorssets: fix typos in docstring 2013-01-21 13:47:14 -02:00
Bryan O'Sullivan
9875c114cd debugpathcomplete: satisfy the code checker 2013-03-21 22:29:31 -07:00
Bryan O'Sullivan
25ebd629ba pathcomplete: complete directories more conservatively
Suppose we want to perform a single-level completion (i.e. without
--full) of "fi" in a repo containing "fee", "fie/dead", "fie/live",
and "foe".

If we give back "fie/" as the only answer, the shell will consider
the completion to be unambiguous, and will append a space after the
completion.  We can't complete "fie/live" or "fie/dead" without
first backspacing over that space.

We used to thus create two fake names, "fie/a" and "fie/b", to force
the shell to consider the completion to be ambiguous. It would then
stop at "fie/" without appending a space, allowing us to hit tab
again to complete "fie/live" or "fie/dead".

The change here arises from realising that we only need to force
the shell to consider a completion as ambiguous if we have exactly
one directory and zero files as possible completions.

This prevents spurious names from showing up as possible completions
when they don't need to be invented in the first place.
2013-03-21 22:10:54 -07:00
Bryan O'Sullivan
d521a241b2 completion: add a debugpathcomplete command
The bash_completion code uses "hg status" to generate a list of
possible completions for commands that operate on files in the
working directory. In a large working directory, this can result
in a single tab-completion being very slow (several seconds) as a
result of checking the status of every file, even when there is no
need to check status or no possible matches.

The new debugpathcomplete command gains performance in a few simple
ways:

* Allow completion to operate on just a single directory. When used
  to complete the right commands, this considerably reduces the
  number of completions returned, at no loss in functionality.

* Never check the status of files. For completions that really must
  know if a file is modified, it is faster to use status:

  hg status -nm 'glob:myprefix**'

Performance:

Here are the commands used by bash_completion to complete, run in
the root of the mozilla-central working dir (~77,000 files) and
another repo (~165,000 files):

All "normal state" files (used by e.g. remove, revert):

                            mozilla    other
  status -nmcd 'glob:**'       1.77     4.10 sec
  debugpathcomplete -f -n      0.53     1.26
  debugpathcomplete -n         0.17     0.41

("-f" means "complete full paths", rather than the current directory)

Tracked files matching "a":

                            mozilla    other
  status -nmcd 'glob:a**'      0.26     0.47
  debugpathcomplete -f -n a    0.10     0.24
  debugpathcomplete -n a       0.10     0.22

We should be able to further improve completion performance once
the critbit work lands. Right now, our performance is limited by
the need to iterate over all keys in the dirstate.
2013-03-21 16:31:28 -07:00
Bryan O'Sullivan
59cec2d504 completion: add a debuglabelcomplete command
When completing a "label" (a symbolic name for a commit), the
bash_completion script currently has to invoke hg three times. For
a large repository, the cost of starting up and loading all the
necessary context over and over is very high.

For instance, in mozilla-central:

  time (export HGPLAIN=1; hg tags -q; hg bookmarks -q; hg branches) >/dev/null
  0.446 sec

Compare with the debuglabelcomplete command that this commit adds:

  time hg debuglabelcomplete >/dev/null
  0.148 sec

This greatly helps responsiveness.
2013-03-21 10:51:18 -07:00
Kevin Bullock
0ac9eb1b2b merge 2013-03-18 19:59:05 -05:00
Kevin Bullock
9a9dfa03ff bookmarks: moving the active bookmark deactivates it
After this change, moving the active bookmark somewhere other than the
current changeset (i.e., with --rev) deactivates it. Previously it would
remain in .hg/bookmarks.current, which seems like a bug.
2013-03-16 22:48:22 -05:00
Kevin Bullock
8d31377f62 bookmarks: allow (re-)activating a bookmark on the current changeset
Allow a bookmark that points to the current changeset to be made the
active bookmark without requiring --force. Previously, this would've
aborted with:

  abort: bookmark 'Z' already exists (use -f to force)
2013-03-16 21:36:44 -05:00
Kevin Bullock
f416be4da5 bookmarks: allow moving a bookmark forward to a descendant
Allow 'hg bookmark MARK', with an existing bookmark MARK, to move the
bookmark forward to the current or specified revision, if the target
revision is a descendant of the revision the bookmark currently points
to. Prints a status message including the revision the bookmark was
formerly at:

  $ hg bookmark Z
  moving bookmark 'Z' forward from 663762316562

Test coverage is added.
2013-03-15 23:39:07 -05:00
Augie Fackler
31c30e1b53 Merge 2013-03-17 23:27:14 -05:00
Bryan O'Sullivan
bbd075858d grep: use re2 if possible
Since re2 is enormously faster than Python's re module, this should
help performance, ceteris paribus. grep currently has other huge
performance problems that mask any gain :-(
2013-03-11 12:07:33 -07:00
Dan Villiom Podlaski Christiansen
3950055bca help: move the majority of the help command to the help module
We move the logic for generating the unformatted ReST source to the
help module, in order to eventually avoid calling commands.help_()
from hgweb.

No functionality change.
2013-02-09 21:51:21 +00:00
Bryan O'Sullivan
b87176491b commands: exit from the log loop at the right time
Previously, we'd run the iterator one more time than necessary,
potentially doing a lot of extra work in the process.
2013-02-20 11:31:41 -08:00
Kevin Bullock
d93d5152ce merge with stable 2013-02-19 13:35:39 -06:00
Kevin Bullock
1ada567a36 backout: call cmdutil.commit directly instead of commands.commit
This cleans up the messiness of having one command call another, and
makes the backout command robust against changes to the commit command.
2013-02-12 16:36:44 +00:00
Kevin Bullock
6f2a9a513a commit: factor out status printing into a helper function
We create a new function commitstatus() in cmdutil that handles printing
the status message(s) after a commit. This will allow other commit-like
commands to use it, and in particular is step 2 towards removing
backout's call to commands.commit.
2013-02-12 16:32:14 +00:00
Kevin Bullock
cdcb425321 backout: remove unnecessary dict copy
This is step 1 to remove backout's call to commands.commit. We don't use
the options again anywhere below except for backout's own purposes,
specifically choosing a merge tool, so we just write the commit options
in directly.
2013-02-12 16:05:00 +00:00
Kevin Bullock
86981724b1 backout: remove unnecessary frobbing of addremove option
There's no way for addremove to show up in backout's opts dictionary. It
was being set manually because cmdutil.commit expected it to be there
(and would throw an exception if it wasn't). This was fixed waaaaaaay
back in:

changeset:   5829:e05e83ad9d2b
user:        Kirill Smelkov <kirr@mns.spb.ru>
date:        Thu Jan 10 12:07:18 2008 +0300
summary:     cmdutil.commit: extract 'addremove' from opts carefully
2013-02-12 15:47:30 +00:00
Kevin Bullock
979acf9af6 backout: use cmdutil.revert directly instead of commands.revert
Before this change, backout would explicitly set the options it passed
to commands.revert in order to fall thru most of its logic and call
cmdutil.revert. This change makes it clearer what backup is trying to
accomplish and makes it robust against changes to the revert command.
2013-02-12 15:07:17 +00:00
Thomas Arendsen Hein
dddbcf14eb merge with crew-stable 2013-02-11 16:57:46 +01:00
Kevin Bullock
d86fa541fd import: don't rollback on failed import --exact (issue3616)
The checkexact() helper function was calling repo.rollback() from inside
an open transaction. In addition to being insane, this is unnecessary
because import will release the transaction on an exception.

It turns out that this has been broken since the feature was first
introduced, first released in v1.0:

changeset:   4263:3e8ce73e04cd
user:        Brendan Cully <brendan@kublai.com>
date:        Thu Mar 22 10:44:59 2007 -0700
files:       mercurial/commands.py mercurial/patch.py
description:
Add import --exact.
When this option is set, import will apply the patch (which must
be generated by export) to the parents specified in the patch,
and check that the node produced by the patch matches the node
ID in the patch.
2013-02-10 23:01:12 +00:00
Matt Mackall
2f3cd110be summary: add missing space for updated active bookmark display 2013-02-09 22:54:34 +00:00
Kevin Bullock
fe0a5f965c summary: show active bookmark even if not at current changeset
Before this change, 'hg summary' would not show the active bookmark
unless it pointed to the working directory parent. After this change, it
will show it in parentheses, like so:

parent: 18581:f0ff45fe6700 tip
 summary: simplify handling of active bookmark
branch: default
bookmarks: [crew]
commit: (clean)
update: (current)
2013-02-08 21:47:22 +00:00
Kevin Bullock
9d31a18963 summary: simplify handling of active bookmark 2013-01-27 11:53:46 -06:00
Mads Kiilerich
dd30593de7 refactoring: use unlinkpath with ignoremissing 2013-01-15 23:30:10 +01:00
Mads Kiilerich
fb9e9db8cf identity: report bookmarks sorted 2012-12-12 02:51:02 +01:00
Pierre-Yves David
a1985448ad clfilter: enforce hidden changeset globally
The dispatch code now enables filtering of "hidden" changesets globally. The
filter is installed before command and extension invocation. The `--hidden`
switch is now global and disables this filtering for any command.

Code in log dedicated to changeset exclusion is removed as this global filtering
has the same effect.
2013-01-08 20:37:37 +01:00
Mads Kiilerich
8cb1e5208b debugpushkey: list keys sorted 2012-12-16 20:50:57 +01:00
Mads Kiilerich
d5ef6b65bb debugdiscovery: report heads in sorted order 2012-12-12 02:38:14 +01:00
Pierre-Yves David
8e3d4ef15b phases: prepare phase command for filtering
The phase command have some logic to report change made. We ensure this logic
run unfiltered.

With --force the command can change phase of a changeset for public to draft.
Such change can lead to obsolescence marker to apply again and the changeset to
be "hidden". If we do not run the logic unfiltered it could failed to fetch the
phase of a newly filtered changeset.
2012-12-24 11:58:40 +01:00
Pierre-Yves David
18a17fb6be phases: avoid changectx creation while checking command result
This minor changesets saves the creation of a `changectx` ctx object only used to
fetch the revision number.
2012-12-24 11:57:48 +01:00
Augie Fackler
51e564c918 commands: fix implicit tuple that is invalid syntax in Python3 2013-01-01 13:18:33 -06:00
Pierre-Yves David
bc7f0f7ffa amend: allow amend of non-head when obsolete is enabled
Obsolescence marker can represent this situation just fine. The old
version is marked as precursor of the new changeset. All its
descendants become "unstable".

If obsolescence is not enabled we keep the current behavior of
aborting. This new behavior only applies when obsolete is
enabled and is subject to future discussion and changes.
2012-12-31 17:44:18 -06:00
Mads Kiilerich
275333d6c9 util: fold ENOENT check into unlinkpath, controlled by new ignoremissing flag
Refactor a common pattern.
2012-12-28 11:55:57 +01:00
Kevin Bullock
4ca92b51d3 merge with stable 2012-12-26 11:16:18 -06:00
Mads Kiilerich
a17080a566 bookmarks: fix head selection for merge with two bookmarked heads
A type mismatch caused the search for the other head to fail. The code is
fragile, and instead it ended up using the 'first' bookmark head, but the
ordering is undefined and it could thus randomly use the wrong bookmarkhead
and fail with:

  $ hg up -q -C e@diverged
  $ hg merge
  abort: merging with a working directory ancestor has no effect
2012-12-24 13:26:13 +01:00
Kevin Bullock
2deea1b073 commands: 'hg bookmark NAME' should work even with ui.strict=True
Before this patch, enabling strict command processing (ui.strict=True)
meant that 'hg bookmark NAME', as referenced several places in the
documentation, would not work. This adds 'bookmark' as an explicit alias
to 'bookmarks'.
2012-12-16 22:00:38 -06:00
Tim Henigan
68a1fc4488 update: allow update to existing branches with invalid names (issue3710)
Starting with 049792af94d6, users are no longer able to update a
working copy to a branch named with a "bad" character (such as ':').

Prior to v2.4, it was possible to create branch names using "bad"
characters, so this breaks backwards compatibility.

Mercurial must allow users to update to existing branches with bad
names.  However, it should continue to prevent the creation of new
branches with bad names.

A test was added to confirm that 'hg update' works as expected. The
test uses a bundled repo that was created with an earlier version of
Mercurial.
2012-11-27 08:47:35 -05:00
Pierre-Yves David
292c83cd65 command: remove phase from the list of basic command
This is not a basic command. There is no reason new user should needs to know
about it. Thanks to Matt Mackall for pointing this.
2012-11-28 11:20:56 +01:00
Kevin Bullock
b676337ab7 grep: remove useless while condition
A revised version of 51ea4dcf1448 was sent to the list that fixed this
<http://markmail.org/message/jmfuiise5igcyh2m>, but the older version of
the patch was applied.
2012-11-15 11:27:30 -06:00
Idan Kamara
4ae64fdb03 grep: don't search past the end of the searched string
'*' causes the resulting RE to match 0 or more repetitions of the preceding RE:

>>> bool(re.search('.*', ''))
>>> True

This causes an infinite loop because currently we're only checking if there was
a match without looking at where we are in the searched string.
2012-11-12 19:27:03 +02:00
Pierre-Yves David
da22110fc6 obsolete: compute successors set
Successors set are an important part of obsolescence. It is necessary to detect
and solve divergence situation. This changeset add a core function to compute
them, a debug command to audit them and solid test on the concept.

Check function docstring for details about the concept.
2012-12-13 15:38:43 +01:00
Mads Kiilerich
00be1ef6f3 rm: drop misleading 'use -f' hint for the rm --after 'not removing' warning
A warning mentioning 'forgetting' or 'recording delete' would be more correct
than 'not removing' but also more confusing.
2012-12-09 23:33:16 +01:00
David Schleimer
8fe2e0bb30 graft: explicit current node tracking
This changes graft to explicitly track the progression of commits it
makes, and updates it's idea of the current node based on it's last
commit, rather than from the working copy parent.  This should have no
effect on the value of current since we were reading the working copy
parent immediately after commiting to it.

The motivation for this change is that a subsequent patch will break
the current node and working copy relationship.  Splitting this out
into a separate patch will make that one more readible.
2012-12-04 12:54:18 -08:00
David Schleimer
63ae483369 graft: move commit info building
This moves the logic for generating the commit metadata ahead of the
merge operation.  The only purposae of this patch is to make
subsequent patches easier to read, and there should be no behavior
changes.
2012-12-04 12:54:18 -08:00
FUJIWARA Katsunori
f05ff4243c i18n: add "i18n" comment to column positioning messages of "hg summary"
This comment makes it easier to distinguish such messages from others
for message translators.
2012-10-31 03:59:28 +09:00
Siddharth Agarwal
acc48ffd83 url: use open and not url.open for local files (issue3624) 2012-10-17 21:30:08 -07:00
Tim Henigan
f99bb85c98 branch: add missing repo argument to checknewlabel
scmutil.checknewlabel takes a repo object as its first argument.
When the call to this function was added in 4d438984605c, the
first argument was mistakenly set to 'None'.
2012-11-29 08:49:21 -05:00
Matt Mackall
8b3d6f35a8 merge with stable 2012-11-28 18:08:51 -06:00
Jordi Gutiérrez Hermoso
022cc130e9 bisect: add example for limiting bisection to specified directories
The bisect command does not have an option to limit itself only to
subdirectories, but it's possible to use revsets for the --skip option
for the same effect. Given the relative obscurity of revsets, it helps
to have this as another example for bisect.
2012-11-23 11:59:44 -05:00
Matt Mackall
fd58e8703f i18n: wrap false positives for translation detection 2012-11-25 13:53:47 -06:00
Kevin Bullock
eeb14bc872 merge with crew-stable 2012-11-16 10:20:32 -06:00
Idan Kamara
34cb035697 grep: don't search past the end of the searched string
'*' causes the resulting RE to match 0 or more repetitions of the preceding RE:

>>> bool(re.search('.*', ''))
>>> True

This causes an infinite loop because currently we're only checking if there was
a match without looking at where we are in the searched string.
2012-11-12 19:27:03 +02:00
Augie Fackler
9766845689 bookmarks: introduce a bmstore to manage bookmark persistence
Bookmarks persistence still showed a fair amount of its legacy as a
monkeypatching extension. This encapsulates all bookmarks
serialization and parsing in a single class, and offers a single
location where other bookmarks storage engines can be substituted
in. As a result, many files no longer import the bookmarks module,
which strikes me as an encapsulation win.

This doesn't do anything to the current bookmark state yet, but I'm
hoping put that in the bmstore class as well.
2012-11-07 16:21:39 -06:00
Matt Mackall
59bb4c17e3 tags: add formatter support 2012-11-06 17:38:22 -06:00
Matt Mackall
0776a4dc92 manifest: add formatter support 2012-11-06 17:30:49 -06:00
Matt Mackall
28b6ee7d27 status: use condwrite to avoid zero-width format string hack 2012-11-06 17:30:47 -06:00
Simon Heimberg
13de6e4d2f subrepo: more isolation, only use ui for hg.peer when there is no repo
ui contains repo specific configuration, so do not use it when there is a repo.
But pass it to hg.peer when there is no repo. Then it only contains global
configuration.
2012-10-04 19:46:43 +02:00
Matt Mackall
9bae2c49ee update: check for missing files with --check (issue3595) 2012-10-22 17:23:31 -05:00
Matt Mackall
f5bc386500 remove: don't return error on directories with tracked files
Spotted by Sergey <sergemp@mail.ru>
2012-10-22 16:06:47 -05:00
FUJIWARA Katsunori
477c2590ac help: indicate help omitting if help document is not fully displayed
Before this patch, there is no information about whether help document
is fully displayed or not.

So, some users seem to misunderstand "-v" for "hg help" just as "the
option to show list of global options": experience on "hg help -v" for
some commands not containing verbose containers may strengthen this
misunderstanding.

Such users have less opportunity for noticing omitted help document,
and this may cause insufficient understanding about Mercurial.

This patch indicates help omitting, if help document is not fully
displayed.

For command help, the message below is displayed at the end of help
output, if help document is not fully displayed:

    use "hg -v help xxxx" to show more complete help and the global
    options

and otherwise:

    use "hg -v help xxxx" to show the global options

For topics and extensions help, the message below is displayed, only
if help document is not fully displayed:

    use "hg help -v xxxx" to show more complete help

This allows users to know whether there is any omitted information or
not exactly, and can trigger "hg help -v" invocation.

This patch causes formatting help document twice, to switch messages
one for omitted help, and another for not omitted. This decreases
performance of help document formatting, but it is not mainly focused
at help command invocation, so this wouldn't become problem.
2012-10-18 10:31:15 +09:00