Commit Graph

26782 Commits

Author SHA1 Message Date
Siddharth Agarwal
88c48784e2 commands.resolve: switch to mergestate.read()
See previous patches for why we're doing this.
2015-11-17 13:56: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
99a292eb8d mergestate: add a constructor that reads state from disk
At the moment it's the same as just creating a new mergestate, but we'll soon
move the _read call out of __init__ and in here.
2015-11-17 13:55:30 -08:00
Siddharth Agarwal
866f1a0d13 merge.applyupdates: switch to mergestate.clean()
See the previous patches for why we're doing this.
2015-11-17 17:04:53 -08:00
Siddharth Agarwal
7e0e958b67 localrepo: switch to mergestate.clean()
See the previous patches for why we're doing this.
2015-11-17 17:04:32 -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
Siddharth Agarwal
7f86d75731 mergestate: add a constructor that sets up a clean merge state
Eventually, we'll move the read call out of the constructor. This will:
- avoid unnecessary reads when we're going to nuke the merge state anyway
- avoid raising an exception if there's an unsupported merge record

'clean' seems like a good name for it because I wanted to avoid anything with
the word 'new' in it, and 'reset' is more an action performed on a merge state
than a way to get a new merge state.

Thanks to Martin von Zweigbergk for feedback about naming this.
2015-11-17 17:00:54 -08:00
Siddharth Agarwal
a9244bf2d6 mergestate: raise structured exception for unsupported merge records
We're going to catch this exception in 'hg summary' to print a better error
message.

This code is pretty untested, so there are no changes to test output. In
upcoming patches we're going to test the output more thoroughly.
2015-11-17 14:11:52 -08:00
Siddharth Agarwal
a13e973d08 error: add a structured exception for unsupported merge records
We're going to use this in summary to print a better error message.
2015-11-17 14:10:12 -08:00
Bryan O'Sullivan
9d37a5f6b4 dirstate: back out dd36f84bd784
Superseded by the parent of this commit.
2015-11-17 13:47:16 -08:00
Bryan O'Sullivan
f5b0cc2242 osutil: make statfiles check for interrupts periodically
This is a simpler and faster fix for issue4878 than the contortions
performed in dd36f84bd784.
2015-11-17 13:47:14 -08:00
Bryan O'Sullivan
d04584822f osutil: don't leak on statfiles error
Found using the power of the mighty eyeball.
2015-11-17 13:43:09 -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
Siddharth Agarwal
03baaaa2e8 node: add 'nullhex', hex-encoded nullid
We're going to need this for upcoming changes, because the merge state stores
nodes as hex strings.
2015-11-16 11:23:32 -08:00
Siddharth Agarwal
d26567458a filemerge: introduce class whose objects represent files not in a context
Most code is going to barf at the return values here (particularly from data
and size), so we restrict it to the filemerge code.

This is already somewhat supported via:

  ctx.filectx(f, fileid=nullid)

Indeed, for add/add conflicts (ancestor doesn't have the file) we use precisely
that. However, that is broken in subtle ways:
- The cmp() function in filectx returns False (identical) for such a filectx
  when compared to a zero-length file.
- size() returns 0 rather than some sort of value indicating that the file isn't
  present.
- data() returns '' rather than some sort of value indicating that the file isn't
  present.

Given the relatively niche use of such filectxes, this seems to be the simplest
way to fix all these issues.
2015-11-16 11:45:35 -08:00
Siddharth Agarwal
8529661292 filectx: add isabsent method
This will indicate whether this filectx represents a file that is *not* in a
changectx. This will be used by merge and filemerge code to know about when a
conflict is a change/delete conflict.

While this is kind of hacky, it is the least bad of all the alternatives. Other
options considered but rejected include:
- isinstance(fctx, ...) -- not very Pythonic, doesn't support duck typing
- fctx.size() is None -- the 'size()' call on workingfilectxes causes a disk stat
- fctx.filenode() == nullid -- the semantics around filenode are incredibly
  confusing. In particular, for workingfilectxes, filenode() is always None no
  matter whether the file is present on disk or in either parent. Having different
  behavior for None versus nullid in the merge code is just asking for pain.

Thanks to Pierre-Yves David for early review feedback here.
2015-11-16 11:27:27 -08:00
Siddharth Agarwal
6a83f7850c filectx: allow custom comparators
We're going to introduce other sorts of filectxes very soon, and we'd like the
cmp method to function properly (i.e. commutatively) for them. The only way to
make that happen is for this cmp method to call into that specialized one if
that defines a custom comparator.
2015-11-13 22:37:51 -08:00
Siddharth Agarwal
c7aefbc8d6 debugmergestate: print out record type for files
We're going to add a separate record type for change/delete conflicts soon. We
need to make sure they get stored with the correct record type so that older
versions of Mercurial correctly abort when they see change/delete records.
2015-11-13 23:01:36 -08:00
Siddharth Agarwal
c6faeb67e1 merge.applyupdates: don't return early if merge driver's conclude failed
Somewhat silly oversight -- this prevented the progress bar from being reset.
2015-11-15 22:45:20 -08: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
Martin von Zweigbergk
b3bed98791 test-rename-merge2: make selected output less arbitrary
It's unclear why everything from the first 'updating:' line should be
ignored. The arbitrariness makes it confusing that changing the code
so e.g. the 'getting 8/f' line is printed later makes it disappear
completely from the ouput. The list of 'preserving x for resolve of y'
seems convered by the subsequent for loop in the test case. Perhaps
it's only copies that are of interests, so let's keep only that part.
2015-02-11 22:22:29 -08:00
Matt Harbison
a31413aa1c test-convert-git: drop a git warning that doesn't occur on Windows
I do see this on Linux with 1.7.7.6, but not on Windows with 1.9.5.msysgit.0.
Adding a (?) didn't work to conditionally ignore the line; I'm not sure if the
(glob) interferes with that.
2015-11-15 22:11:23 -05:00
Matt Harbison
d7467d5e8b tests: fix globs for Windows 2015-11-15 21:12:13 -05:00
liscju
d62a7fea38 pull: return 255 value on update failure (issue4948) (BC)
Before this patch hg pull -u on UpdateAbort error returned
0 value to the system. This patch fixes this by reraising
UpdateAbort with updated error msg.
2015-11-15 22:58:28 +01:00
Martin von Zweigbergk
b2254eccbe filemerge: remove leading space from " no tool found..."
I could not find or see a reason for the unusual formatting. The lines
following it in the test cases are not indented.
2015-11-11 10:19:11 -08:00
Yuya Nishihara
988d64c871 test-encoding: enable fuzz testing of utf8b roundtrip
This test was written by David R. MacIver <david@drmaciver.com> at the London
sprint. We can enable it as the bug in utf8b encoder/decoder has been fixed.
2015-11-09 22:31:01 +09:00
Yuya Nishihara
7ae2e7fc0b import-checker: reset context to verify convention in function scope
I got the following error by rewriting hgweb/webcommands.py to use
absolute_import. It is false-positive because the import line appears in
"help" function:

  hgweb/webcommands.py:1297: higher-level import should come first: mercurial

This patch makes the import checker aware of the function scope and apply
rules recursively.
2015-11-01 17:42:03 +09:00
Yuya Nishihara
e8375646e9 import-checker: allow import of child modules from package root
I got the following error by rewriting hgweb/__init__.py to use
absolute_import, which is obviously wrong:

  Import cycle: mercurial.hgweb.__init__ -> mercurial.hgweb.__init__

"from foo import bar" should not make a cycle if "foo" is a package and
if "bar" is a module or a package. On the other hand, it should be detected
as a cycle if "bar" is a non-module name. Both cases are doc-tested already,
so this patch does not add new doctest.
2015-11-01 00:37:22 +09:00
Matt Mackall
00fdf56300 encoding: extend test cases for utf8b
This adds a round-trip helper and a few tests of streams that could
cause synchronization problems in the encoder.
2015-11-02 17:17:33 -06:00
Siddharth Agarwal
5d41145967 merge: make 'cd' and 'dc' actions store the same arguments as 'm'
We're going to treat these conflicts similarly to merge conflicts, and this
change to the way we store things in memory makes future code a lot simpler.
2015-11-13 22:43:09 -08:00
Siddharth Agarwal
13a33ed9b5 merge: stop emptying out 'cd' and 'dc' actions
(1) These aren't currently read from anywhere, so emptying this out is
    pointless.
(2) These *will* be read from later in upcoming patches, and not emptying
    them out will be important then.
2015-11-13 14:24:22 -08:00
Anton Shestakov
7f7f44179c monoblue: add a space to separate navigation links in file log footer
Before: '(0)-60tip', after: '(0) -60 tip'.
2015-11-06 22:32:00 +08:00
Martin von Zweigbergk
3d33120c8b merge: move messages about possible conflicts a litte earlier
I actually wanted to reduce the amount of code around the call to
applyupdates(), so I tried moving these warnings a little earlier, and
I think it makes the output make a little more sense (see changes to
test cases).
2015-11-12 13:14:03 -08:00
Yuya Nishihara
b21d72c284 import-checker: include lineno in warning message
This makes it easy to look for imports in function scope.
2015-11-01 15:46:06 +09:00
Yuya Nishihara
1455104bd2 import-checker: extract function to generate a formatted warning
This is the stub to embed lineno. See the next patch for details.
2015-11-01 15:39:25 +09:00
Yuya Nishihara
297152f7e3 import-checker: make it executable for convenience 2015-11-01 13:53:05 +09:00
Matt Harbison
4f2a7a6b1a test-fileset: glob the updated file count for Windows stability
Some of the prior changes are platform dependent, involving symlinks, exec bits
and non portable names.  An update 10 lines above also globbed this value to
avoid differences, since this line isn't of particular interest- the filesets
are.
2015-11-09 17:20:50 -05:00
Matt Harbison
a8e6bbf99c tests: tolerate differences between Linux and Windows error strings
These are related to differences in how missing files and network connection
failures are displayed.  I opted to combine the strings in one line instead of
using '#if windows' blocks around entire commands in order to avoid future
changes being accidentally missed in the Windows sections.  Globbing away the
entire output seemed wrong, as it could mask other failures.

The raw messages involved are:

      Linux                               Windows

  "* not known"               <-> "getaddrinfo failed"
  "Connection refused"        <-> "No connection could be made because the
                                   target machine actively refused it"
  "No such file or directory" <-> "The system cannot find the file specified"

Issue 4941 indicates that NetBSD has yet another string for "* not known".

Also, the histedit test shows that the missing file is printed first on Windows,
last on Linux.  That is controlled in windows.py:posixfile if we care to change
it.
2015-11-09 13:12:35 -05:00
Matt Harbison
e6074e31cf test-largefiles-cache: add glob for Windows 2015-11-09 12:51:58 -05:00
Matt Harbison
cbc163de28 tests: make 'f' tool open files in binary mode when hexdumping
On Windows, the various bundle hexdumps were being truncated at the first
occurrence of 0x1a.  The line endings in the sequence generation then needs to
be standardized on LF so that the file is the same for the tool tests.
2015-11-09 12:49:31 -05:00
Siddharth Agarwal
b2610217fb merge.applyupdates: only attempt to merge files in mergeactions
This only makes a difference when a merge driver is active -- in that case we
don't want to try and merge all the files, just the ones still unresolved after
the merge driver's preprocess step is over.
2015-11-12 14:29:02 -08:00
Siddharth Agarwal
482e3440bf filemerge: rename _symlinkcheck to _mergecheck
We're going to be adding other checks in here soon.
2015-11-11 17:34:28 -08:00
Siddharth Agarwal
afb6e4152e test-merge-prompt.t: rename to test-merge-changedelete.t
Because:
(a) the only prompts we test in this file are change/delete prompts, and
(b) we're going to be expanding the scope of this test to cover future
    improvements to change/delete conflicts, including avoiding prompts
    altogether.
2015-11-11 17:32:41 -08:00
Matt Mackall
998e07d45c merge with stable 2015-11-12 20:48:41 -06:00
Gregory Szorc
c1d73b49e9 tags: create new sortdict for performance reasons
sortdict internally maintains a list of keys in insertion order. When a
key is replaced via __setitem__, we .remove() from this list. This
involves a linear scan and array adjustment. This is an expensive
operation.

The tags reading code was calling into sortdict.__setitem__ for each tag
in a read .hgtags revision. For repositories with thousands of tags or
thousands of .hgtags revisions, the overhead from list.remove()
noticeable.

This patch creates a new sortdict() so __setitem__ calls don't incur a
list.remove.

This doesn't appear to have any performance impact on my Firefox
repository. But that's only because tags reading doesn't show up in
profiles to begin with. I'm still waiting to hear from a user with over
10,000 tags and hundreds of heads on the impact of this patch.
2015-11-12 13:16:04 -08:00
FUJIWARA Katsunori
3536b81882 share: wrap bmstore._writerepo for transaction sensitivity (issue4940)
4bc805f938a0 made 'bmstore.write()' transaction sensitive, to restore
original bookmarks correctly at failure of a transaction.

For example, shelve and unshelve imply steps below:

  before 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' writes updated ones into .hg/bookmarks
    3. rollback transaction to remove internal commits
    4. restore updated bookmarks manually

  after 4bc805f938a0:
    1. move active bookmark forward at internal rebasing
    2. 'bmstore.write()' doesn't write updated ones into .hg/bookmarks
       (these are written into .hg/bookmarks.pending, if external hook
       is spawn)
    3. rollback transaction to remove internal commits
    4. .hg/bookmarks should be clean, because it isn't changed while
       transaction running: see (2) above

But if shelve or unshelve is executed in the repository created with
"shared bookmarks" ("hg share -B"), this doesn't work as expected,
because:

  - share extension makes 'bmstore.write()' write updated bookmarks
    into .hg/bookmarks of shared source repository regardless of
    transaction activity, and

  - intentional transaction failure at the end of shelve/unshelve
    doesn't restore already updated .hg/bookmarks of shared source

This patch makes share extension wrap 'bmstore._writerepo()' instead
of 'bmstore.write()', because the former is used to actually write
bookmark changes out.
2015-11-13 02:36:30 +09:00
Christian Delahousse
09cc93274f largefiles: specify where .orig files are kept
This patch let's the user specify where .orig files are kept using the
cmdutil.origpath function
2015-11-10 15:08:56 -08:00
Christian Delahousse
41f8e938a0 mq: let the user choose where .orig files are kept
This patch uses cmdutil.origpath to let the user decide where .orig files are
kept when backup files are created.
2015-11-10 14:52:54 -08:00