Commit Graph

586 Commits

Author SHA1 Message Date
Pierre-Yves David
b263ff2b09 revert: prefix variable names for dirstate status with "ds"
As we are going to introduce status again other revision we needs to distinguish
between data from dirstate status and the other one. We prefix the existing data
with "ds" to highlight this.
2014-06-24 15:35:43 +01:00
Pierre-Yves David
50ccb74146 revert: move manifest membership condition outside of the loop
Currently, revset is using information from dirstate status and alter its
behavior whenever the file exist in the target manifest or not. This tests are
done a big for loop. We move this member ship testing outside of the loop and
simplifies associates data structure.

This is a step toward a cleaner implementation of revert based on status.
2014-06-24 15:28:22 +01:00
FUJIWARA Katsunori
28e199eab5 cmdutil: use '[committemplate]' section like as map file for style definition
Before this patch, each template definitions for 'changeset*' in
'[committemplate]' section have to be written fully from scratch,
even though many parts of them may be common.

This patch uses '[committemplate]' section like as the map file for
the style definition. All items other than 'changeset' can be referred
from others.

This can reduce total cost of template customization in
 '[committemplate]' section.

When the commit template other than '[committemplate] changeset'
is chosen by 'editform', putting '[committemplate] changeset'
value into the cache of the templater causes unexpected result,
because the templater stores the specified (= chosen) template
definition into own cache as 'changeset' at construction time.

This is the reason why '[committemplate] changeset' can't be referred
from others.
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
ec97822d35 cmdutil: look commit template definition up by specified 'editform'
Before this patch, '[committemplate] changeset' definition is shared
between all actions invoking 'commitforceeditor()'.

This prevents template definition from showing action specific
messages: for example, 'hg tag --remove' may need specific
message to call attention, but showing it may be redundant for
other actions.

This patch looks commit template definition up by specified
'editform' introduced by prior patches. 'editform' are
dot-separated list of names, and treated as hierarchical one.
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
7b50947677 import: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, 'normal' and 'bypass' are used as ROUTE.
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
4de8382c53 commit: pass 'editform' argument to 'cmdutil.getcommiteditor'
This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, 'normal' and 'amend' are used as ROUTE.
2014-08-02 21:46:27 +09:00
FUJIWARA Katsunori
83c808bc5a cmdutil: introduce 'editform' to distinguish the purpose of commit text editing
This information will be used to switch '[committemplate] changeset'
definition according to its purpose in the subsequent patch.

This information also makes it easier to hook commit text editing only
in the specific cases.
2014-08-02 21:46:26 +09:00
Durham Goode
4bf8cd87a5 log: allow patterns with -f
It's not uncommon for a user to want to run log with a pattern or directory name
on the history of their current commit.  Currently we prevent that, but
I can't think of any reason to continue blocking that.

This commit removes the restriction and allows 'hg log -f <dir/pat>'
2014-07-22 22:40:16 -07:00
Siddharth Agarwal
1fe4080620 log: use an exact matcher for --patch --follow
The arguments to log --patch --follow are expected to be exact paths.

This will be used to make manifest filtering for these cases more efficient in
upcoming patches.
2014-07-12 18:31:18 -07:00
Matt Mackall
809fa98620 merge with stable 2014-07-16 17:35:04 -05:00
Siddharth Agarwal
67dffae77b log: make --patch --follow work inside a subdirectory
Previously, the 'patch' code for hg log --patch --follow would try to resolve
patterns relative to the repository root rather than the current working
directory. Fix that by using match.files instead of pats, as done elsewhere
nearby.
2014-07-12 02:23:17 -07:00
Siddharth Agarwal
9d5c80b2c5 log: allow revset for --follow to be lazily evaluated
It is unclear to me why evaluation was forced.

For a repository with over 700,000 commits, 'hg log -f' drops from 1.2 seconds
to 0.2 seconds.
2014-07-12 20:44:00 -07:00
FUJIWARA Katsunori
ccb0dfc103 cmdutil: separate building commit text from 'commitforceeditor'
This separation makes it easier to extend/hook building commit text
from the specified context.

This patch uses 'committext' instead of 'edittext' for names of newly
added variable and function, because the former is more purpose
specific than the latter, even though 'edittext' in 'buildcommittext'
is left as it is to reduce amount of diff.
2014-07-15 00:59:09 +09:00
Augie Fackler
23d3b7a1e7 cmdutil: add copy-filtering support to duplicatecopies
In order to fix issue 4192 we need to be able to skip some copies
while doing duplicatecopies.
2014-06-07 15:14:36 -04: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
Lucas Moscovicz
783ebe698d cmdutil: changed _makegraphlogrevset to _makelogrevset
This method will now be used to build both graphlog and log revset after this
series of patches.
2014-02-25 10:40:04 -08:00
Matt Mackall
3fd77ddc42 merge with stable 2014-07-02 00:01:13 -05:00
Gregory Szorc
aa3c5a1887 cmdutil: support inferrepo in command decorator 2014-05-04 22:20:00 -07:00
Gregory Szorc
f5b841fd2e cmdutil: add optionalrepo argument to command decorator 2014-05-04 22:12:34 -07:00
Gregory Szorc
a7f200b6b8 commands: add norepo argument to command decorator
Since decorators are evaluated at module load time and since the
@command decorator imports commands, the norepo variable (along with
its friends) may not be declared yet. These variables are now declared
before @command usage to ensure they are present.
2014-05-04 20:58:25 -07:00
Gregory Szorc
db0791767a cmdutil: better document command() 2014-05-04 18:45:04 -07: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
Pierre-Yves David
ca87e2a8ca revert: use p2 as parent when reverting against it
revert was always using p1 as parent. This created some minor misbehavior when
reverting against p2. See test change for an example of that.

This is also a useful cleanup for coming refactoring to revert.
2014-05-14 10:38:05 -07:00
Pierre-Yves David
f11f5d8bf7 revert: explicitly get status against the parent
This makes absolutely no functional changes. The default value for
node1 is already the same as the current value of parent. But to be
able to properly use the second parent in merge context, we have to
start to be a bit more explicit about what we compute the status
against.
2014-05-14 10:37:25 -07:00
Pierre-Yves David
ffa305346b revert: group related data in tuple in the dispatch table
The dispatch table used to be:

- action if in target manifest
- action if not in target manifest
- make backup if in target manifest
- make backup if not in target manifest

We turn this into two (action, make backup) tuples.

This helps both readability of the dispatch table and handling of each case.

This also prepares a refactoring where the different actions we performs, whether
"file is in target manifest" or not, are determined before reaching this loop.
2014-05-13 17:28:19 -07:00
Pierre-Yves David
e48f0c2bb9 revert: group action into a single dictionary
We had 4 different variables to hold the list of the 4 possibles
actions. I'm grouping them in a single dictionary for a few reasons.
First, it makes it clearer they are all related and meant to be the
final actions performed by revert. Second this simplifies the parameter
of the _performrevert function. Finally the two elements in each entry
(list and message) have a different consumers in different functions,
this change will make it easier to split them in a later commit.
2014-05-13 16:42:31 -07:00
Pierre-Yves David
04aa6b354e revert: add some inline comments
I spend some time understanding how this part of the revert code is
working. I'm adding some comments to help the code readability. I
expect most of them to disappear in a coming refactoring. But the
refactoring should be easier to follow with the comment.
2014-05-13 16:29:42 -07:00
Pierre-Yves David
2b188dd25a revert: cosmetic align of the dispatch table
This changeset make a minimal cosmetic change to help readability of the value
in this table.
2014-05-13 16:29: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
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
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
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
Matt Mackall
ca3a6376d7 debugrevlog: use unfiltered view for changelog 2014-04-14 23:27:31 -04:00
Mads Kiilerich
0e8795ccd6 spelling: fixes from spell checker 2014-04-13 19:01:00 +02: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
ea6ffc9a80 merge with stable 2014-03-18 14:25:28 -05:00
FUJIWARA Katsunori
89fcbff9fc amend: save commit message into ".hg/last-message.txt"
Before this patch, commit message (may be manually edited) for "commit
--amend" is never saved into ".hg/last-message.txt", because it uses
"localrepository.commitctx()" instead of "localrepository.commit()":
saving into ".hg/last-message.txt" is executed only in the latter.

This patch saves commit message for "commit --amend" into
".hg/last-message.txt" just after user editing.

This is the simplest implementation to fix on stable. Editing and
saving commit message for memctx should be centralized into the
framework like "localrepository.commit()" with "editor" argument or so
in the future.
2014-03-19 01:07:41 +09:00
Lucas Moscovicz
0d53c6ae3b cmdutil: changed max method for lazy call
Used the lazy max call instead of the python max implementation to be able to
use lazysets for graphlog.
2014-03-14 13:27:12 -07:00
Lucas Moscovicz
dafb80fa39 getgraphlogrevs: return an empty baseset instead of a empty list
We aims at returning smartset only so that function higher in the stack can use
smartset feature.
2014-03-14 13:26:40 -07:00
Pierre-Yves David
a0ce769bb9 getgraphlogrevs: do not convert smartset to baseset
We are now sure that revs is a smartset. We remove the baseset call that would
defeat any lazyness.
2014-03-14 16:26:50 -07:00
Lucas Moscovicz
a96218c725 cmdutil: changed revset for spanset
Instead of using baseset(repo.changelog) changed it for spanset(repo) which is
much faster.
2014-03-14 08:44:52 -07:00
Lucas Moscovicz
3972cf7390 cmdutil: changed code in _makegraphlogrevset not to use getitem
__getitem__ is a method that is not implemented lazily on many of the new
classes and it can be easily replaced with a structure that takes advantage of
the new lazy implementations instead.
2014-03-14 11:35:17 -07:00
Lucas Moscovicz
9dd89e3285 cmdutil: changed code in getgraphlogrevs not to use getitem
__getitem__ is a method that is not implemented lazily on many of the new
classes and it can be easily replaced with a structure that takes advantage of
the new lazy implementations instead.
2014-03-14 08:43:52 -07: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
Matt Mackall
471d2893a7 merge with default 2014-03-13 15:00:34 -05:00
Matt Mackall
b93e6d4112 merge with stable 2014-03-13 12:05:08 -05:00
Lucas Moscovicz
81e72f8395 cmdutil: changed walkchangerevs to use spanset instead of baseset
Using a spanset takes almost no memory at all. A baseset builds the entire
list in memory and is much slower for methods like __contains__.
2014-03-05 18:49:47 -08:00
Matt Mackall
94e268974b templating: make -T much more flexible
It can now accept styles and paths and references to settings in
[templates].
2014-03-08 17:38:50 -06:00
Matt Mackall
694de7920e changeset_templater: remove use_template method 2014-03-08 16:14:08 -06:00
Matt Mackall
b80c07e771 cmdutil: make helper function to process template args 2014-03-08 16:01:58 -06:00
Alexander Drozdov
53f98064f3 cmdutil: make commitforceeditor() to pass revision extras to ui.edit() 2014-02-06 10:15:20 +04:00
Pierre-Yves David
8e74d42689 revert: extract actual revert in its own function
With this small refactoring, the computation of the action to perform and the
actual change to the disk happen in different function. This allows extension to
wrap the later in case of need. The initial motivation is the `remotefilelog`
extension that need to prefetch all the file content to be checked out.
2014-02-26 18:56:27 -08:00
Lucas Moscovicz
2663ae5f88 cmdutil: implemented new lazy increasingwindows
Now log can work in a lazy way and get results as soon as they are processed.

Performance Benchmarking:

$ time hg log -l1 -qr "branch(default)"
0:3a6a38229d41

real  0m2.303s
user  0m2.252s
sys 0m0.048s

$ time ./hg log -l1 -qr "branch(default)"
0:3a6a38229d41

real  0m0.238s
user  0m0.199s
sys 0m0.037s
2014-02-13 14:27:12 -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
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
8bfe6ea1ed itersubrepos: move to scmutil to break a direct import cycle 2014-02-03 18:36:00 -05:00
FUJIWARA Katsunori
12afa6b0c3 cmdutil: enhance "getcommiteditor()" for specific usages in MQ
This patch introduces "finishdesc" and "extramsg" arguments into
"getcommiteditor()" for specific usages in MQ.

"finishdesc" will be used to treat the commit message as "[mq];
patch-file-name" (default MQ commit message), if it is left as empty,
instead of aborting commit process.

"extramsg" will be used to show the line below:

    HG: Leave message empty to use default message

instead of:

    HG: Leave message empty to abort commit
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
308518c1e9 import: use "getcommiteditor()" instead of explicit editor choice
This patch also enhances "test-import-bypass.t" and "test-import.t",
because "hg import" hasn't been explicitly tested around editor
invocation and "--edit" option.

This patch explicitly tests below:

    - with "--bypass" (regardless of "--edit"):
        - not invoked, if the patch contains the commit message
        - not invoked, if the commit message is explicitly specified
        - invoked, otherwise (just adding comment)

    - without "--bypass":
        - with "--edit":
            - not invoked, if "--no-commit" is not specified
            - invoked, otherwise
        - without "--edit":
            - not invoked, if the patch contains the commit message
            - not invoked, if "--message" or "--logfile" is specified
              (just adding comment)
            - invoked, otherwise
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
5d7a84ff6f amend: use "getcommiteditor()" instead of explicit editor choice
This patch doesn't change any tests like as preceding patches, because
editor invocation is already tested in "test-commit-amend.t".
2014-05-11 00:49:36 +09:00
FUJIWARA Katsunori
0a6972edad cmdutil: introduce "getcommiteditor()" to simplify code paths to choose editor
"getcommiteditor()" can simplify code paths to choose commit editor
according to '--edit' option as below:

    before:
        editor = cmdutil.commiteditor # or editor = None/False
        if opts.get('edit'):
            editor = cmdutil.commitforceeditor

    after:
        editor = cmdutil.getcommiteditor(**opts)

"getcommiteditor()" accepts option arguments not in "opts" style but
in "**opts" style, because some code paths want to invoke it with just
explicit "edit=True" argument (building dictionary is redundant).
2014-05-11 00:49:35 +09: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
Matt Mackall
74cf3d4bf4 merge with stable 2013-11-19 11:29:56 -05:00
Matt Mackall
c9a233d77e templater: fix escaping in nested string literals (issue4102)
Before the templater got extended for nested expressions, it made
sense to decode string escapes across the whole string. Now we do it
on a piece by piece basis.
2013-11-18 14:02:26 -05:00
Augie Fackler
213fff305a pathutil: tease out a new library to break an import cycle from canonpath use 2013-11-06 18:19:04 -05:00
Yuya Nishihara
4a2a9b7d3a cmdutil: fix makefileobj not to clobber default modemap dict
Problem occurs if "hg cat -o" is invoked more than once in the same process.
The output of "hg cat" will be appended because of modemap[fn] = 'ab'.
2013-10-22 23:38:58 +09:00
Mads Kiilerich
c47c81f0e5 cmdutil: use None as default value for "function pointer" instead of False
Less type confusion.
2013-10-03 18:01:21 +02:00
Siddharth Agarwal
0b1ce7709c cmdutil.service: move pidfile writing to the parent in daemon mode
There is a potential race here, which I suspect I've spotted in the wild, where
something reads the pid file after the parent exits but before the child has
had a chance to write to it. Moving writing the file to the parent causes this
to no longer be an issue.
2013-10-02 15:20:49 -07:00
Siddharth Agarwal
e4986d8e9e cmdutil.service: move pidfile writing to a local function
An upcoming patch will reuse this code.
2013-10-02 15:17:50 -07:00
Siddharth Agarwal
1addd98f97 cmdutil.bailifchanged: standardize error message for dirty working dir
This affects rebase, graft, histedit, and other similar commands.
2013-09-23 21:31:37 -07:00
Durham Goode
87385443b0 log: make file log slow path usable on large repos
Running "hg log <pattern or directory>" on large repos took a very, very long
time because it first read ctx.files() for every commit before even starting to
process the results.

This change makes the ctx.files() check lazy, which makes the command start
producing results immediately.
2013-09-10 19:49:34 -07:00
Matt Mackall
b2c60c13a2 revert: fix largefiles breakage 2013-07-26 21:03:25 -05:00
Matt Mackall
0bc2bdce17 revert: make backup when unforgetting a file (issue3423)
This skips the backup if it would be a duplicate.
2013-07-26 17:08:05 -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
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
1aa741bd25 cmdutil: core functionality to block during multistep commands (issue3955)
This adds a registration point and check functions that will allow
commands to check if multistep operations like an interrupted graft or
rebase are in progress before proceeding.
2013-07-24 23:27:30 -05:00
Durham Goode
1142072e5b filelog: switch 'not len(filerevlog)' to 'not filerevlog'
A few places in the code use 'if not len(revlog)' to check if the revlog
exists. Replacing this with 'not filerevlog' allows alternative revlog
implementations to override __nonzero__ to handle this case without
implementing __len__.
2013-05-30 18:47:16 -07:00
Durham Goode
6733c33949 log: move log file walk to its own function
This moves the logic that determines which changesets to process during a
'hg log foo.txt' command. Putting it in its own function allows extensions
to modify how the file log is traversed. For instance, the current
implementation uses filelog revs heavily. Other implementations may not have
filelog revs available.

The function throws an exception if the traversal is not possible via the
filelog, so the parent function can do things the slow way if necessary
(by walking the entire commit history).

Aside from the exception throwing, no logic is changed.
2013-05-30 19:25:55 -07:00
Bryan O'Sullivan
5acd0ede31 summary: augment output with info from extensions 2013-05-14 11:23:15 -07:00
Bryan O'Sullivan
c787225d04 revert: ensure that copies and renames are honored (issue3920)
Previously, we restored the states of files, but not the additional
information the dirstate uses to track copies and renames.
2013-05-03 12:40:17 -07:00
Mads Kiilerich
bd4ae8e1a6 amend: fix unlocking order - first lock then wlock 2013-04-17 03:41:08 +02:00
Alexander Plavin
829cf92d16 log: fix behavior with empty repositories (issue3497)
Make output in this special case consistent with general case one.
2013-04-17 00:29:54 +04:00
Brodie Rao
3d16726725 amend: support amending merge changesets (issue3778) 2013-02-08 21:08:34 +00:00
Siddharth Agarwal
b97fabd2e4 duplicatecopies: do not mark items not in the dirstate as copies
Consider the following repo:

  0 -- 1 (renames a to b)
    \
     - 2

If we're rebasing 2 onto 1, then duplicatecopies is called with arguments (2,
1). copies.pathcopies goes backwards from 1 to 0 and returns the pair dst = a,
src = b. Of course, since we're working on top of 2, at this point a doesn't
exist in the dirstate.

Extra entries in the copymap are currently harmless because the copymap is
only queried for items in the dirstate map. However, if the dirstate.copy
method becomes one of the sources used to determine which files have changed,
this will prove problematic.

Note that we can't avoid going backwards in general -- consider this repo:

  0 -- 1 (renames a to b)
    \
     - 2 (renames a to c)

Rebasing 2 onto 1 should produce a rename from b to c.
2013-03-28 18:27:19 -07:00
Siddharth Agarwal
218624d093 duplicatecopies: fix arg name and docstring
While most callers do indeed use duplicatecopies with a rev and its parent,
rebase doesn't.
2013-03-28 00:14:27 -07:00
Bryan O'Sullivan
e37e16da0f cmdutil: use a small initial window with --limit
In a large repo, running a command like "log -l1 -p" was expensive because
it would always traverse 8 commits, as 8 was the initial window size.

We now choose the lesser of 8 or the limit, speeding up the "log -l1 -p"
case by a factor of 5.
2013-02-20 11:31:38 -08: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
Mads Kiilerich
ef317883c7 export: show 'Date' header in a format that also is readable for humans
'export' is the official export format and used by patchbomb, but it would only
show date as a timestamp that most humans might find it hard to relate to. It
would be very convenient when reviewing a patch to be able to see what
timestamp the patch will end up with.

Mercurial has always used util.parsedate for parsing these headers. It can
handle 'all' date formats, so we could just as well use a readable one.

'export' will now use the format used by 'log' - which is the format described
as 'Unix date format' in the templating help. We assume that all parsers of '#
HG changeset patch'es can handle that.
2013-02-08 22:54:17 +01:00
Augie Fackler
8671b3e731 export: clobber files with -o (bc) (issue3652)
This violated user expectation. Updated the code to clobber files, but
preserve the behavior of appending multiple patches requested in a
single export. Includes tests.
2013-02-09 15:38:57 -06:00
Antonio Zanardo
a6143a0b42 commit: show active bookmark in commit editor helper text
If there is an active bookmark while committing, the bookmark name
will be visible inside the commit message helper, below the branch
name.

This should make easier for the user to detect a mistaken commit
parent, while working for example with a bookmark centric workflow
like topic branches.

The active bookmark is checked to be in the working directory, as
pointed by Kevin Bullock, because otherwise committing would not
advance it. In other words, this would not show the active
bookmark name if the user changed the working tree parents with
'hg debugsetparents', for example.
2013-02-02 15:37:17 -02:00
Mads Kiilerich
2d6545f8b6 subrepos: process subrepos in sorted order
Add sorted() in places found by testing with PYTHONHASHSEED=random and code
inspection.

An alternative to sprinkling sorted() all over would be to change substate to a
custom dict with sorted iterators...
2012-12-12 02:38:14 +01:00
Mads Kiilerich
5af2faad25 log: make log work even if first parameter doesn't exist
A slowpath optimization kicked in too often because of wrong indentation.
2013-01-15 01:05:12 +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
Pierre-Yves David
ad252eff44 log: use "hidden" filtering instead of manual check at display time
When log is not given the --hidden option, hidden revision are not shown. We
move the implementation from manual checking at display time to changelog
filtering.

This is the first official usage of the hidden filtering.
2013-01-07 19:24:36 +01:00
Pierre-Yves David
d66193718e cmdutil: make options argument optional
There is not reason to force passing of an empty options list.
2013-01-04 13:48:07 +01:00
Matt Mackall
fe2cbf4904 merge with stable 2013-01-02 00:24:28 -06:00
Pierre-Yves David
b6d4017a84 amend: prevent loss of bookmark on failed amend
The active bookmark were moved to the temporary commit. When the transaction
were rollbacked, the bookmark were lost.

We now temporarly disable the bookmark to prevent this effect.
2012-12-30 03:49:15 +01:00
Pierre-Yves David
6a1ec255bb amend: invalidate dirstate in case of failure (issue3670)
The temporary commit created by amend update the dirstate. If the final commit
fails, we need to invalidate the change made to the dirstate, otherwise the
release of the wlock will write the dirstate created after the rollbacked
temporary commit.

This dirstate writing logic should probably be handled in the same object than
the transaction one. However such change are too big for stable.
2012-12-29 18:00:18 +01:00
Siddharth Agarwal
2b9ccce531 cmdutil: make getgraphlogrevs limit-aware
For a repository with over 400,000 changesets, this speeds up graphlog with a
small limit by around 0.05 seconds (~50%).
2012-12-28 16:25:12 -08:00