Commit Graph

22025 Commits

Author SHA1 Message Date
Mads Kiilerich
440a607ef9 cleanup: name unused variables using convention of leading _
This helps checker tools ... and readability for those who knows and follows
the convention.
2014-08-15 04:37:46 +02:00
Mads Kiilerich
ecd224f8a0 cleanup: rename check-translation.py checker function - don't hide global var 2014-08-15 16:20:47 +02:00
Mads Kiilerich
3947517b04 cleanup: remove some unused / duplicate imports 2014-08-15 04:37:45 +02:00
Mads Kiilerich
b778f12731 cleanup: fix some list comprehension redefinitions of existing vars
In all the remaining cases the comprehension variable is used for the same
thing as a previous loop variable.

This will mute some pyflakes "list comprehension redefines" warnings.
2014-08-15 04:37:46 +02:00
Mads Kiilerich
5d377a8588 cleanup: avoid local vars shadowing imports
This will mute some pyflakes "import ... shadowed by loop variable" warnings.
2014-08-15 16:20:47 +02:00
Mads Kiilerich
23da6c1d98 cleanup: avoid _ for local unused tmp variables - that is reserved for i18n
_ is usually used for i18n markup but we also used it for I-don't-care
variables.

Instead, name don't-care variables in a slightly descriptive way but use the _
prefix to designate unused variable.

This will mute some pyflakes "import '_' ... shadowed by loop variable"
warnings.
2014-08-15 16:20:47 +02:00
Mads Kiilerich
5d1360e0ed cleanup: make sure we always access members of imported modules
This will make sure we get import errors, even if demandimport is enabled.

This will also mute some pyflakes 'imported but unused' warnings.
2014-08-15 04:37:45 +02:00
FUJIWARA Katsunori
3288a3b80d largefiles: update lfdirstate for unchanged largefiles during linear merging
Before this patch, linear merging of modified largefiles causes
an unexpected result, if (1) largefile collides with same-name normal one
in the target revision and (2) "local" largefile is chosen, even
though branch merging between such revisions works correctly.

Expected result of such linear merging is marking the largefile as
(re-)"added", but the actual result is marking it as "modified".

The standin of modified "local largefile" is not changed by linear
merging, and updating/merging update lfdirstate entries only for
largefiles of which standins are changed.

This patch adds the code path to update lfdirstate only for largefiles
of which standins are not changed.

In this case, "synclfdirstate" should be invoked with True as
"normallookup" argument always to force using "normallookup" on
dirstate for "n" files, because "normal" may mark target files as
"clean" unexpectedly.

To reduce cost of "lfile not in filelist", this patch converts
"filelist" to a "set" object: "filelist" is used only in (1) the newly
added code path and (2) the next line of "filelist = set(filelist)".

This is a temporary way to fix with less changes. For fundamental
resolution of this kind of problems in the future, "lfdirstate" should
be updated with "dirstate" simultaneously during "merge.update"
execution: maybe by hooking "recordupdates" (+ total refactoring
around lfdirstate handling)
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
582af6221b largefiles: keep largefiles from colliding with normal one during linear merge
Before this patch, linear merging of modified or newly added largefile
causes unexpected result, if (1) largefile collides with same name
normal one in the target revision and (2) "local" largefile is chosen,
even though branch merging between such revisions doesn't.

Expected result of such linear merging is:

  (1) (not yet recorded) largefile is kept in the working directory
  (2) largefile is marked as (re-)"added"
  (3) colliding normal file is marked as "removed"

But actual result is:

  (1) largefile in the working directory is unlinked
  (2) largefile is marked as "normal" (so treated as "missing")
  (3) the dirstate entry for colliding normal file is just dropped

(1) is very serious, because there is no way to restore temporarily
modified largefiles.

(3) prevents the next commit from adding the manifest with correct
"removal of (normal) file" information for newly created changeset.

The root cause of this problem is putting "lfile" into "actions['r']"
in linear-merging case. At liner merging, "actions['r']" causes:

  - unlinking "target file" in the working directory, but "lfile" as
    "target file" is also largefile itself in this case

  - dropping the dirstate entry for target file

"actions['f']" (= "forget") does only the latter, and this is reason
why this patch doesn't choose putting "lfile" into it instead of
"actions['r']".

This patch newly introduces action "lfmr" (LargeFiles: Mark as
Removed) to mark colliding normal file as "removed" without unlinking
it.

This patch uses "hg debugdirstate" instead of "hg status" in test,
because:

  - choosing "local largefile" hides "removed" status of "remote
    normal file" in "hg status" output, and

  - "hg status" for "large2" in this case has another problem fixed in
    the subsequent patch
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
df8394d920 largefiles: add test for large/normal conflict at linear merging
Before this patch, there is no explicit test for it: test-issue3084.t
seems to test such conflict only at branch merging.

This patch uses "[debug] dirstate.delaywrite" feature for the tests
expecting "M" status of largefiles, to confirm certainly whether files
are marked unexpectedly as "clean".
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
a3e5d804ef largefiles: put whole "hgmerge" process into the same "wlock" scope
Before this patch, there are two distinct "wlock" scopes below in
"hgmerge":

  1. "merge.update" via original "hg.merge" function
  2. "updatelfiles" specific "wlock" scope (to synchronize largefile
     dirstate)

But these should be executed in the same "wlock" scope for
consistency, because users of "hg.merge" don't get "wlock" explicitly
before invocation of it.

  - merge in commands

This patch puts almost all of the original "hgmerge" implementation into
"_hgmerge" to reduce changes.
2014-08-15 20:28:51 +09:00
FUJIWARA Katsunori
79d6e6e6cb largefiles: put whole "hgupdaterepo" process into the same "wlock" scope
Before this patch, there are two distinct "wlock" scopes below in
"hgupdaterepo":

  1. "merge.update" via original "hg.updaterepo" function
  2. "updatelfiles" specific "wlock" scope (to synchronize largefile
     dirstate)

In addition to them, "dirstate.walk" is executed between these "wlock"
scopes.

But these should be executed in the same "wlock" scope for
consistency, because many (indirect) users of "hg.updaterepo" don't
get "wlock" explicitly before invocation of it.

"hg.clean" is invoked without "wlock" from:

  - mqrepo.restore in mq
  - bisect in commands
  - update in commands

"hg.update" is invoked without "wlock" from:

  - clone in mq
  - pullrebase in rebase
  - postincoming in commands (used in "hg pull -u", "hg unbundle")
  - update in commands

This patch puts almost all original "hgupdaterepo" implementation into
"_hgupdaterepo" to reduce changes.
2014-08-15 20:28:51 +09:00
Yuya Nishihara
58cebc106d annotate: inline definition of decorate() functions 2014-08-15 14:33:19 +09:00
Yuya Nishihara
fa3165fc6e annotate: rewrite long short-circuit statement by if-elif-else 2014-08-15 14:29:30 +09:00
Pierre-Yves David
ff3290bfea revert: use modified information from both statuses
Using status information against the target ensures we are catching all
files with modifications that need reverting.

We still need to distinguish fresh modifications for backup purpose.

test-largefile is affected because it reverted a file that needs no content
change.
2014-06-24 17:27:18 +01:00
Pierre-Yves David
56e34a196a revert: drop special case handling for file unknown in parent
We had a special case for file not caught by any categories. It was
aimed at files missing in wc and wc's parent but existing in the target
revision. This is now properly handled using status information.
2014-06-24 16:57:16 +01:00
Pierre-Yves David
911e895e66 revert: use "remove" information from both statuses
Using status information against the target to make sure we are catching all
files that need to be re-added.

We still need to distinguish fresh removal because they use a different
message.
2014-06-24 16:53:22 +01:00
Pierre-Yves David
2cc3d88c5b revert: process removed files missing in target as clean
If a file does not exist in target and is marked as removed in the dirstate, we
can mark it as clean. There are no changes needed to revert it.
2014-08-01 18:27:47 -07:00
Pierre-Yves David
708550e527 revert: also track clean files
Tracking clean files is the simplest way to be able to reports files that need
no changes. So we explicitly retrieve them.

This fixes a couple of test outputs where the lack of changes was not reported.
2014-07-31 15:52:56 -07:00
Pierre-Yves David
df2c9033ac revert: triage "deleted" files into more appropriate categories
Status can return file as "deleted". This is only a special case
related to working directory state: file is recorded as tracked but no
file exists on disk. This will never be a state obtainable from
manifest comparisons.

"Deleted" files have another working directory status shadowed by the lack of
file. They will -alway- be touched by revert. The "lack of file" can be seen as
a modification. The file will never match the same "content" as in the revert
target. From there we have two options:

1. The file exists in the target and can be seen as "modified".
2. The file does not exist in the target and can be seen as "added".

So now we just dispatch elements from delete into appropriate categories.
2014-08-01 18:57:53 -07:00
Matt Mackall
ef4d018116 unshelve: silence internal revert
This prepares for upcoming revert changes.
2014-08-15 10:54:15 -05:00
Matt Mackall
931b87a60d tests: fixup issue markers to make check-commit happy 2014-08-15 10:47:03 -05:00
Matt Mackall
2b52e463fe check-code: extend try/except/finally check for multiple except clauses 2014-08-14 16:39:27 -05:00
Matt Mackall
7a0d67564b repoview: fix try/except/finally for py2.4 2014-08-14 16:39:02 -05:00
Matt Mackall
57de8037d2 merge with stable 2014-08-14 16:25:47 -05:00
Matt Mackall
24638bb76c test-run-tests: fix up slash/backslash on diff chunks for Windows 2014-08-14 16:18:45 -05:00
Matt Mackall
25d1182c5d merge with stable 2014-08-14 15:21:48 -05:00
Siddharth Agarwal
26dccff015 test-largefiles: add test for hg log --follow --patch with path
This was the one case for test-largefiles that was not broken.
2014-08-13 15:55:45 -07:00
Siddharth Agarwal
6e2ab4d61f largefiles: don't override matchandpats for always matchers (issue4334)
This makes hg log --follow --patch work, since in cmdutil._makelogrevset we
use the non-follow matcher for hg log --follow --patch with no file arguments.
2014-08-13 15:51:33 -07:00
Siddharth Agarwal
c70d49625f largefiles: in overridelog, use non-lf matcher for patch generation (issue4334)
This has actually been broken since at least Mercurial 2.8 -- hg log --patch
with largefiles only used to work when no largefiles existed. Rev 658ce4a0a0a9
exposed this bug for all cases.
2014-08-13 15:18:41 -07:00
Siddharth Agarwal
dcc2ebb6cf largefiles: drop setting lfstatus in overridelog (issue4334)
lfstatus should only be True for operations where we want standins to be
printed out. We explicitly do not want that for historical operations like log.
Other historical operations like hg diff -r A -r B don't print out standins
either.

This is required to fix issue4334, but doesn't fix anything by itself. That's
why there aren't any tests accompanying this patch.
2014-08-13 15:13:50 -07:00
Siddharth Agarwal
f07a4ceb07 cmdutil: add a hook for making custom non-follow log file matchers
This will be used by largefiles (and basically only by largefiles) in an
upcoming patch.
2014-08-13 15:17:03 -07:00
Siddharth Agarwal
b112932fc1 cmdutil: rename _makelogfilematcher to _makefollowlogfilematcher
We're going to add a _makenofollowlogfilematcher in an upcoming patch.
2014-08-13 15:15:13 -07:00
Martin von Zweigbergk
69e9a354a2 histedit: preserve initial author on fold (issue4296)
When the authorship of the changeset folded in does not match that of
the base changeset, we currently use the configured ui.username
instead. This is especially surprising when the user is not the author
of either of the changesets. In such cases, the resulting authorship
(the user's) is clearly incorrect. Even when the user is folding in a
patch they authored themselves, it's not clear whether they should
take over the authorship. Let's instead keep it simple and always
preserve the base changeset's authorship. This is also how
"git rebase -i" handles folding/squashing.
2014-08-13 11:50:13 -07:00
Matt Mackall
1fc52a716b run-tests: fix some io ordering
backported from default
2014-08-13 18:50:35 -05:00
Matt Mackall
28afeddddf test-run-tests: fix stdout/stderr io ordering 2014-08-13 14:05:08 -05:00
Yuya Nishihara
ea70238e6f alias: exit from bad definition by Abort 2014-08-13 22:22:24 +09:00
Yuya Nishihara
2d19d347a0 alias: show one-line hint for command provided by disabled extension
It will be a hint of Abort exception.  "hg help <alias>" provides the detailed
version as before.
2014-08-13 22:18:28 +09:00
Yuya Nishihara
5ffa20b315 help: provide help of bad alias without executing aliascmd()
The output is slightly changed because of minirst formatting.  Previously,
ui.pushbuffer() had no effect because "badalias" message was written to stderr.

"if not unknowncmd" should no longer be needed because there's no call loop.
2014-08-13 19:38:47 +09:00
Yuya Nishihara
02fa6ed1f7 alias: provide "unknowncmd" flag to tell help to look for disabled command
This patch prepares for breaking the call loop: help.help_() -> cmdalias() ->
commands.help_() -> help.help_().
2014-08-13 19:28:42 +09:00
Matt Mackall
158e001efc run-tests: don't double lines on build failure output 2014-08-12 11:17:29 -05:00
Matt Mackall
696a2d25ed test-run-tests: filter pwd alias for Windows 2014-08-12 11:10:57 -05:00
Matt Mackall
4437029857 run-tests: self-test on Windows needs binary streams 2014-08-12 11:02:30 -05:00
Matt Mackall
17ab77f157 repoview: filter tags to non-existent nodes from blockers (issue4328) 2014-08-12 02:40:42 -05:00
Michael O'Connor
306b55bcc9 revset: bookmark revset interprets 'literal:' prefix correctly (issue4329) 2014-08-11 23:45:08 -04:00
Matt Mackall
f40cbba38d unbundle: fix pyflakes warning about wc 2014-08-11 13:10:00 -05:00
Matt Mackall
65d57189d4 unbundle: don't advance bookmarks (issue4322) (BC)
This behavior didn't make much sense and interacts badly with things
that use unbundle internally like shelve. Presumably, the original
rationale was that since bundles didn't contain bookmarks, this gave a
sense of keeping bookmarks up-to-date like would happen with a
corresponding pull. However, since it only updated the current active
bookmark, and bare update already did that anyway, this is pretty
slim.

Notably, the corresponding test actually works better without this
feature.
2014-08-10 23:09:23 -05:00
Matt Mackall
2bfc2c18d4 tests: more bundle2 non-binary file test fixes 2014-08-10 15:26:12 -05:00
Matt Mackall
7a68007f38 hgweb: avoid config object race with hgwebdir (issue4326)
Turns out hgwebdir passes full repo objects to each hgweb request
instance, but with a shared baseui. We explicitly break the sharing.
2014-08-10 13:53:36 -05:00
Matt Mackall
8bff782c4b test-commandserver.py: filter path separator
Was failing on Windows:

-bundle.mainreporoot=$TESTTMP/repo
+bundle.mainreporoot=$TESTTMP\repo
2014-08-09 16:15:52 -05:00