Commit Graph

5268 Commits

Author SHA1 Message Date
Mateusz Kwapich
5cf03a9c5a histedit: remove makedesc
It's a dead code now.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
574ed39bd6 histedit: use torule instead of makedesc in ruleeditor 2015-12-02 12:19:01 -08:00
Mateusz Kwapich
644cc338bd histedit: add torule method to histedit action objects
To make histedit action objects responsible for understanding
the format of their action lines we are adding a torule method
which for a histedit action will return a string which can be
saved in histedit state or shown in text editor when editing the
plan.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
278e9a38b4 histedit: add verify() to histeditaction
This commits splits the parsing of the histedit rule from its semantic analysis.
It's necessary because sometimes we want to do first without doing the former (reading the
histedit state).
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
29346eb944 histedit: add addhisteditaction decorator
This decorator will is allowing us to move the registering the action
in actiontable closer to the action code. Also it is storing the
verb inside histedit action so the action is aware of the verb
needed to trigger it.
2015-12-02 12:19:01 -08:00
Mateusz Kwapich
122e188cce histedit: add actions property to histedit state
I want to refactor histedit to use action objects instead of (verb, rest)
pairs whenever possible. At the end of this series I want the rules to
be translated into action objects when reading state and translated back
when writing state. All histedit internals should use action objects instead
of state rules.

To migrate histedti internals sequentially I'm introducing the state.actions
property to translate rules on the fly so we can use both state.actions and
state.rules until refactoring is done.
2015-12-02 12:19:01 -08:00
FUJIWARA Katsunori
fc6772c5fc shelve: execute checkunfinished inside wlock scope
Before this patch, "hg shelve" of shelve extension executes
'cmdutil.checkunfinished()' before acquisition of wlock.

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch executes 'cmdutil.checkunfinished()'
inside wlock scope of "hg shelve".

This also fixes issue4957, because now 'cmdutil.checkunfinished()'
isn't invoked at "hg shelve" with options below:

  --cleanup
  --delete
  --list
  --patch
  --stat
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
157a86fc91 shelve: widen wlock scope of shelve for consistency while processing
Before this patch, "hg shelve" of shelve extension executes/refers
below before acquisition of wlock:

  - 'repo.dirstate.parents()' via 'repo[None].parents()'
  - 'repo._activebookmark'

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

This patch widens wlock scope of "hg shelve" of shelve extension for
consistency while processing.
2015-12-02 03:12:08 +09:00
FUJIWARA Katsunori
f05ee67a9f gpg: make sign acquire wlock before processing
Before this patch, "hg sign" of gpg extension executes/evaluates below
without acquisition of wlock.

  - repo.dirstate.parents()
  - '.hgsigs' not in repo.dirstate

It may cause unintentional result, if another command runs parallelly
(see also issue4368).

To avoid this issue, this patch makes "hg sign" of gpg extension
acquire wlock before processing.
2015-12-02 03:12:08 +09:00
Augie Fackler
c6a7c82c31 bookmarks: hoist getbkfile out of bmstore class
It's totally fine that this hook exists, but I don't see a need for it
to live inside the bmstore class.
2015-11-11 20:45:38 -05:00
timeless
787afdd271 histedit: mention histedit-last-edit.txt on abort
Users may spend a lot of effort writing histedit rules,
getting an abort without being told they can recover their work
is very frustrating.

Avoid that by telling them where to find their work.
2015-12-02 08:07:36 +00:00
timeless
40357ef4f4 histedit: add missing raise keyword to statement 2015-12-02 07:40:42 +00:00
timeless
139b830297 histedit: improve grammar for _histedit comment 2015-12-02 07:39:49 +00:00
Augie Fackler
840125d439 commands: inline definition of localrepo.parents() and drop the method (API)
localrepo.parents() has relatively few users, and most of those were
actually implicitly looking at the wctx, which is now made explicit
via repo[None].
2015-11-11 20:07:15 -05:00
Mykola Nikishov
0ee9a8cf79 histedit: edit with custom filename
For instance, Emacs allows to open file with special features enabled
(AKA mode) based on the path/name of the file [1]. For such cases, use
'hg-histedit-XXX.txt' as filename pattern.

[1] https://www.gnu.org/software/emacs/manual/html_node/emacs/Choosing-Modes.html
2015-11-21 17:40:26 +02:00
timeless
9b00c9388a patchbomb: rename email function
I see no reason for the function not to be email ...
2015-11-29 06:51:23 +00:00
timeless
dfb7d692a0 graphlog: rename glog function
I see no reason for the function not to be glog ...
2015-11-29 06:51:23 +00:00
Mike Edgar
8d4be9cc8f rebase: propagate extra dict from rebase source changeset
This corrects extra propagation for the rebase command and the shelve command.
2015-11-28 04:11:14 -05:00
Mathias De Maré
bbe157b7e0 histedit: add examples 2015-11-25 18:26:48 +01:00
timeless
e4b7c3bfda pager: improve help for --pager=
try to clarify how to enable/disable the pager
2015-11-30 18:47:33 +00:00
timeless
0ab681f781 gpg: rename sigcheck function
I see no reason for the function not to be sigcheck ...
2015-11-25 06:10:54 +00:00
Augie Fackler
dafe189e47 extensions: properly mark progress as part of core
This should have been done as part of or as an immediate follow-up to
01b01d59e33f, but presumably this feature of extensions.py was
forgotten at that time.
2015-11-24 18:40:16 -05:00
Gregory Szorc
d84af347c4 ui: avoid needless casting to a str
In many cases, we don't need to cast to a str because the object will
be cast when it is eventually written.

As part of testing this, I added some code to raise exceptions when a
non-str was passed in and wasn't able to trigger it. i.e. we're already
passing str into this function everywhere, so the casting isn't
necessary.
2015-11-22 14:44:55 -08:00
Gregory Szorc
b184853d7f ui: remove labeled argument from popbuffer
It was moved to pushbuffer and currently does nothing.
2015-11-24 11:23:10 -08:00
Gregory Szorc
d3425fdff9 color: evaluate labels at write time
Previously, we stored 2-tuples of text and label in a list and then
evaluated the labels when the buffer was popped. After this patch,
we evaluate the labels at write time and do a simple join when the
buffer is popped.

This patch appears to have no impact on performance, despite creating
fewer 2-tuples and having fewer strings hanging around in memory.
2015-11-22 14:18:42 -08:00
Siddharth Agarwal
51f583c35b shelve: use colon instead of quotes in 'changes to' description
If detailed conflict markers are enabled and the closing quote gets truncated,
editors will often screw syntax highlighting up from that point because they'll
see an opening quote and think it's the beginning of a string.

In tests, the hashes change because the commit messages of the shelved bundles
also change.
2015-11-22 21:40:23 -08:00
Augie Fackler
18e5d950ee histedit: constant-ify the constraints list
Used a class as a namespace, and then wired up a classmethod to return
all known constraints. I'm mostly happy with this, even though it's
kind of weird for hg.
2015-11-23 10:13:05 -05:00
Mateusz Kwapich
60093bd539 histedit: add an experimental base action
This is a first (very simple) version of the histedit base action.
It works well in common usecases like rebasing the whole stack and
spliting the stack.

I don't see any obvious edge cases - but probably there is more than one.
That's why I want to keep it behind experimental.histeditng config knob
for now. I think on knob for all new histedit behaviors is better because
we will test all of them together and testers will need to turn it on only
once to get all new nice things.
2015-11-17 15:04:31 -08:00
Mateusz Kwapich
0e2838b3e0 histedit: add abortdirty function
Small helper function for aborting histedit when left with dirty working
directory.
2015-11-17 17:53:52 -08:00
Mateusz Kwapich
0cd6ba356d histedit: add forceother constraint
For the future 'base' action in histedit we need a verification
constraint which will not allow using this action with changes
that are currently edited.
2015-11-12 16:40:33 -08:00
Mateusz Kwapich
45af8348f7 histedit: make verification configurable
Before we can add a 'base' action to histedit need to change verification
so that action can specify which steps of verification should run for it.

Also it's everything we need for the exec and stop actions implementation.

I thought about baking verification into each histedit action (so each
of them is responsible for verifying its constraints) but it felt wrong
because:
 - every action would need to know its context (eg. the list of all other
   actions)
 - a lot of duplicated work will be added - each action will iterate through
   all others
 - the steps of the verification would need to be extracted and named anyway
   in order to be reused

The verifyrules function grows too big now. I plan to refator it in one of
the next series.
2015-11-17 16:37:26 -08:00
Laurent Charignon
b6a3739c99 rebase: use bookmarks.recordchange instead of bookmarks.write
Before this patch we were using the old api bookmarks.write instead of
bookmarks.recordchange at the end of rebase operations.
We move clearstatus within the transaction to make it easier for extensions
that wrap transactions operations.
2015-11-20 14:06:31 -08:00
Laurent Charignon
bd889a16a7 rebase: indentation change to make the next patch more legible
We put the code to be indented in the next patch in a "if True:" block to make
it easier to review.
2015-11-20 11:36:05 -08:00
Laurent Charignon
d3b83d4e8c strip: use repo._bookmarks.recordchange instead of repo._bookmarks.write
Before this patch, strip was using repo._bookmarks.write.
This patch replaces this code with the recommended way of saving bookmarks
changes: repo._bookmarks.recordchange.
2015-11-20 13:46:36 -08:00
Laurent Charignon
8ace80e21d histedit: make use of bookmarks.recordchange instead of bookmarks.write
Before this patch we were using the old api bookmarks.write, this patches
replaces its usage by bookmarks.recordchange, the new api to record bookmark
changes.
2015-11-20 13:23:47 -08:00
Siddharth Agarwal
f5d6c8e713 largefiles: fall back to the original for change/delete conflicts
The largefiles merge code (currently) does not handle change/delete conflicts.
So fall back to regular filemerge in that case.

Making this code handle change/delete conflicts is left as an exercise for the
future.
2015-11-18 17:40:13 -08:00
Siddharth Agarwal
4904ded295 filemerge: return whether the file was deleted
This is required for change/delete conflict resolution -- see previous patches
for more details.
2015-11-18 14:22:52 -08:00
Shubhanshu Agrawal
caf17cd48e strip: changing bookmark argument to be a list
Currently strip works with a single bookmark,
the changes in this patch modifies the strip
extension to accept a list of bookmarks
2015-11-19 12:50:10 +05:30
Shubhanshu Agrawal
64e100e7aa strip: strip a list of bookmarks
Currently strip works with a single bookmark,
the changes in this patch modifies the strip module
to work with a list of bookmarks

Building on this we can take a list of bookmarks as input
and remove all of them in a single go
2015-11-15 21:03:44 +05:30
Siddharth Agarwal
ad963d1bec unshelve: add support for custom merge tools
For parity with merge --tool, rebase --tool etc.

rebase.rebase overwrites the tool in repo.ui, so we need to explicitly pass it
down there too.
2015-11-18 15:11:23 -08:00
Siddharth Agarwal
4f4370437e unshelve: shed spurious space 2015-11-18 15:18:16 -08:00
Siddharth Agarwal
a77766bbfd unshelve: add -k as short form of --keep
For parity with strip -k, rebase -k, etc.
2015-11-18 15:04:03 -08:00
Laurent Charignon
4840174abf rebase: refactoring to avoid repetition of expression
This patch removes the repetition of "(revignored, revprecursor, revpruned)"
and replaces its occurences with the more legible "revskipped".
2015-11-18 15:58:06 -08:00
Laurent Charignon
550f1e2875 rebase: remove an unused todo
Since we handled skipping obsolete revs when it is relevant, this todo is no
longer useful. We replace the comment with two useful comments.
2015-11-18 16:06:00 -08:00
Laurent Charignon
e24d860326 rebase: don't rebase obsolete commits with no successor
This patch avoids unnecessary conflicts to resolve during rebase for the users
of changeset evolution.

This patch modifies rebase to skip obsolete commits with no successor.
It introduces a new rebase state 'revpruned' for these revisions that are
being skipped and a new message to inform the user of what is happening.
This feature is gated behind the config flag experimental.rebaseskipobsolete

When an obsolete commit is skipped, the output is:
note: not rebasing 7:360bbaa7d3ce "O", it has no successor
2015-11-18 13:44:29 -08:00
Matt Mackall
a20ef0162d merge with stable 2015-11-18 20:59:17 -06:00
Laurent Charignon
f10bca562d mq: use repo._bookmarks.recordchange instead of repo._bookmarks.write
Before this patch, mq was using repo._bookmarks.write.
This patch replaces this code with the recommended way of saving bookmarks
changes: repo._bookmarks.recordchange.
2015-11-17 13:12:33 -08:00
Laurent Charignon
57a4bf9ef8 mq: indentation change to make the next patch more legible
We put the code to be indented in the next patch in a "if True:" block to make
it easier to review.
2015-11-17 13:12:46 -08:00
Siddharth Agarwal
2e12a97859 shelve: switch to mergestate.read()
See previous patches for why we're doing this.
2015-11-17 13:56:10 -08:00
Siddharth Agarwal
bb9f482112 strip: switch to mergestate.clean()
See the previous patches for why we're doing this.
2015-11-17 17:02:35 -08:00
liscju
8a47b8ef21 histedit: extracts _isdirtywc function
Checking if working copy is dirty was done in few places, this
patch extracts it in _isdirtywc procedure.
2015-11-12 12:44:15 +01:00
Laurent Charignon
ffb03a1de7 convert: use repo._bookmarks.recordchange instead of repo._bookmarks.write
Before this patch, convert was using repo._bookmarks.write, a deprecated API
for saving bookmarks.
This patch changes the use of repo._bookmarks.write to
repo._bookmarks.recordchange.
2015-11-16 17:15:36 -08:00
Laurent Charignon
581136b55b convert: indentation change to make the next patch more legible
We put the code to be indented in the next patch in a "if True:" block to make
it easier to review.
2015-11-16 17:14:15 -08:00
Shubhanshu Agrawal
7e59c6e5d1 strip: renaming local variables
Renaming local variables to be more precise, i want to store
a different list of bookmarks and it would be hard to
understand what marks represents in that change therefore
renaming it to repomarks. Renamed bookmarks(module)
to bookmarksmod as to free up bookmarks which will be
used when pluralizing bookmark.
2015-11-15 20:27:27 +05:30
Mads Kiilerich
ccf61891e6 mq: generate patch names from first line of description
Avoid the pointless numeric rev.diff patch names.

Instead, do like mbox extension does and create meaningful patch names.
2015-03-10 13:19:17 +01:00
Pierre-Yves David
972436d679 rebase: rename and test '_destrebase'
We make the name consistent with the other similar revsets and make sure it has
minimal tests.
2015-10-15 01:56:03 +01:00
Pierre-Yves David
4a4b12d369 rebase: directly use '_destrebase'
There is little value in using the revset instead of the function.
2015-10-15 01:51:53 +01:00
Pierre-Yves David
1ac31ad0a1 rebase: extra default destination in its own function
This makes it much simple to wrap for other extension.
2015-10-15 01:50:31 +01:00
Augie Fackler
cb2b7df9f2 shelve: use cg?unpacker.apply() instead of changegroup.addchangegroup() 2015-10-13 17:11:18 -04:00
Augie Fackler
f53d137cd7 histedit: use cg?unpacker.apply() instead of changegroup.addchangegroup() 2015-10-13 17:14:21 -04:00
Gregory Szorc
15ac94d01f clonebundles: advertise clone bundles feature to clients
Server operators that have enabled clone bundles probably want clients
to use it. This patch introduces a feature that will insert a bundle2
"output" part that advertises the existence of the clone bundles
feature to clients that aren't using it.

The server uses the "cbattempted" argument to "getbundle" to determine
whether a client supports clone bundles and to avoid sending the message
to clients that failed the clone bundle for whatever reason.
2015-10-14 11:05:53 -07:00
Christian Delahousse
59c67e69d3 shelve: delete shelve statefile on any exception during abort
When a user's repository is in an unfinished unshelve state and they choose to
abort, at a minimum, the repo should be out of that state. We've found
situations where the user could not leave the state unless manually deleting the
state file. This fix ensures that no matter what exception may be raised during
the abort, the shelved state file will be deleted, the user will be out of the
unshelve state and they can get their repository into a workable condition.
2015-10-14 20:35:06 -07:00
Gregory Szorc
c20551dc4f highlight: add option to prevent content-only based fallback
When Mozilla enabled Pygments on hg.mozilla.org, we got a lot of weirdly
colorized files. Upon further investigation, the hightlight extension
is first attempting a filename+content based match then falling back to a
purely content-driven detection mode in Pygments. Sounds good in theory.

Unfortunately, Pygments' content-driven detection establishes no minimum
threshold for returning a lexer. Furthermore, the detection code for
a number of languages is very liberal. For example, ActionScript 3 will
return a confidence of 0.3 (out of 1.0) if the first 1k of the file
we pass in matches the regex "\w+\s*:\s*\w"! Python matches on
"import ". It's no coincidence that a number of our extension-less files
were getting highlighted improperly.

This patch adds an option to have the highlighter not fall back to
purely content-based detection when filename+content detection failed.
This can be enabled to render unlighted text instead of taking the risk
that unknown file types are highlighted incorrectly. The old behavior is
still the default.
2015-10-14 18:22:16 -07:00
Gregory Szorc
8482c8a951 highlight: inline checkfctx()
It is only used once. pygmentize() is pretty small. Let's just inline
it.
2015-10-14 17:43:44 -07:00
Gregory Szorc
b5463251e9 highlight: consolidate duplicate code
I'm adding some logic in a future patch and this will make it so I only
have to add it once.
2015-10-14 17:42:07 -07:00
Christian Delahousse
3e8e422089 rebase: properly abort when destination is public (issue4896)
After rebasing a set of changes onto a public changeset and having the first one
be skipped, if you try to abort, the operation fails. This fix adds a check to
disallow the target rev into the dstates list within the abort function. This
list is checked for immutable states before the rest of abort does its thing.
2015-10-13 14:06:51 -07:00
Pierre-Yves David
d7f7b508bd rebase: properly handle chains of markers with missing nodes
As obsolescence markers can contains unknown nodes and 'allsuccessors' returns
them, we have to protect again that when looking for successors of the rebase
set in the destination.

Test have been expanded to catch that.
2015-10-15 00:32:20 +01:00
Pierre-Yves David
f0d9f208d1 rebase: use a direct reference to repo.changelog
Accessing 'repo.changelog' have a small overhead because we double check that the
filtering did not changed. As we make multiple use of this into loops, we should
avoid doing the lookup/check every time. This also make the code tidier.
2015-10-14 23:42:15 +01:00
Ryan McElroy
60f893df56 rebase: factor out nothing to rebase return code
A rebase call that results in nothing to rebase might be considered successful
in some contexts. This factors out the return code from places where hg
determines that there is nothing to rebase, so an extenion might change this
return code to be something that would allow scripts to run without seeing this
as an error.
2015-10-13 03:20:05 -07:00
Christian Delahousse
eac53b6308 rebase: added comments
Added comments describing the state variable and constants used throughout the
rebase extension
2015-10-13 14:17:15 -07:00
Matt Mackall
d893847a13 mq: use cmdutil.revert instead of hg.revert
It's the last user.
2015-10-12 03:37:09 -05:00
Gregory Szorc
7f6305218b clonebundles: filter on SNI requirement
Server Name Indication (SNI) is commonly used in CDNs and other hosted
environments. Unfortunately, Python <2.7.9 does not support SNI and when
these older Python versions attempt to negotiate TLS to an SNI server,
they raise an opaque error like
"_ssl.c:507: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert
handshake failure."

We introduce a manifest attribute to denote the URL requires SNI and
have clients without SNI support filter these entries.
2015-10-13 10:59:41 -07:00
Gregory Szorc
11b70bd7bb clonebundles: filter on bundle specification
Not all clients are capable of reading every bundle. Currently, content
negotiation to ensure a server sends a client a compatible bundle
format is performed at request time. The response bundle is dynamically
generated at request time, so this works fine.

Clone bundles are statically generated *before* the request. This means
that a modern server could produce bundles that a legacy client isn't
capable of reading. Without some kind of "type hint" in the clone
bundles manifest, a client may attempt to download an incompatible
bundle. Furthermore, a client may not realize a bundle is incompatible
until it has processed part of the bundle (imagine consuming a 1 GB
changegroup bundle2 part only to discover the bundle2 part afterwards is
incompatibl). This would waste time and resources. And it isn't very
user friendly.

Clone bundle manifests thus need to advertise the *exact* format of the
hosted bundles so clients may filter out entries that they don't know
how to read. This patch introduces that mechanism.

We introduce the BUNDLESPEC attribute to declare the "bundle
specification" of the entry. Bundle specifications are parsed using
exchange.parsebundlespecification, which uses the same strings as the
"--type" argument to `hg bundle`. The supported bundle specifications
are well defined and backwards compatible.

When a client encounters a BUNDLESPEC that is invalid or unsupported, it
silently ignores the entry.
2015-10-13 11:45:30 -07:00
Mads Kiilerich
2de7a8b7cf largefiles: better handling of merge of largefiles that not are available
Before, when merging revisions with missing largefiles, the missing largefiles
would be fetched as a part of the merge. If that failed (for example because
the main repository temporarily was unavailable), the largefile would be left
missing. However, the next commit would abort and (seemed to) fail when
markcommitted tried to mark the standin file as normal and thus had to hash the
largefile that didn't exist. (Actually, the commit would succeed but the
largefile update that follows right after the commit transaction would abort -
quite confusing.)

To fix that, make sure that synclfdirstate only marks files as normal if they
actually exist.
2015-10-12 19:22:34 +02:00
Pierre-Yves David
53ed633b94 patchbomb: check that targets exist at the publicurl
Advertising that the patch are available to be pulled requires that to be true.
So we check revision availability on the remote before sending any email.
2015-10-11 22:13:03 -07:00
Ryan McElroy
61f504197f strip: factor out revset calculation for strip -B
This will allow reusing it in evolve and overriding it in other extensions.
2015-10-09 14:48:59 -07:00
Gregory Szorc
5d1b4c49ee clonebundles: support for seeding clones from pre-generated bundles
Cloning can be an expensive operation for servers because the server
generates a bundle from existing repository data at request time. For
a large repository like mozilla-central, this consumes 4+ minutes
of CPU time on the server. It also results in significant network
utilization. Multiplied by hundreds or even thousands of clients and
the ensuing load can result in difficulties scaling the Mercurial server.

Despite generation of bundles being deterministic until the next
changeset is added, the generation of bundles to service a clone request
is not cached. Each clone thus performs redundant work. This is
wasteful.

This patch introduces the "clonebundles" extension and related
client-side functionality to help alleviate this deficiency. The
client-side feature is behind an experimental flag and is not enabled by
default.

It works as follows:

1) Server operator generates a bundle and makes it available on a
   server (likely HTTP).
2) Server operator defines the URL of a bundle file in a
   .hg/clonebundles.manifest file.
3) Client `hg clone`ing sees the server is advertising bundle URLs.
4) Client fetches and applies the advertised bundle.
5) Client performs equivalent of `hg pull` to fetch changes made since
   the bundle was created.

Essentially, the server performs the expensive work of generating a
bundle once and all subsequent clones fetch a static file from
somewhere. Scaling static file serving is a much more manageable
problem than scaling a Python application like Mercurial. Assuming your
repository grows less than 1% per day, the end result is 99+% of CPU
and network load from clones is eliminated, allowing Mercurial servers
to scale more easily. Serving static files also means data can be
transferred to clients as fast as they can consume it, rather than as
fast as servers can generate it. This makes clones faster.

Mozilla has implemented similar functionality of this patch on
hg.mozilla.org using a custom extension. We are hosting bundle files in
Amazon S3 and CloudFront (a CDN) and have successfully offloaded
>1 TB/day in data transfer from hg.mozilla.org, freeing up significant
bandwidth and CPU resources. The positive impact has been stellar and
I believe it has proved its value to be included in Mercurial core. I
feel it is important for the client-side support to be enabled in core
by default because it means that clients will get faster, more reliable
clones and will enable server operators to reduce load without
requiring any client-side configuration changes (assuming clients are
up to date, of course).

The scope of this feature is narrowly and specifically tailored to
cloning, despite "serve pulls from pre-generated bundles" being a valid
and useful feature. I would eventually like for Mercurial servers to
support transferring *all* repository data via statically hosted files.
You could imagine a server that siphons all pushed data to bundle files
and instructs clients to apply a stream of bundles to reconstruct all
repository data. This feature, while useful and powerful, is
significantly more work to implement because it requires the server
component have awareness of discovery and a mapping of which changesets
are in which files. Full, clone bundles, by contrast, are much simpler.

The wire protocol command is named "clonebundles" instead of something
more generic like "staticbundles" to leave the door open for a new, more
powerful and more generic server-side component with minimal backwards
compatibility implications. The name "bundleclone" is used by Mozilla's
extension and would cause problems since there are subtle differences
in Mozilla's extension.

Mozilla's experience with this idea has taught us that some form of
"content negotiation" is required. Not all clients will support all
bundle formats or even URLs (advanced TLS requirements, etc). To ensure
the highest uptake possible, a server needs to advertise multiple
versions of bundles and clients need to be able to choose the most
appropriate from that list one. The "attributes" in each
server-advertised entry facilitate this filtering and sorting. Their
use will become apparent in subsequent patches.

Initial inspiration and credit for the idea of cloning from static files
belongs to Augie Fackler and his "lookaside clone" extension proof of
concept.
2015-10-09 11:22:01 -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
Pierre-Yves David
5e41fdb7bc shelve: rename 'publicancestors' to something accurate (issue4737)
That function is actually not returning public ancestors at all. This is
pointed by the second line of the docstring...

The bundling behavior was made correct in a5141977198d but with confusion
remaining regarding what each function was doing.

This close issue4737, because this highlight that shelve is actually -not-
bundling too much data (this was actually properly tested).
2015-10-09 15:31:50 -07:00
Emanuele Giaquinta
18869274ee cvsps: fix computation of parent revisions when log caching is on
cvsps computes the parent revisions of log entries by walking the cvs log
sorted by (rcs, revision) and by iteratively maintaining a 'versions'
dictionary which maps a (rcs, branch) pair onto the last revision seen for that
pair. When log caching is on and a log cache exists, cvsps fails to set the
parent revisions of new log entries because it does not iterate over the log
cache in the parents computation. A complication is that a file rcs can change
(move to/from the attic), with respect to its value in the log cache, if the
file is removed/added back. This patch adds an iteration over the log cache to
update the rcs of cached log entries, if changed, and to properly populate the
'versions' dictionary.
2015-10-07 11:33:52 +03: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
7e69ac5da6 eol: rename 'error' to 'haserror'
The variable 'error' conflict with the module name that we would like to import
and use in a coming changeset.
2015-10-05 22:49:24 -07:00
Christian Delahousse
7472064a6f histedit: delete histedit statefile on any exception during abort
When an user aborts a histedit, many things could go wrong. At a minimum, after
a histedit abort failure, their repository should be out of that state. We've
found situations where the user could not exit the histedit state without
manually deleting the histedit state file. This patch ensures that if any
exception happens during an abort, the histedit statefile will be deleted so
that users are out of the histedit state and can at least manually get the repo
back to a workable condition.
2015-10-05 16:44:45 -07:00
Christian Delahousse
77b3596e11 histedit: check presence of statefile before deleting it
When the histeditstate class instance has it's clear() method called, there is
nothing to check to see if the state file exists before deleting it. It may not
exist, which would create an exception. This patch allows clear to be called at
any time.

This will be needed for the following patch.
2015-10-06 15:09:28 -07:00
Christian Delahousse
6f2b3a468a histedit: add inprogress method to state class
If a histedit is progress, the 'histedit-state' file should exist. The patch
implements a convenience function to do check if a histedit is in progress.

This method will be use in next patch in the series.
2015-10-05 16:34:17 -07: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
Pierre-Yves David
70ea75bfe7 patchbomb: add a 'bundletype' config under 'patchbomb'
patchbomb relies on the 'hg bundle' command to generate an attached bundle using
--bundle. However, while 'hg bundle' has a --type option, patchbomb did not.
This is becoming very relevant since we are about to issue bundle2 for
general-delta repository.

This was tracked as issue4863
2015-10-01 23:13:57 -07:00
Pierre-Yves David
6554509d00 patchbomb: add experimental config of a "pullurl" and export it
This config allows to specify a public location where your changeset can be
found. It then include a dedicated patch header show a command to be used to
retrieve the change. See the test for example.

This is flagged as experimental because this feature is not safe until we have
more logic to test that:
- changeset actually exists on destination
- changeset is draft on destination.

As all this is experimental, bike shedding can happily happens before we remove
the experimental flag.
2015-10-06 01:49:04 -07:00
FUJIWARA Katsunori
012bda5d3c shelve: restore unshelved dirstate explicitly after aborting transaction
Before this patch, "hg unshelve" uses aborting a current transaction
to discard temporary changes while unshelving.

This assumes that dirstate changes in a transaction scope are kept
even after aborting it. But this assumption will be broken by
"transactional dirstate". See the wiki page below for detail about it.

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

This patch explicitly saves shelved dirstate just before aborting
current transaction, and restore dirstate with it after aborting by
utility function '_aborttransaction()' added by previous patch.
2015-10-08 01:41:30 +09:00
FUJIWARA Katsunori
b46183c6ee shelve: restore shelved dirstate explicitly after aborting transaction
Before this patch, "hg shelve" uses aborting a current transaction to
discard temporary changes while shelving.

This assumes that dirstate changes in a transaction scope are kept
even after aborting it. But this assumption will be broken by
"transactional dirstate". See the wiki page below for detail about it.

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

This patch explicitly saves shelved dirstate just before aborting
current transaction, and restore dirstate with it after aborting by
utility function '_aborttransaction()' added by previous patch.

This patch replaces 'if tr: tr.abort()' by 'lockmod.release(tr)',
because the former is already done in '_aborttransaction()' (and the
latter has no effect), if current transaction is aborted in it
successfully. Otherwise, the latter is enough to trigger aborting.
2015-10-08 01:41:30 +09:00
FUJIWARA Katsunori
6200027e0d shelve: add utility to abort current transaction but keep dirstate
"hg shelve" and "hg unshelve" use aborting a current transaction to
discard temporary changes while (un)shelving.

This assumes that dirstate changes in a transaction scope are kept
even after aborting it. But this assumption will be broken by
"transactional dirstate". See the wiki page below for detail about it.

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

This patch adds utility function "_aborttransaction()" to abort
current transaction but keep dirstate changes for (un)shelving.

'dirstate.invalidate()' just after aborting a transaction should be
removed soon by subsequent patch, which writes or discards in-memory
dirstate changes at releasing transaction according to the result of
it.

BTW, there are some other ways below, which (seem to, at first glance)
resolve this issue. But this patch chose straightforward way for ease
of review and future refactorring.

  - commit transaction at first, and then rollback it

    It causes unintentional "dirty read" of running transaction to
    other processes at committing it.

  - use dirstateguard to save and restore shelved dirstate

    After DirstateTransactionPlan, making 'dirstate.write()' write
    in-memory changes into actual file requires
    'transaction.writepending()' while transaction running.

    It causes meaningless writing other in-memory changes out, even
    though they are never referred.

    In addition to it, it isn't desirable that scope of dirstateguard
    and transaction intersects each other.

  - get list of files changed from the parent, keep it in memory, and
    emulate that changes after aborting transaction

    This additional memory consumption may block aborting transaction
    in large repository (on small resource environment).
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
Pierre-Yves David
28c5867b10 shelve: bundle using bundle2 if repository is general delta (issue4862)
This will prevent expensive delta computation on bundling and is similar to what we do
for strip backup.
2015-10-01 15:08:00 -07:00
Pierre-Yves David
06934a921e shelve: move changegroup generation inside writebundle
We will generate different changegroup if general delta is enabled so we gather
this in the lower level function. There wasn't any good reason to have it in
the main code anyway.
2015-10-01 15:09:32 -07:00
Pierre-Yves David
73c8125ae1 shelve: compress on-disk bundle
Shelve is using 'HG10UN' bundle for no obvious reason. Changing this to 'HG10BZ'
as we do for other bundle stored on disk.
2015-09-29 17:14:30 -07:00
Matt Mackall
86f1841884 merge with stable 2015-10-07 13:44:48 -05:00
Bruce Cran
f9dd2d6f9f notify: fix fromauthor setting for 'incoming' hook type (issue4194)
Set the author field in notification emails for the 'incoming' hook type
in addition to 'changegroup' and 'outgoing' types.
2015-10-05 10:43:16 -06:00
timeless@mozdev.org
28296ec06b rebase: enable histedit for useful help with it 2015-10-06 15:07:00 -04:00
timeless@mozdev.org
23e4331fc3 rebase: suggest help -e histedit
Users unfamiliar with an extension should be reading the
documentation for the feature, not the command.
2015-10-06 15:01:25 -04:00
timeless@mozdev.org
96a106318f rebase: factor out histedit help command 2015-10-06 15:05:40 -04:00
Matt Harbison
f5215c2c04 largefiles: restore archiving largefiles with hgweb (issue4859)
This regressed in f07f4c45a8f2, when trying to conditionally disable archiving
of largefiles.

I'm not sure if wrapfunction() is the right way to do this, but it seems to
work.  The mysterious issue with lfstatus getting out of sync in the proxy and
the unfiltered view crops up again here.  See the referenced cset for more info.
2015-09-29 23:29:44 -04:00
FUJIWARA Katsunori
419251cb13 keyword: make restrict mode False while updating files for rollback
This is a preparation for using 'repo.rollback()' instead of aborting
a current running transaction for "shelve" and "unshelve".

Before this patch, updating files as a part of 'repo.rollback()'
overridden by keyword extension always follows 'restrict' mode of the
command currently executed.

"merge", "unshelve" and so on should be 'restrict'-ed, because keyword
expansion may cause unexpected conflicts at merging while these
commands.

But, if 'repo.rollback()' is invoked while executing 'restrict'-ed
commands, modified files in the working directory are marked as
"CLEAN" unexpectedly by code path below:

        # 'lookup' below is True at updating modified files for rollback
        kwcmd = self.restrict and lookup # kwexpand/kwshrink
            :
                if kwcmd:
                    self.repo.dirstate.normal(f)

On the other hand, "rollback" command isn't 'restrict'-ed, because
rollbacking itself doesn't imply merging.

Therefore, disabling 'restrict' mode while updating files as a part of
'repo.rollback()' regardless of current 'restrict' mode should be
reasonable.
2015-10-04 21:33:29 +09:00
Yuya Nishihara
1f3d02756b pager: recreate stdout to make it line-buffered
We want to see partial command results as soon as possible. But the buffering
mode of stdout (= pager's stdin) was set to fully-buffered because it isn't
associated with a tty. So, this patch recreates new stdout object to force its
buffering mode.

Because two file objects are associated with the same stdout fd and their
destructors will call close(), one of them must be closed carefully. Python
expects that the stdout fd never be closed even after sys.stdout.close() [1],
but newstdout has no such hack. So this patch calls newstdout.close()
immediately before duplicating the original stdout fd to sys.stdout.

  operation              sys.stdout  newstdout  fd
  ---------------------  ----------  ---------  --------
  newstdout.close()      open        closed     closed
  os.dup2(stdoutfd, ..)  open        closed     open
  del sys.stdout         closed      closed     open [1]

 [1]: https://hg.python.org/cpython/file/v2.7.10/Python/sysmodule.c#l1391
2015-10-03 15:16:33 +09:00
Yuya Nishihara
20505cecd5 pager: rename variables of backup fds
The next patch will add backup file objects, so the original variable names
would be confusing.
2015-10-03 18:48:21 +09:00
Yuya Nishihara
cadf85db0f pager: inline _pagersubprocess() into _runpager()
We don't need _pagersubprocess() because the fork version was removed
at 783efe565d9e.
2015-10-03 15:02:52 +09:00
Matt Mackall
eb810eca5f merge with stable 2015-10-01 12:17:46 -05:00
Matt Mackall
5e1b4ad958 urls: bulk-change primary website URLs 2015-09-30 15:43:49 -05:00
Matt Mackall
7543320395 urls: bulk-change BTS urls to new location 2015-09-30 15:31:07 -05:00
Yuya Nishihara
dac7167e8f help: include parens in DEPRECATED/EXPERIMENTAL keywords
In some languages that have no caps, "DEPRECATED" and "deprecated" can be
translated to the same byte sequence. So it is too wild to exclude messages
by _("DEPRECATED").
2015-09-26 11:38:39 +09:00
timeless@mozdev.org
e4c8525ba7 rebase: avoid losing branch commits with --keepbranch (issue4835) 2015-09-24 17:51:05 -04:00
Laurent Charignon
1cb3086e23 rebase: don't rebase obsolete commit whose successor is already rebased
This patch avoids unnecessary conflicts to resolve during rebase for the users
of changeset evolution.

This patch modifies rebase to skip obsolete commits if they are being rebased on
their successors.
It introduces a new rebase state 'revprecursor' for these revisions that are
being skipped and a new message to inform the user of what is happening.
This feature is gated behind the config flag experimental.rebaseskipobsolete

When an obsolete commit is skipped, the output is:
not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
2015-09-14 17:31:48 -07:00
Pierre-Yves David
7b5d19b0d7 transplant: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:52:21 -07:00
Pierre-Yves David
4756d21a63 mq: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs. The
underlying function already handle "None" as an option value, so we do not need
to do anything else.
2015-09-24 00:50:06 -07:00
Pierre-Yves David
a551464cdd largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:49:02 -07:00
Pierre-Yves David
ffcbdf7cc8 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:48:24 -07:00
Pierre-Yves David
cdc21e7de4 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:48:02 -07:00
Pierre-Yves David
4838705431 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:46:37 -07:00
Pierre-Yves David
40bf417522 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:46:12 -07:00
Pierre-Yves David
ef62bb6e54 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:44:59 -07:00
Pierre-Yves David
4dc7b8ccac largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:44:32 -07:00
Pierre-Yves David
a7ba280694 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:41:43 -07:00
Pierre-Yves David
28f9483962 largefiles: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:40:53 -07:00
Pierre-Yves David
374e65cff5 histedit: remove a mutable default argument
Mutable default arguments are know to the state of California to cause bugs.
2015-09-24 00:38:34 -07:00
Pierre-Yves David
0afd876083 rebase: move destination computation in a revset
This is the first step toward making the "default destination" logic more clear
and unified. The revset is private because I'm happy to delay the bikeshedding until
after the clean up happened.
2015-09-17 10:59:52 -07:00
Yuya Nishihara
4c547a3384 highlight: remove temporary hack to overwrite repo.getcwd
Now hgweb does it globally.
2015-09-20 20:13:27 +09:00
Anton Shestakov
7e01618c4d highlight: add highlightfiles config option which takes a fileset (issue3005)
Highlight extension lacked a way to limit files by size, by extension, and/or
by any other part of file path. A good solution would be to use a fileset,
since it can check file path, extension and size (and more) in one expression.
So this change introduces such an option, highlighfiles, which takes a fileset
and on each request decides if the requested file should be highlighted.

The default "size('<5M')" is, in a way, suggested in issue3005.

checkfctx() limits the amount of work to just one file (subset kwarg in
fileset.matchctx()).

Monkey-patching works around issue4568, otherwise using filesets here while
running hgweb in directory mode would say, for example, "Abort: **.py not under
root", but this fix is very local and probably far from ideal. I suspect there
to be a way to fix this for the whole hgweb and resolve the issue, but I don't
know how to do it.
2015-09-16 22:30:36 +08:00
Augie Fackler
57b1966770 histedit: use one editor when multiple folds happen in a row (issue3524) (BC)
This was the first ever feature request for histedit, originally filed
back on April 4, 2009. Finally fixed.

In the future we'll probably want to make it possible for other
preprocessing steps to be added to the list, but for now we're
skipping that because it's unclear what the API should look like
without a proposed consumer.
2015-08-27 14:46:26 -04:00
Matt Harbison
99ffdaafef extdiff: enable -I/-X with --patch
Not sure how useful this really is, but it's trivial to add and ignoring the
existing arguments supported seems like a bad UI.
2015-09-09 22:27:48 -04:00
Matt Harbison
c3b634a166 extdiff: add a --patch argument for diffing changeset deltas
One of the things I missed the most when transitioning from versioned MQ to
evolve was the loss of being able to check that rebase conflicts were properly
resolved by:

  $ hg ci --mq -m "before"
  $ hg rebase -s qbase -d tip
  $ hg bcompare --mq

The old csets stay in the tree with evolve, but a straight diff includes all of
the other changes that were pulled in, obscuring the code that was rebased.
Diffing deltas can be confusing, but unless radical changes were made during the
resolve, it is very clear when individual hunks are added, dropped or modified.
Unlike the MQ technique, this can only compare a single pair of csets/patches at
a time.  Like the MQ method, this also highlights changes in the commit comment
and other metadata.

I originally tried monkey patching from the evolve extension, but that is too
complicated given that it depends on the order the two different extensions are
loaded.  This functionality is also useful when comparing grafts however, so
implementing it in the core is more than just convenience.

The --change argument doesn't make much sense for this, but it isn't harmful so
I didn't bother blocking it.  The -I/-X options are ignored because of a
limitation of cmdutil.export().  We'll fix that next.
2015-09-09 21:07:38 -04:00
Matt Harbison
d9022f7c59 extdiff: prepare sections of dodiff() for conditionalizing
This is purely indenting under an unconditional branch, so that the actual
changes in the next patch are clear.  Feel free to fold them if desired.
2015-09-09 20:48:09 -04:00
timeless@mozdev.org
c07651e722 histedit: fix grammar in cleanupnode comment 2015-09-08 20:30:01 -04:00
Durham Goode
bdd9abd3d3 blackbox: add pid to output
This adds the process id to the line header for the blackbox output. This is
useful for distinguishing processes when using the blackbox on a server and many
processes are writing to the blackbox at once.
2015-09-07 11:31:44 -07:00
timeless@mozdev.org
0ceae1ee9a histedit: fix English (en-US) 2015-08-28 13:52:49 -04:00
liscju
436c14ee4b rebase: fix warning about ignoring tool option on rebase continue (issue4698)
Before this patch rebase --continue with specified --tool option outputs
warnings "tool option will be ignored". It is false statement because
in case of any merge conflicts it uses specified tool to resolve it.

This patch makes this warning appears only when user specified --tool
when running rebase --abort , in this case tool doesn't have any
sense
2015-09-01 21:37:51 +02:00
Durham Goode
a3e74a7ca5 convert: remove restriction on multiple --rev in hg source
Multiple --rev args on convert is a new feature, and was initially disabled for
all sources. It has since been enabled on git sources, and this patch enables it
on mercurial sources.
2015-09-03 10:29:42 -07:00
Pierre-Yves David
be40ed237e rebase: lock the repo during the full rebase operation
Running `hg pull --rebase` would move bookmarks without any repository locking.
So we now lock the repository. For good measure and avoiding sneaky race
conditions, we lock the repository for the whole operation.

There is no code change besides the indentation.
2015-08-11 16:45:11 -07:00
Matt Harbison
dd27c92fee largefiles: ensure lfutil.getstandinmatcher() only matches standins
Previously, simply having the largefiles extension loaded without any largefiles
added would crash when amending with -I.  The problem was with no files in the
matcher, the pattern list of files joined with 'standindir' was empty, and
scmutil.match() would match everything.  In lfutil.composestandinmatcher(), the
match function is used to test if the file is a standin, and after getting a
false positive, proceeds to call lfutil.splitstandin().  This returns None
because it isn't a standin, which blows up when passed to rmatcher.matchfn().

Manually overriding _always in getstandinmatcher() probably isn't necessary
anymore, but we leave well enough alone on stable.  This regressed in
78632d61a993.
2015-08-12 12:26:39 -04:00
Durham Goode
8f62a68933 convert: fix git copy file content conversions
There was a bug in the git convert code where if you copied a file and modified
the copy source in the same commit, and if the copy dest was alphabetically
earlier than the copy source, the converted version would use the copy dest
contents for both the source and the target.

The root of the bug is that the git diff-tree output is formatted like so:

:<mode> <mode> <oldhash>    <newhash>    <state> <src>   <dest>
:100644 100644 c1ab79a15... 3dfc779ab... C069    oldname newname
:100644 100644 c1ab79a15... 03e2188a6... M       oldname

The old code would always take the 'oldname' field as the name of the file being
processed, then it would try to do an extra convert for the newname. This works
for renames because it does a delete for the oldname and a create for the
newname.

For copies though, it ends up associating the copied content (3dfc779ab above)
with the oldname. It only happened when the dest was alphabetically before
because that meant the copy got processed before the modification.

The fix is the treat copy lines as affecting only the newname, and not marking
the oldname as processed.
2015-08-06 17:21:46 -07:00
Pierre-Yves David
6b2961e47a histedit: backout 3e883e7ec57b
The faulty changeset use obsolescence marker to roll the repository back on
--abort. This is a problematic approach because --abort should be as close as an
actually transaction rollback as possible stripping all created data from the
repository (cf `hg rebase --abort` stripping all created changesets). Instead
3e883e7ec57b made all content created during the aborted histedit still
available in the repository adding obsolescence marker to make them hidden. This
will cause trouble to evolution user as a re-run of the same histedit (with
success) will likely result in the very same node to be "recreated" while
obsolescence marker would be in place for them. And canceling an obsoletion is
still a fairly complicated process.

This also rollback using obsmarkers instead of strip to clean up temporary node
on successful histedit run because the two change were not split in separated
changeset. Rolling that part back does not have significant consequence a will
have to be resubmitted independently
2015-07-31 15:11:07 -07:00
Eugene Baranov
322848b810 convert: when converting from Perforce use original local encoding by default
On Windows Perforce command line client uses default system locale to encode
output. Using 'latin_1' causes locale-specific characters to be replaced with
question marks. With this patch we will use default locale by default whilst
allowing to specify it explicity with 'convert.p4.encoding' config option.

This is a potentially breaking change for any scripts relying on output treated
as in 'latin_1' encoding.

Also because hgext.convert.convcmd overwrites detected default system locale
with UTF-8 we had to introduce an import cycle in hgext.convert.p4 to retrieve
originally detected encoding from hgext.convert.convcmd.
2015-07-22 16:57:11 +01:00
Eugene Baranov
29b28e8371 convert: when getting file from Perforce concatenate data at the end
As it turned out, even when getting relatively small files, concatenating
string data every time when new chunk is received is very inefficient.
Maintaining a string list of data chunks and concatenating everything in one go
at the end seems much more efficient - in my testing it made getting 40 MB file
7 times faster, whilst converting of a particularly big changelist with some big
files went down from 20 hours to 3 hours.
2015-07-30 00:58:05 +01:00
Matt Harbison
5dece5b905 convert: document convert.hg.startrev 2015-07-29 21:31:56 -04:00
FUJIWARA Katsunori
2fb0db56cb transplant: restore dirstate correctly at unexpected failure
Before this patch, transplant can't restore dirstate as expected at
failure other than one while patching. This causes:

  - unexpected file status

  - dirstate refers already rollback-ed parent
    (only at failure of transplanting the 2nd or later revision)

To restore dirstate correctly also at unexpected failure, this patch
encloses scope of store lock and transaction by 'dirstateguard'.

This is temporary fixing for stable branch. See
DirstateTransactionPlan wiki page for detail about the future plan to
treat dirstate consistently around scope boundary of transaction.

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

This patch also adds 'if lock' examination for safety
'lock.release()', because creating 'dirstateguard' object may fail
unexpectedly (e.g. IOError for saving dirstate).

BTW, in the test script, putting section header '[extensions]' into
'.hg/hgrc' is needed to fix incomplete disabling 'abort' extension at
d0d06f4ca862.
2015-07-30 06:22:09 +09:00
Matt Harbison
eea8aa5335 extdiff: allow modifications in subrepos to be copied back
This check was a legacy bit from when the file data was being fetched manually
with 'ctx[wfn]', but archive() does that now.  2032c5b369f5 seems to indicate
that this avoided a problem where a merge adds a file to another branch, and
that test still passes.

Unfortunately, I don't see a way to create a test that modifies the file in the
temporary directory before the command exits.

I wonder if the os.lstat() call needs to be wrapped in an exception handler for
the case where archive didn't create a file because the file didn't exist in
that revision.  But I wasn't able to trigger a problem without it on a real
repository.
2015-07-27 17:39:09 -04:00
Anton Shestakov
403857c028 highlight: produce correct markup when there's a blank line just before EOF
Due to how the colorized output from pygments was stripped of <pre> elements,
when there was an empty line at the end of a file, highlight extension produced
an incorrect markup (no closing tags from the fileline/annotateline template).
It wasn't usually noticeable, because browsers were smart enough to see where
the missing tags should've been, but in monoblue style it resulted in the last
line having twice the normal height.

Instead of awkwardly trying to strip outer <pre></pre> tags, let's make the
formatter with nowrap=True, which should do what we need in pygments since at
least 0.5 (2006-10-30).

Example from monoblue style:

Before:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a>
    </div>

Now:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a> </pre>
</div>
    </div>

(Notice the missing </pre></div> now in place)
2015-07-22 10:19:17 +08:00
timeless@mozdev.org
e88cb37448 histedit: improve discoverability of edit commit message 2015-08-28 15:50:36 -04:00
timeless@mozdev.org
52eae47139 spelling: behaviour -> behavior 2015-08-28 10:53:55 -04:00