Commit Graph

14960 Commits

Author SHA1 Message Date
Siddharth Agarwal
b1a86ac060 filemerge: only copy to backup during premerge step
The premerge might leave the original file in an unclean state. Therefore it's
important to only copy the file in the beginning.
2015-10-11 20:04:40 -07:00
Siddharth Agarwal
014002cfa1 filemerge: only print out "merging f" output at premerge step
We're soon going to call this function twice, once for premerge and once for
merge. This makes sure the "merging" output only gets printed during the
premerge step.
2015-10-11 20:02:53 -07:00
Siddharth Agarwal
76bf2a7269 filemerge: deindent the parts of filemerge outside the try block
It is no longer necessary to indent these parts.
2015-10-08 00:19:20 -07:00
Siddharth Agarwal
dd90f817f9 filemerge: introduce a premerge flag and function
This flag will let us get to our overall goal of performing all premerges
before any merges.
2015-10-11 20:47:04 -07:00
Siddharth Agarwal
82f2aec334 filemerge: also return whether the merge is complete
In future patches, we'll pause merges after the premerge step. After the
premerge step we'll return complete = False.
2015-10-11 12:56:21 -07:00
Siddharth Agarwal
da75e232c9 filemerge: add a wrapper around the filemerge function
We'll introduce a separate premerge function that calls the same code.
2015-10-11 12:31:08 -07:00
Mads Kiilerich
90c21b3c76 context: don't hex encode all unknown 20 char revision specs (issue4890)
af5de4d23fd4 introduced nice hexified display of missing nodes. It did however
also make missing 20 character revision specifications be shown as hex - very
confusing.

Users are often wrong and somehow specify revisions that don't exist. Nodes
will however rarely be missing ... and they will only look like a user provided
revision specification and be all ascii in 1 of 4*10**9.

With this change, missing revisions will only be hexified if they really look
like binary nodes. This change will thus improve the error reporting UI in the
common case and only very rarely make it confusing in the opposite direction of
how it was before.
2015-10-09 01:19:37 +02:00
Pierre-Yves David
fb6955396c discovery: put trivial branch first
Having the simple and tiny branch of the conditional first help readability. The
"else" that appears after a screen of code is harder to relate to a conditional.
2015-10-12 00:45:24 -07:00
Gijs Kruitbosch
51164c44ad hgweb: remove obsolete -webkit-border-radius property 2015-10-12 14:46:51 +01:00
Anton Shestakov
0c82af3553 monoblue: add a link to the latest file revision
For reference, this was added to paper/coal in 0309017a1c71 and to gitweb in
f8b235fcf40d.
2015-10-12 15:20:04 +08:00
Pierre-Yves David
501c6cbdbc discovery: reference relevant bug in the faulty code
We extend the comment about this code flaw with more code flaw.
2015-10-09 15:44:00 -07:00
Pierre-Yves David
38aa2ec3c6 discovery: fix a typo in a comment
The idea here is that the code is imperfect, not that it is impossible to get
something behaving properly.
2015-10-09 15:37:05 -07:00
Pierre-Yves David
11cc1a1216 getsubset: get the unpacker version from the bundler
The current setup requires to pass both a packer and, optionally, the version
of the unpacker. This is confusing and error prone as the two value cannot
mismatch. Instead, we simply grab the version from the packer. This fixes a bug
where requesting a cg2 from 'hg bundle' were reported as changegroup 1.

I should have caught that in the initial changeset but I missed it somehow.
2015-10-09 14:59:37 -07:00
Matt Mackall
74b31a11a1 dirstate: batch calls to statfiles (issue4878)
This makes it more interruptible.
2015-10-06 16:26:20 -05:00
Yuya Nishihara
b1dadc9002 parsers: fix infinite loop or out-of-bound read in fm1readmarkers (issue4888)
The issue4888 was caused by 0-length obsolete marker. If msize is zero,
fm1readmarkers() never ends.

This patch adds several bound checks to fm1readmarker(). Therefore, 0-length
and invalid-size marker should be rejected.
2015-10-11 18:30:47 +09:00
Yuya Nishihara
62c0a27d40 parsers: read sizes of metadata pair of obsolete marker at once
This will make it easy to implement bound checking. Currently fm1readmarker()
has no protection for corrupted obsstore and can cause infinite loop or
out-of-bound reads.
2015-10-11 18:41:41 +09:00
Siddharth Agarwal
056b42f09f filemerge: clean up temp files in a finally block
This isn't really a big deal because the temp files are created in $TMPDIR, but
it makes some upcoming work simpler.
2015-10-07 21:51:24 -07:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Pierre-Yves David
3f7eb46ea2 discovery: rename 'error' to 'errormsg'
The variable 'error' conflict with the module name that we would like to import
and use in a coming changeset.
2015-10-05 22:29:57 -07:00
FUJIWARA Katsunori
1a4ac4179d commands: use dirstateguard instead of begin/end-parentchange for backout
Before this patch, "hg backout" uses 'begin'/'end'-'parentchange()'
of 'dirstate' class to avoid writing incomplete dirstate changes out
at failure.

But this framework doesn't work as expected, if 'dirstate.write()' is
invoked between them. In fact, in-memory dirstate changes may be
written out at 'repo.status()' implied by 'merge.update()', even
before this patch.

To restore dirstate as expected at failure of "hg backout", this patch
uses 'dirstateguard' instead of 'begin'/'end'-'parentchange()'.
2015-10-09 03:53:47 +09:00
FUJIWARA Katsunori
7d9bf405fe commands: make "hg import" use dirstateguard only for --no-commit
Previous patch made dirstate changes in a transaction scope "all or
nothing". Therefore, 'dirstateguard' is meaningless, if its scope is
as same as one of the related transaction.

Before this patch, "hg import" uses 'dirstateguard' always, but
transaction is also started if '--no-commit' isn't specified.

To avoid redundancy, this patch makes "hg import" use dirstateguard
only if transaction isn't started (= '--no-commit' is specified).

In this patch, 'if dsguard' can be examined safely, because 'dsguard'
is initialized (with None) before outermost 'try'.
2015-10-09 03:53:47 +09:00
FUJIWARA Katsunori
05986aa7a1 cmdutil: stop tryimportone from using dirstateguard (BC)
There is no user of 'cmdutil.tryimportone()' other than
'commands.import_()', which can restore dirstate at failure of
applying patches by transaction or dirstateguard.

Therefore, it is reasonable to stop 'tryimportone()' from using
redundant 'dirstateguard', even though it changes behavior of
'tryimportone()'.

After this patch, 3rd party extensions should use 'dirstateguard' or
so explicitly, if they want to restore dirstate at failure of
importing a patch.
2015-10-09 03:53:46 +09:00
FUJIWARA Katsunori
f2187903e7 dirstate: remove meaningless dirstateguard
Previous patch made dirstate changes in a transaction scope "all or
nothing". Therefore, 'dirstateguard' is meaningless, if its scope is
as same as one of the related transaction.

This patch removes such meaningless 'dirstateguard' usage.
2015-10-09 03:53:46 +09:00
FUJIWARA Katsunori
45bfdb573e localrepo: execute appropriate actions for dirstate at releasing transaction
Before this patch, in-memory dirstate changes are still kept over a
transaction scope boundary regardless of the result of it.

For "all or nothing" policy of the transaction, in-memory dirstate
changes should be:

  - written out at successful closing a transaction, because
    subsequent 'dirstate.invalidate()' can lose them

  - discarded at failure of a transaction, because outer
    'wlock.release()' or so may write them out

To discard all changes in a transaction completely, this patch also
restores '.hg/dirstate' by '.hg/journal.dirstate' at failure, because
'transaction' itself does nothing for files related to '.hg/journal.*'
in such case (therefore, renaming in this patch is safe enough).

This is a part of preparations for "transactional dirstate". See also
the wiki page below for detail about it.

    https://mercurial.selenic.com/wiki/DirstateTransactionPlan

This patch also removes redundant 'dirstate.invalidate()' just before
aborting a transaction for shelve/unshelve.
2015-10-09 03:53:46 +09:00
FUJIWARA Katsunori
47524f74ef transaction: add releasefn to notify the end of a transaction scope
'releasefn' is used by subsequent patch, to do appropriate action
according to the result of it at the end of a transaction scope.

To ensure that 'releasefn' is invoked only once, this patch invokes it
after assignment 'self.journal = None', because such assignment
prevents from invoked 'transaction._abort()' again via '__del__()'.

    def __del__(self):
        if self.journal:
            self._abort()
2015-10-09 03:53:46 +09:00
Siddharth Agarwal
4376011dff filemerge: move post-merge checks into a separate function
This makes the overall filemerge function easier to follow, and makes upcoming
work simpler.
2015-10-07 23:35:30 -07:00
Siddharth Agarwal
3fbcf75f0f filemerge._xmerge: drop no longer necessary 'if r:' check
Cleanup from an earlier patch to make premerge be directly called from the main
filemerge function.
2015-10-08 14:18:43 -07:00
Siddharth Agarwal
1cb9cb73fe filemerge._idump: drop no longer necessary 'if r:' check
Cleanup from an earlier patch to make premerge be directly called from the main
filemerge function.
2015-10-08 14:17:31 -07:00
Siddharth Agarwal
3f7b11ab57 filemerge._merge: drop no longer necessary 'if r:' check
Cleanup from an earlier patch to make premerge be directly called from the main
filemerge function.
2015-10-08 14:16:19 -07:00
Pierre-Yves David
450d49c4b8 revset: delete _updatedefaultdest as it has no users
The revset is not used anywhere anymore. We delete the function until we use
(and therefore test it again).
2015-10-05 02:33:45 -07:00
Pierre-Yves David
a92a70c3bd merge: get the default update destination from the function
There is no value in using the revset instead of the extracted function.
2015-09-28 22:11:23 -07:00
Pierre-Yves David
295091442c update: move default destination computation to a function
We ultimately want this to be accessible through a revset, but there is too
much complexity here for that to work. Especially we'll have to return more
than just the destination to control the behavior (eg: bookmarks to activate,
etc).

To prevent cycle, a new module is created, it will receive other
destination/behavior function in the future.
2015-10-05 01:46:47 -07:00
Gregory Szorc
5880e9b671 worker: restore old countcpus code (issue4869)
This is a backout of 0f1a7b0ccb69. The stdlib implementation of
multiprocessing.cpu_count() attempts to invoke a process on BSD and
Darwin platforms (at least on 2.7). Under certain conditions (such as
cwd being removed) this could raise. Our old code was silently catching
the exception.

The old code was more robust, so restore it.
2015-10-08 10:57:03 -07:00
Siddharth Agarwal
3d95b69af3 filemerge: call premerge directly from main merge function
The merge code currently does (in pseudocode):

for f in tomerge:
    premerge f
    merge f

We'd like to change this to look more like:

for f in tomerge:
    premerge f

for f in tomerge:
    merge f

This makes sure as many files are resolved as possible before prompting for the
others. This restructuring is also necessary for custom merge drivers.

This function separates out the premerge step from the merge step. In future
patches we'll actually turn these into separate steps in the merge driver.

The 'if r:' occurrences will be cleaned up in subsequent patches.
2015-10-07 21:22:16 -07:00
Durham Goode
ceec7b0056 bundle2: allow lazily acquiring the lock
In the external pushrebase extension, it is valuable to be able to do some work
without taking the lock (like running expensive hooks). This enables
significantly higher commit throughput.

This patch adds an option to lazily acquire the lock. It means that all bundle2
part handlers that require writing to the repo must first call
op.gettransction(), when in this mode.
2015-10-05 16:19:54 -07:00
Durham Goode
b5e2c4fade bundle2: add op.gettransaction() to handlers that need the lock
A future patch will allow the bundle2 lock be taken lazily. We need to
introduce transaction-gets to each handler that needs the lock.

The tests caught these issues when I added lazy locking.
2015-10-06 14:42:29 -07:00
Matt Mackall
3302d0eab4 merge with stable 2015-10-08 17:44:22 -05:00
Yuya Nishihara
3bbeb95ce8 templater: do not pre-evaluate generator keyword at runsymbol (issue4868)
It was introduced by 236440938a03, but the important code was removed by
fcf2407610f4. So there was no positive effect other than exhausting memory.

The problem spotted by 236440938a03 is that you can't use a generator keyword
more than once. For example, in hgweb template, "{child} {child}" doesn't work
because the first "{child}" consumes the generator. But as fcf2407610f4 says,
the fix was wrong because it could overwrite a callable keyword that returns
a generator. Also the fix didn't work for a generator of generator such as
"{diff}" keyword. So, the proper fix for that problem would be to not put
a generator in a keyword table. Instead, it should be a factory of a generator.

Note that this should fix the memory issue in hgweb, but my firefox killed by
OOM in place. Be careful to not use a modern web browser to test the issue4868.
2015-10-08 23:24:38 +09:00
Matt Harbison
16d4ee35c6 templater: protect word() from crashing on out of range negative value
The function isn't documented to work with negative values at all, but it does,
which can be useful.  However, the range check didn't account for this.
2015-10-05 12:37:26 -04:00
Pierre-Yves David
e5e36f8235 import: allow processing of extra part header after import
As we have a way for extension to add more header, we need a way for them to
actually process them. We add a basic hook point to do extra work after the
import have been committed.
2015-10-07 13:05:25 -07:00
Pierre-Yves David
684d4c614d import: allow processing of extra part header during import
As we have a way for extension to add more header, we need a way for them to
actually process them. We add a basic hook points to alter the changeset
(especially extra) before we commit. There would be more to do for a full
featured hooking, but this currently fit my needs.
2015-10-06 09:51:24 -07:00
Pierre-Yves David
240fce0b19 extract: parse 'nodeid' using the generic mechanism
Parsing 'nodeid' is very simple and a good first test.
2015-10-06 02:23:21 -07:00
Pierre-Yves David
6eaa931821 extract: parse 'branch' using the generic mechanism
Parsing 'branch' is very simple and a good first test.
2015-10-06 02:22:23 -07:00
Pierre-Yves David
2602f6923f extract: parse 'date' using the generic mechanism
Parsing 'date' is very simple and a good first test.
2015-10-07 01:13:36 -07:00
Pierre-Yves David
4ae623122e extract: add some facility for extensible header parsing
We need a way for extension to extend the header we can parse. We start with a
very simple mechanism that will be used in the next changeset.
2015-10-07 01:20:49 -07:00
Pierre-Yves David
b85c4695a2 extract: remove the 'user' variable
It is not heavily used enough to justify being something other than a
dictionary entry.
2015-10-06 02:16:24 -07:00
Pierre-Yves David
1f322a05ad extract: use a single return
The differences between both returns are now very thin, we factor out
that part.
2015-10-06 02:11:09 -07:00
Pierre-Yves David
159f2b3f21 extract: move 'nodeid' assignment where it is parsed
The is one setter and no consumer, we can move it there directly.
2015-10-07 00:50:53 -07:00
Pierre-Yves David
b6f2794f84 extract: move 'date' assignment where it is parsed
There is one setter and no consumer, we can move it there directly.
2015-10-06 02:08:32 -07:00
Pierre-Yves David
6386f9c739 extract: assign user to 'data' earlier
This is used in both case, we can assign it once.
2015-10-06 02:07:33 -07:00
Pierre-Yves David
cf6731af5a extract: move 'branch' assignment where it is parsed
There is one setter and no consumer, we can move it there directly.
2015-10-06 02:06:36 -07:00
Pierre-Yves David
43416c9684 extract: directly assign parent to data dictionary
The temporary variables are not adding anything.
2015-10-06 02:05:56 -07:00
Pierre-Yves David
3351bc88a4 extract: assign message only once
This return is shared between the two cases. We can move it earlier.
2015-10-06 02:04:46 -07:00
Pierre-Yves David
ab23538b10 extract: simplify parents assignement
We move to the more standard style of:

  value = default
  if special:
      value = other

This is more consistent and compact.
2015-10-06 02:04:06 -07:00
Pierre-Yves David
ec1d4cc8b3 patch: move 'extract' return to a dictionnary
The final goal here is to be able to parse, return and process arbitrary data
from patch. This mirror the recently added ability to add arbitrary data to
patch headers.

The first step is to return something more flexible, so we return a dict without
changing any other logic.
2015-10-06 02:01:53 -07:00
Pierre-Yves David
d6432f70b8 export: introduce a generic way to add patch header on export
Extensions currently have no easy way to add data to exported
patch. This is now fixed using a generic mechanism in the same fashion
used by bundle2. Tests are coming in the next changeset with its first
user.
2015-10-05 23:17:01 -07:00
Pierre-Yves David
3ff87b1cf4 incoming: request a bundle2 when possible (BC)
Incoming was using bundle1 in all cases, as bundle1 is restricted to
changegroup1 and does not support general delta, this can lead to significant
CPU overhead if the server is using general delta storage. We now properly
request and store a bundle2 to disk.

If the server include any output or error in the bundle, they will be stored on
disk and replayed when the bundle is read. As 'hg incoming' is going to read the
bundle right away, we call that 'good' enough and go back to the bigger plan of
having general delta on by default.

This was tracked as 4864
2015-10-05 00:23:20 -07:00
Pierre-Yves David
1bff95dea7 bundlerepo: indent some code to prepare next patch
We are about to add a new condition. Code is indented in a separated patch for
readability.
2015-10-05 00:18:11 -07:00
Pierre-Yves David
84d5d1a440 bundle2: add a way to just forward the bundle2 stream to another user
There is use case for directly forward and bundle2 stream from the peer to a
file (eg: 'hg incoming --bundle'), However ssh peers have no way to know the
'getbundle' is over except for actually interpreting the bundle. So we need to
have the unbundle do the interpreting and forward job.

The function is marked as private to highlight that this is terrible and that we
are sorry.
2015-10-08 01:40:21 -07:00
Pierre-Yves David
9cadff52d0 bundle2: split parameter retrieval and processing
We want to introduce a simple way to forward the content of a bundle2 stream.
For this purpose, we will need to both yield the parameters block and process it
(to apply any behavior change it might indicate).
2015-10-05 01:10:49 -07:00
Pierre-Yves David
ad2caca390 changegroup: extract the file management part in its own function
The current writebundle function do two things:

- taking a changegroup-packer instance and storing it into a valid bundle with
  proper header.

- creating a temporary or requested file to store that bundle

We would like to make it easier to forward bundle stream directly from a remote
peer to a file, so we split the two logic to be able to skip the one about
building a valid bundle (the remote is already sending one).
2015-10-05 00:14:47 -07:00
Pierre-Yves David
96f8937e86 unbundle: properly read head modification result from bundle2
We were reading the wrong key...
2015-10-04 21:48:19 -07:00
Yuya Nishihara
e482010d79 revset: strip off "literal:" prefix from bookmark not found error
This is what branch() and tag() do.
2015-10-07 23:04:31 +09:00
Yuya Nishihara
af229fbc94 revset: do not fall through to revspec for literal: branch (issue4838)
If "literal:" is specified, it must not be a revset expression. It should
error out with a better message.
2015-10-07 23:00:29 +09:00
Gijs Kruitbosch
92cf6734a1 hgweb: ensure both foreground and background colors are specified (issue4872)
When users configure the default foreground or background color to
non-default (black on white) values, several hgweb styles lack
contrast for headers and table row items. This patch fixes that by
ensuring that where either foreground or background colors are
specified, both are specified.
2015-10-07 21:08:14 +01:00
Pierre-Yves David
24004c0b3e merge: drop special parent assignment in the obsolete case
We can safely drop this because the very same assignment is enforcement later in
the function. Dropping it will make it simpler to extract the default
destination logic in its own function.
2015-10-05 01:47:33 -07:00
Pierre-Yves David
232a6cb371 bundle: use bundle2 if repository uses general delta
As bundle1 does not support generaldelta, this would mean recomputing delta at
bundle time. This is similar to what we do for strip and shelve and was tracked
as issue4865.
2015-10-01 20:31:43 -07:00
Pierre-Yves David
f1e9601240 parsebundletype: add a comment for future generation 2015-10-01 20:21:16 -07:00
Pierre-Yves David
8f390ad0b6 bundle: extend the format of --type to support version and compression
We had some basic undocumented support for uncompressed bundle2 support. We now
have an official extensible syntax to specify both format type and compression
(eg: bzip2-v2).

In practice, this changeset introduce the 'v1' and 'v2' identifier to make it
possible to combine format and compression. The default format is still 'v1'.
We'll care about picking 'v1' or 'v2' in regard with general delta in the next
changesets.
2015-10-01 19:16:00 -07:00
Gijs Kruitbosch
5b5d0b9759 hgweb: fix border-radius for standards-based browsers
While here, remove an old gecko-specific property, as gecko has
supported the unprefixed version for many years.
2015-10-07 20:19:20 +01:00
Siddharth Agarwal
1f3c72862f filemerge: move precheck to before files are written out
This is much simpler, and also avoids unnecessary disk IO.
2015-10-07 21:28:43 -07:00
Siddharth Agarwal
545f983ef8 filemerge: move 'merging' output to before file creation
This has no visible impact but makes some future work simpler.
2015-10-07 22:58:52 -07:00
Siddharth Agarwal
7ea14fa915 filemerge.filemerge: make a tuple containing merge paths on disk
We're going to need this same tuple elsewhere.
2015-10-07 21:21:56 -07:00
Siddharth Agarwal
6b1725d26f filemerge: switch trymerge boolean to mergetype enum
trymerge = False becomes mergetype = nomerge, and trymerge = True becomes
mergetype = fullmerge or mergeonly, depending on whether a premerge happens.
2015-10-07 16:14:57 -07:00
Siddharth Agarwal
36f6f22a1e filemerge: add some merge types
We're going to turn the 'trymerge' boolean into a 'mergetype' enum with these
three possible values.
2015-10-07 15:13:41 -07:00
FUJIWARA Katsunori
0602f8209b dirstate: split write to write changes into files other than .hg/dirstate
'_writedirstate()' is used mainly for "transactional dirstate". See
the wiki page below for detail about it.

    https://mercurial.selenic.com/wiki/DirstateTransactionPlan
2015-10-08 01:41:30 +09:00
FUJIWARA Katsunori
5b79d1f206 bookmarks: use recordchange instead of writing if transaction is active
Before this patch, 'bmstore.write()' always write in-memory bookmark
changes into '.hg/bookmarks' regardless of transaction activity.

If 'bmstore.write()' is invoked inside a transaction and it writes
changes into '.hg/bookmarks', then:

  - original bookmarks aren't restored at failure of that transaction

    This breaks "all or nothing" policy of the transaction.

    BTW, "hg rollback" can restore bookmarks successfully even before
    this patch, because original bookmarks are saved into
    '.hg/journal.bookmarks' at the beginning of the transaction, and
    it (actually renamed as '.hg/undo.bookmarks') is used by "hg
    rollback".

  - uncommitted bookmark changes are visible to other processes

    This is a kind of "dirty read"

For example, 'rebase.rebase()' implies 'bmstore.write()', and it may
be executed inside the transaction of "hg unshelve". Then, intentional
aborting at the end of "hg unshelve" transaction doesn't restore
original bookmarks (this is obviously a bug).

This patch uses 'bmstore.recordchange()' instead of actual writing by
'bmstore._writerepo()', if any transaction is active

This patch also removes meaningless restoring bmstore explicitly at
the end of "hg shelve".

This patch doesn't choose fixing each 'bmstore.write()' callers as
like below, because writing similar code here and there is very
redundant.

  before:
    bmstore.write()

  after:
    tr = repo.currenttransaction()
    if tr:
        bmstore.recordchange(tr)
    else:
        bmstore.write()

Even though 'bmstore.write()' itself may have to be discarded by
putting bookmark operations into transaction scope, this patch chose
fixing it to implement "transactional dirstate" at first.
2015-10-08 01:41:30 +09:00
Siddharth Agarwal
dbdf9ec262 filemerge: run symlink check for :merge3
Just like :merge, :merge3 doesn't support merging symlinks.
2015-10-07 00:27:23 -07:00
Siddharth Agarwal
bedfe886f8 filemerge: print correct name of tool for symlink checks
Earlier we'd print ':merge' even if the tool was something else like ':union'.
That's clearly a bug.
2015-10-07 00:24:44 -07:00
Siddharth Agarwal
30c73e4dd2 filemerge: normalize 'internal:foo' names to ':foo'
In upcoming patches we're going to present these names in the UI -- it would be
good not to present deprecated names.
2015-10-07 00:01:16 -07:00
Siddharth Agarwal
aef73939f9 filemerge: use symlinkcheck for :merge and :union
This exposes a couple of bugs, both of which will be fixed in upcoming patches.
2015-10-06 22:57:21 -07:00
Siddharth Agarwal
258f79e559 filemerge: add a precheck for symlinks
This will be used by internal merge tools.
2015-10-06 22:56:33 -07:00
Siddharth Agarwal
11ffaa85a2 filemerge: call precheck if available
In upcoming patches we'll define a precheck function for some merge tools.
2015-10-06 22:55:21 -07:00
Siddharth Agarwal
3226585b5b filemerge: add a before-merge callback to internal merge tools
We're going to separate the pre-merge and merge steps for merge tools. The
merge step will be specific to the tool, but the pre-merge step will be common
to all merge tools that need it.

However, some merge tools run checks *before* the pre-merge step. This callback
will allow that to continue to work.
2015-10-06 22:54:14 -07:00
Siddharth Agarwal
6e9048d788 filemerge: indent filemerge.filemerge
This will make upcoming patches much easier to review.
2015-10-06 17:39:13 -07:00
Pierre-Yves David
63b3b90838 bundle: extract the parsing of the bundle type in a function
We are going to introduce significant extensions of the bundle parsing code to
support creation of bundle2 through the bundle command. As an early step, we
extract the logic in its own function.
2015-10-01 18:01:24 -07:00
Pierre-Yves David
52f209c327 changegroup: add version argument to getchangegroup
For some obscure reasons (probably upsetting a Greek goddess),
getchangegroup did not had a 'version' argument to control the changegroup
version. We fixes this to allow cg02 to be used with 'hg bundle' in the future.
2015-10-01 19:14:47 -07:00
Pierre-Yves David
905bd41a77 changegroup: add version argument to getlocalchangegroup
For some obscure reasons (probably upsetting a Greek goddess),
getlocalchangegroup did not have a 'version' argument to control the
changegroup version. We fix this to allow cg02 to be used with 'hg
bundle' in the future.
2015-10-01 19:14:33 -07:00
Matt Mackall
86f1841884 merge with stable 2015-10-07 13:44:48 -05:00
Siddharth Agarwal
39cdc4468e commands: add a new debug command to print merge state
We're going to be extending the merge state very soon, and this will give us a
way to test all that.
2015-10-02 13:00:47 -07:00
Siddharth Agarwal
7c5424c31f merge.mergestate: factor out code to validate v1/v2 records
We're going to need this in another place in upcoming patches.
2015-09-30 21:22:31 -07:00
Siddharth Agarwal
b91b05d624 localrepo: prevent wlock from being inherited when a transaction is running
Review feedback from Pierre-Yves David. A separate line of work is working to
ensure that dirstate writes are written to a separate 'pending' file while a
transaction is active. Lock inheritance currently conflicts with that, so dodge
the issue by simply preventing inheritance while a transaction is running.

Custom merge drivers aren't going to run inside a transaction, so this doesn't
affect that.
2015-10-06 13:19:05 -07:00
Siddharth Agarwal
eb9c8405ac lock: add a way to prevent locks from being inherited
We want to prevent locks from being inherited sometimes (e.g. when there's a
currently running transaction, which will break a lot of assumptions we're
making in here.)
2015-10-06 13:13:31 -07:00
Yuya Nishihara
5715ebc02c util: use tuple accessor to get accurate st_mtime value (issue4836)
Because st.st_mtime is computed as 'sec + 1e-9 * nsec' and double is too narrow
to represent nanoseconds, int(st.st_mtime) can be 'sec + 1'. Therefore, that
value could be different from the one got by osutils.listdir().

This patch fixes the problem by accessing to raw st_mtime by tuple index.

It catches TypeError to fall back to st.st_mtime because our osutil.stat does
not support tuple index. In dirstate.normal(), 'st' is always a Python stat,
but in dirstate.status(), it can be either a Python stat or an osutil.stat.

Thanks to vgatien-baron@janestreet.com for finding the root cause of this
subtle problem.
2015-10-04 22:35:36 +09:00
Yuya Nishihara
ea5724ad42 util: extract stub function to get mtime with second accuracy
This function is trivial but will need a long comment why it can't use
st.st_mtime. See the next patch for details.
2015-10-04 22:25:29 +09:00
Siddharth Agarwal
18a026d1a8 scmutil: add a way for a repo's wlock to be inherited by a subprocess
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances.

In the future, we'll call this for custom merge drivers.
2015-10-05 14:37:59 -07:00
Siddharth Agarwal
2357094a49 scmutil: add a way for a subprocess to be run with an inheritable lock
This is part of a series that will allow locks to be inherited by subprocesses
in limited circumstances.

In an upcoming patch, we'll add an API for the wlock to be inherited.
2015-10-05 14:34:52 -07:00
Siddharth Agarwal
faa305db27 localrepo: add a way to get the current wlock if it's held
This will be useful to pass around a reference to the lock to some functions
we're going to add to scmutil. We don't want those functions to live in
localrepo to avoid bloat.
2015-10-05 14:27:37 -07:00
Siddharth Agarwal
02ed78a388 localrepo: add a way to get the current lock if it's held
We'll use this in upcoming patches to return a reference to the wlock if it's
held.
2015-10-05 14:26:53 -07:00
Yuya Nishihara
4ffbdfca20 localrepo: recreate phasecache if changelog was modified (issue4855)
Because _phaserevs and _phasesets cache revision numbers, they must be
invalidated if there are new commits or stripped revisions. We could do
that by calling _phasecache.invalidate(), but it wasn't simple to be
integrated with the filecache mechanism.

So for now, phasecache will be recreated after repo.invalidate() if
00changelog.i was modified before.
2015-09-29 21:57:08 +09:00