Commit Graph

2781 Commits

Author SHA1 Message Date
Augie Fackler
a5b17bd9d1 cleanup: use __builtins__.any instead of util.any
any() is available in all Python versions we support now.
2015-05-16 14:30:07 -04:00
Gilles Moris
8bcf856ad8 phase: default to current revision if no rev is provided (issue4666) 2015-05-15 09:46:21 +02:00
Martin von Zweigbergk
decbcc4c31 treemanifest: add --dir option to debug{revlog,data,index}
It should be possible to debug the submanifest revlogs without having
to know where they are stored (in .hg/store/meta/), so let's add a
--dir option for this purpose.
2015-04-12 23:51:06 -07:00
Gilles Moris
7771de9187 summary: add a phase line (draft, secret) to the output
The number of draft and secret changesets are currently not summarized.
This is an important information because the number of drafts give some rough
idea of the number of outgoing changesets in typical workflows, without needing
to probe a remote repository. And a non-zero number of secrets means that
those changeset will not be pushed.

If the repository is "dirty" - some draft or secret changesets exists - then
summary will display a line like:

phases: X draft, Y secret (public)

The phase in parenthesis corresponds to the highest phase of the parents of
the working directory, i.e. the current phase.

By default, the line is not printed if the repository is "clean" - all
changesets are public - but if verbose is activated, it will display:

phases: (public)

On the other hand, nothing will be printed if quiet is in action.

A few tests have been added in test-phases.t to cover the -v and -q cases.
2015-05-14 17:38:38 +02:00
Matt Mackall
00247918bd commands: use try/except/finally 2015-05-15 09:56:05 -05:00
FUJIWARA Katsunori
4d0023540e import: use dirstateguard instead of dirstate.invalidate
Before this patch, "commands.import()" uses "dirstate.invalidate()" as
a kind of "restore .hg/dirstate to the original status" during a failure.

But it just discards changes in memory, and doesn't actually restore
".hg/dirstate". Then, it can't work as expected, if "dirstate.write()"
is executed while processing.

This patch uses "dirstateguard" instead of "dirstate.invalidate()" to
restore ".hg/dirstate" at failure even if "dirstate.write()" is
executed before failure.

This patch also removes "beginparentchage()" and "endparentchange()",
because "dirstateguard" makes them useless, too.

This is a part of preparations to fix the issue that the recent (in
memory) dirstate isn't visible to external process (e.g. "precommit"
hook).
2015-05-07 12:07:10 +09:00
Ryan McElroy
7a091e748f bookmarks: rename bookmarkcurrent to activebookmark (API)
Today, the terms 'active' and 'current' are interchangeably used throughout the
codebase in reference to the active bookmark (the bookmark that will be updated
with the next commit). This leads to confusion among developers and users.
This patch is part of a series to standardize the usage to 'active' throughout
the mercurial codebase and user interface.
2015-04-14 13:17:33 -07:00
Ryan McElroy
fb38156bdc bookmarks: rename setcurrent to activate (API)
Today, the terms 'active' and 'current' are interchangeably used throughout the
codebase in reference to the active bookmark (the bookmark that will be updated
with the next commit). This leads to confusion among developers and users.
This patch is part of a series to standardize the usage to 'active' throughout
the mercurial codebase and user interface.
2015-04-13 22:27:01 -07:00
Ryan McElroy
2f82753cb2 bookmarks: rename unsetcurrent to deactivate (API)
Today, the terms 'active' and 'current' are interchangeably used throughout the
codebase in reference to the active bookmark (the bookmark that will be updated
with the next commit). This leads to confusion among developers and users.
This patch is part of a series to standardize the usage to 'active' throughout
the mercurial codebase and user interface.
2015-04-13 21:53:37 -07:00
Yuya Nishihara
044f46397d commands: hide formatter option as EXPERIMENTAL, not as DEPRECATED
84c1db844f78 introduced the EXPERIMENTAL marker, so we should use it
consistently.
2015-04-30 22:40:18 +09:00
Matt Harbison
f2ad8f39e0 debuginstall: expand the editor path before searching for it (issue4380)
The editor launches without expanding the path with commits because the shell
does that for us.

If the path isn't an executable, the expanded path is displayed, which is
probably more useful than the unexpanded path.  For example, in cmd.exe, '~'
expands to C:\Users\$user.  But it expands to C:/mingw/msys/1.0/home/$user in
MinGW.
2015-04-30 23:02:52 -04:00
Laurent Charignon
b2ede5bdf6 revert: make the interactive mode experimental
While fixing issue4304: "record: allow editing new files" we introduced
changes in record/crecord. These changes need to be matched with changes in any
command using record. Revert is one of these commands and the changes have
not been made for this release. Therefore, revert -i should be an experimental
feature for this release.
2015-04-27 15:37:57 -07:00
Martin von Zweigbergk
f1e241ceae revert: accept just -I/-X without paths or -a/-i (issue4592)
'hg revert -I foo' currently fails with

  abort: no files or directories specified
  (use --all to revert all files, or 'hg update 1' to update)

It doesn't seem intentional that -I/-X without other paths or
--all/--interactive should fail, and it doesn't seem that harmful to
allow it either, so let's just do that.
2015-04-22 16:38:36 -07:00
Pierre-Yves David
a7c2f06189 debuglock: access the lock file using the proper vfs
Before this fix, 'wlock' was always reported as "free" because '.hg/store/wlock'
have never been a thing.
2015-04-20 16:05:32 +02:00
Martin von Zweigbergk
1b5dc3517b status: pass matcher to pathcopies()
Just like 111a38b83cb8 (diff: pass the diff matcher to the copy logic,
2015-04-16) sped up 'hg diff --git $path', let's speed up 'hg st -C
$path'. On the Firefox repo, this speeds up

  hg st --rev tip~40000 --rev tip -C python

from 16s to 1.8s. Those two revisions differ in 100k files, out of
which 1k is in python/.
2015-04-19 21:43:53 -07:00
Yuya Nishihara
eae9526460 revset: undocument wdir() until its command outputs get stable
wdir() implementation is still incomplete and shouldn't be advertised to
users. This patch will be backed out when

 - template values such as {rev} and {node} are settled
 - major commands and revsets work without crashing
2015-04-12 19:00:31 +09:00
Pierre-Yves David
9ec3313e25 revert: do not requires '--all' if '--interative' is present
The '--all' option have been introduced in 0a81b7721d8f (August 2006), most
probably to prevent user shooting themselves in the foot. As the record process
will let you, view and select the set of files and change you want to revert, I
feel like the '--all' flag is superfluous in the '--interactive' case.
2015-04-11 12:26:54 -04:00
Pierre-Yves David
af7d20b000 bundle2: rename format, parts and config to final names
It is finally time to freeze the bundle2 format! To do so we:
- rename HG2Y to HG20,
- drop "b2x:" prefix from all part names,
- rename capability to "bundle2-exp" to "bundle2"
- rename the hook flag from 'bundle2-exp' to 'bundle2'
2015-04-09 16:25:48 -04:00
Mathias De Maré
8b3f5b98e3 commands: add ui.statuscopies config knob
statuscopies enables viewing of copies and moves in 'hg status' by default.
2015-03-24 21:25:57 +01:00
FUJIWARA Katsunori
15fa88d61c bookmarks: show detailed status about outgoing bookmarks
Before this patch, "hg outgoing -B" shows only difference of bookmarks
between two repositories, and it isn't user friendly.

This patch shows detailed status about outgoing bookmarks at "hg
outgoing -B".

To avoid breaking backward compatibility with other tool chains, this
patch shows status, only if --verbose is specified,
2015-04-08 02:56:19 +09:00
FUJIWARA Katsunori
f7b7fe9dcb bookmarks: show detailed status about incoming bookmarks
Before this patch, "hg incoming -B" shows only difference of bookmarks
between two repositories, and it isn't user friendly.

This patch shows detailed status about incoming bookmarks at "hg
incoming -B".

To avoid breaking backward compatibility with other tool chains, this
patch shows status, only if --verbose is specified,
2015-04-08 02:56:19 +09:00
Durham Goode
1080800192 graft: record intermediate grafts in extras
Previously the extra field for a graft only contained the original commit hash.
This made it impossible to use graft to copy a commit more than once, because
the extras fields did not change after the second graft.

The fix is to add an extra.intermediate-source field that records the immediate
predecessor to graft. This changes hashes for commits that have been grafted
twice, which is why the test was affected.
2015-04-05 12:12:02 -07:00
Gregory Szorc
7ba88d1a50 commands.debugrevlog: report max chain length
This is sometimes useful to know. Report it.
2015-03-28 12:58:44 -07:00
FUJIWARA Katsunori
3706cf02be update: replace workingctx.dirty and raising Abort by cmdutil.bailifchanged
This patch makes wrapping "commands.update()" by largefiles extension
useless, because "cmdutil.bailifchanged()" can detect changes of
largefiles in the working directory.

This patch also changes test-update-branches.t, because
"cmdutil.bailifchanged()" shows more detailed information about
dirty-ness of the working directory than "workingctx.dirty()".
2015-03-25 13:55:35 +09:00
Yuya Nishihara
bc9e0dc64b debugrevspec: show nesting structure of smartsets if verbose
This shows how smartsets are constructed from the query. It will be somewhat
useful to track problems such as stack overflow.
2015-03-16 18:36:53 +09:00
Yung-Jin (Joey) Hu
a6fc7d5669 status: add relative directory help text (issue3835)
Previously, it was difficult to find out how to display the status of files
relative to your current working directory. This patch adds that knowledge to
the help text.
2015-03-18 20:40:02 -07:00
Sean Farley
a0d78a3107 diff: rename --relative option to --root
The diff output format is unable to express files outside the directory so it
makes sense to name this option --root instead of --relative.
2015-03-25 11:55:15 -07:00
Siddharth Agarwal
8b07d14666 commands.diff: add support for diffs relative to a subdirectory
Previous patches added all the backend support for this. This exposes this
option in the UI.
2015-03-17 15:46:30 -07:00
Gregory Szorc
f0e6b05c9b commands.push: abort when revisions evaluate to empty set (BC)
If the "-r" argument is specified to "hg push," the user has expressed
an intent for a specific changeset to be present on the remote. If that
expression cannot be mapped to a known changeset, the user's intent is
ambiguous and cannot be acted upon without making assumptions.

Previously, if arguments to `push -r <rev>` evaluated to an empty set
(perhaps the user specified a revset that didn't evaluate to anything),
the empty "revs" list would be passed down to "exchange.push" where
it appears the empty list was being interpreted as "push everything."

This patch adds validation to the "-r" argument to the push command. If
the argument is specified but doesn't resolve to a changeset, the
command will abort instead of doing something potentially unexpected.

This patch is technically breaking backwards compatibility. I believe
this is justified because the new behavior closes a crack that could
result in undefined or under-defined behavior. Also, this patch doesn't
drop client capabilities because if users really wanted to push all
changesets, they can simply omit the "-r" argument from push completely.
2015-03-23 18:21:01 -07:00
Yuya Nishihara
676ee8092d annotate: add option to annotate working-directory files
Working revision or node is displayed with "+" suffix in plain output, but
null/None in machine-readable format.
2014-08-16 17:50:55 +09:00
Matt Harbison
3ea5067ed3 subrepo: add basic support to hgsubrepo for the files command
Paths into the subrepo are not yet supported.

The need to use the workingctx in the subrepo will likely be used more in the
future, with the proposed working directory revset symbol.  It is also needed
with archive, if that code is to be reused to support 'extdiff -S'.
Unfortunately, it doesn't seem possible to put the smarts in subrepo.subrepo(),
as it breaks various status and diff tests.

I opted not to pass the desired revision into the subrepo method explicitly,
because the only ones that do pass an explicit revision are methods like status
and diff, which actually operate on two contexts- the subrepo state and the
explicitly passed revision.
2015-03-18 23:03:41 -04:00
FUJIWARA Katsunori
928dad06e6 bookmarks: rewrite comparing bookmarks in commands.summary() by compare()
This patch adds utility function "summary()", to replace comparing
bookmarks in "commands.summary()". This replacement finishes
centralizing the logic to compare bookmarks into "bookmarks.compare()".

This patch also adds test to check summary output with
incoming/outgoing bookmarks, because "hg summary --remote" is not
tested yet on the repository with incoming/outgoing bookmarks.

This test uses "(glob)" to ignore summary about incoming/outgoing
changesets.
2015-03-19 23:36:06 +09:00
FUJIWARA Katsunori
eefef22b72 bookmarks: add outgoing() to replace diff() for outgoing bookmarks
This replacement makes enhancement of "show outgoing bookmarks" easy,
because "compare()" can detect more detailed difference of bookmarks
between two repositories.
2015-03-19 23:36:05 +09:00
FUJIWARA Katsunori
db0c9bd871 bookmarks: add incoming() to replace diff() for incoming bookmarks
This replacement makes enhancement of "show incoming bookmarks" easy,
because "compare()" can detect more detailed difference of bookmarks
between two repositories.
2015-03-19 23:36:05 +09:00
Siddharth Agarwal
4a073b9113 patch._applydiff: resolve prefix with respect to the cwd
This has several advantages compared to resolving it relative to the root:

- '--prefix .' works as expected.
- consistent with upcoming 'hg diff' option to produce relative patches

(I made sure to put in the (glob) annotations this time!)
2015-03-19 10:18:05 -07:00
Yuya Nishihara
610665ea76 commands: say "working directory" in full spelling 2015-03-17 21:53:17 +09:00
Yuya Nishihara
53f1e7866c commands: replace "working copy" with "working directory" in help/messages
"working directory" is the standard term, we should use it consistently.

But I didn't touch the hint, "run 'hg update' to get a working copy", because
"get a working directory" sounds a bit odd.
2015-03-17 22:47:08 +09:00
Laurent Charignon
f97eaa8ce4 revert: add flag to make revert interactive 2015-03-16 16:33:59 -07:00
Laurent Charignon
8e36c9d449 record: change interface of dorecord to accept new filters
This makes it easier to add different filtering logic (record /crecord ...)
2015-03-11 16:39:38 -07:00
Jordi Gutiérrez Hermoso
8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
Laurent Charignon
00e39c0a37 record: add interactive option to the commit command 2015-03-11 15:22:04 -07:00
Matt Harbison
1a03b7a16d files: split reusable implementation into cmdutil for subrepo support 2015-03-08 16:50:57 -04:00
Matt Harbison
51dee7bc7d files: use ctx object to access dirstate
This allows the cmdutil method to not need to be passed the repo as well as the
ctx.
2015-03-08 16:45:29 -04:00
Siddharth Agarwal
d2a372910d commands.import: accept a prefix option
The --prefix option is meant to be relative to the root rather than the current
working directory. This is for consistency with the rest of 'hg import' --
paths in patches are otherwise considered to be relative to the root.

In upcoming patches we'll hook this option up to the patch functions.

--exact with --prefix is currently disallowed because I can't really come up
with sensible semantics for it, especially when only part of the patch is
preserved.
2015-03-06 22:56:19 -08:00
Gregory Szorc
2d6a856d40 commands.paths: use ui.paths to show paths
We now have an API for representing a collection of paths. Use it.
2015-02-07 12:49:30 -08:00
Yuya Nishihara
c59ecd62df incoming: hide help about use of --bundle option by default
Pulling from incoming bundle can cause trouble such as missing phase movement,
bookmarks and largefiles transfer. Average user won't need this option.
2015-02-26 20:54:05 +09:00
Augie Fackler
dbd43329ce dispatch: offer suggestions of similar-named commands
When suggestions are available, we show those suggestions instead of
showing some help output.
2015-02-10 15:59:12 -05:00
Jesus Cea
60d6ae885a copyright: update to 2015
Many files and translations have an outdated copyright date.
Change that to the correct "2005-2015" dates.
2015-03-02 14:52:04 +01:00
Durham Goode
0744c2b71c log: make -fr show complete history from the given revs
Right now it's very obtuse to show the history of a particular rev (hg log -r
'reverse(::foo)'). This changes the -f option to make it follow history for the
revs specified by -r.

The current -f -r behavior is to limit the result of -r to only the
commits that are ancestors of the current working copy. Changing this
is a bit of a BC break, but the old behavior is A) rare, B) easy to
emulate (& ::.), and C) currently undefined. The new behavior is
frequently requested enough that I think the change is worth it.
2015-02-06 11:04:55 -08:00
Martin von Zweigbergk
3f4926eef3 debugsetparent: document one common caveat specifically
After calling debugsetparent, it's quite common that status is
incorrect. The command's help text already says that it should be used
with care, but let's describe this caveat explicitly since it's
probably the most common one.
2015-02-25 11:39:14 -08:00