Commit Graph

21106 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
6750e4199f tests: ignore "undefined name 'memoryview'" pyflakes error on earlier Python
Before this patch, "test-check-pyflakes.t" shows unexpected "undefined
name 'memoryview'" error for "mercurial/util.py" on Python 2.6.x or
earlier, because they don't define symbol 'memoryview'.

This patch introduces excluding patterns into "filterpyflakes.py" to
ignore "undefined name 'memoryview'" pyflakes error on Python 2.6.x or
earlier
2014-05-09 08:44:53 +09:00
FUJIWARA Katsunori
0c74e7c7d1 mq: eliminate unused variable for test-check-pyflakes.t
"user" in "fold()" has become useless since ab68b153ce34.
2014-05-09 08:44:53 +09:00
Mads Kiilerich
9fb157e3d1 merge: make debug output slightly more helpful by including message for action
Make recently introduced messages more useful. Instead of:
  f1: g
  f2: m
say:
  f1: remote is newer -> g
  f2: versions differ -> m
2014-04-22 02:09:24 +02:00
Mads Kiilerich
08d77f475a merge: simplify mergestate iter 2012-05-13 17:45:08 +02:00
Matt Mackall
0cb0a7ba67 resolve: simplify "finished" message
The recently introduced message was:

  no unresolved files; you may continue your unfinished operation

This had three problems:

- looks a bit like an error message because it's not saying "we've
  just resolved the last file"
- refers to "unfinished operation", which won't be the case with
  "update" or "merge"
- introduces semicolons to error messages, which is stylistically
  questionable

I've simplified this to:

  no more unresolved files

In the future, if we want to prompt someone to continue a particular operation, we should use
a hint style:

  no more unresolved files
  (use 'hg graft --continue' to finish grafting)
2014-05-09 14:46:50 -05:00
Gregory Szorc
85e363fea8 resolve: print message when no unresolved files remain (issue4214)
When using resolve, users often have to consult with the output of |hg
resolve -l| to see if any unresolved files remain. This step is tedious
and adds overhead to resolving.

This patch will notify a user if there are no unresolved files remaining
after executing |hg resolve|::

    no unresolved files; you may continue your unfinished operation

The patch stops short of telling the user exactly what command should be
executed to continue the unfinished operation. That is because this
information is not currently captured anywhere. This would make a
compelling follow-up feature.
2014-04-18 22:19:25 -07:00
Gregory Szorc
3f06fc8ed0 resolve: print warning when no work performed (issue4208)
Previously, if the paths specified as arguments to |hg resolve| were
invalid, they were silently ignored and a no-op would ensue.

This patch fixes that in some scenarios.

If none of the paths specified to |hg resolve| match a path that is in
mergestate, a warning will be emitted.

Ideally, a warning would be emitted for every path/pattern specified
that doesn't match anything. To achieve this would require significant
refactoring of the matching subsystem. That work is beyond the scope of
this patch series. Something is better than nothing and this patch
gets us something.
2014-04-18 18:56:26 -07:00
Gregory Szorc
8e5e922c37 resolve: abort when not applicable (BC)
The resolve command is only relevant when mergestate is present.
This patch will make resolve abort when no mergestate is present.

This change will let people know when they are using resolve when they
shouldn't be. This change will let people know when their use of resolve
doesn't do anything.

Previously, |hg resolve -m| would allow mergestate to be created. This
patch now forbids that. Strictly speaking, this is backwards
incompatible. The author of this patch believes creating mergestate via
resolve doesn't make much sense and this side-effect was unintended.
2014-04-18 19:08:32 -07:00
Gregory Szorc
2ec67abea0 resolve: split test
Part of test-resolve.t is split into multiple tests to create an
injection point for new tests that will be added in subsequent patches.
2014-04-18 18:26:42 -07:00
Gregory Szorc
f5e1a458cd resolve: use early continue and deindent 2014-04-18 18:19:46 -07:00
Gregory Szorc
51ef803e15 mergestate: consistently set variables to None
Some code branches and exceptional circumstances such as empty
mergestate files could result in mergestate._local and
mergestate._other not being defined or reset to None. These variables
are now correctly set to None when they should be.
2014-05-08 16:48:28 -07:00
Durham Goode
f94c8279f1 changegroup: refactor outgoing logic into a function
Extensions that add to bundle2 will want to know which commits are outgoing so
they can bundle data that is appropriate to those commits. This moves the logic
for figuring that out to a separate function so extensions can do the same
computation.
2014-05-07 17:22:34 -07:00
Durham Goode
b6215551f6 bundle2: fix bundle2 pulling all revs on empty pulls
When bundle2 was enabled, if hg pull had no commits to pull, it would print
'no changes found' and then download the entire repository from the server. This
was caused by heads and common being set to None, which gets treated as
heads=cl.heads() and common=[nullid], which means download the entire repo.

Pulling bundles without a changegroup is a valid use case (like if we're just
updating bookmarks), so this modifes the bundle code to allow not adding
changegroups.
2014-05-07 17:24:19 -07:00
Pierre-Yves David
939522ccda exchange: fix bad indentation
Those two lines where double indented for no good reasons.
2014-05-07 19:26:15 -07:00
Pierre-Yves David
daf07a6cab exchange: propagate arguments to the _getbundleextrapart function
The arguments was wrongly propagated (again).
2014-05-07 19:28:17 -07:00
Durham Goode
eb648a3682 bundle2: fix configuration name mismatch
During pulls bundle2 was checking server.bundle2, but during pushes it was
checking experimental.bundle2. This makes them both experimental.bundle2.
2014-05-07 17:20:38 -07:00
Matt Mackall
dc3027aa51 build: initial support for in-tree autobuilding recipes 2014-05-07 17:58:13 -05:00
Gregory Szorc
02f50211af tests: declare commands using decorator 2014-05-04 22:48:07 -07:00
Gregory Szorc
3eeb610c1f share: declare commands using decorator 2014-05-04 21:33:14 -07:00
Gregory Szorc
a47c384be9 relink: declare command using decorator 2014-05-04 21:52:25 -07:00
Gregory Szorc
5785fc1837 record: declare commands using decorator 2014-05-04 22:35:37 -07:00
Gregory Szorc
b5af9e8e96 hgk: declare commands using decorator 2014-05-04 21:31:51 -07:00
Gregory Szorc
6a131815b2 color: declare command using decorator 2014-05-04 21:48:10 -07:00
Gregory Szorc
0ed519bc78 children: declare command using decorator 2014-05-04 21:46:49 -07:00
Gregory Szorc
87523a615f fetch: declare command using decorator 2014-05-04 21:48:41 -07:00
Gregory Szorc
07cdf48f61 extdiff: declare command using decorator 2014-05-04 21:54:01 -07:00
Gregory Szorc
765d0d4271 churn: declare command using decorator 2014-05-04 21:46:24 -07:00
Gregory Szorc
624f6f242c convert: declare commands using decorator 2014-05-04 21:17:04 -07:00
Gregory Szorc
b477c96e34 debugshell: declare command using decorator 2014-05-04 21:19:31 -07:00
Gregory Szorc
57fd68116b largefiles: declare commands using decorator 2014-05-04 21:09:06 -07:00
FUJIWARA Katsunori
a34a9f5100 cmdutil: omit redundant "savecommitmessage()" in "tryimportone()"
The preceding patch causes that "makememctx()" with "editor" argument
saves (manually edited) commit message into ".hg/last-message.txt":
saving itself is executed indirectly in "memctx.__init__()".

This makes it redundant to invoke "savecommitmessage()" on caller side
of "makememctx()".

This patch omits such redundant "savecommitmessage()" invocation in
"tryimportone()".

"tryimportone()" uses one of "commiteditor" or "commitforceeditor" as
"editor" argument, and this causes saving commit message always.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
c6286fa71f amend: use "editor" argument for "memctx.__init__" to save commit message
This patch uses "editor" argument of "memctx.__init__" to save commit
message, instead of explicit editor invocation and saving commit
message by "localrepository.savecommitmessage()".

By passing one of "commiteditor" or "commitforceeditor" as "editor",
"memctx.__init__" saves commit message, even when editor invocation is
not needed.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
741eb22d11 histedit: pass "editor" argument to "memctx.__init__()" for "collapse" command
The preceding patch causes that "memctx.__init__()" with "editor"
argument invokes editor and saves edited commit message into
".hg/last-message.txt".

This patch passes "editor" argument to "memctx.__init__()" instead of
explicit invocations of "commitforceeditor()" and
"savecommitmessage()" for "collapse" command.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
a569398722 context: move editor invocation from "makememctx()" to "memctx.__init__()"
This patch introduces "editor" argument to "memctx.__init__()", and
moves editor invocation from "makememctx()" to "memctx.__init__()", to
centralize editor invocation into "memctx" object creation.

This relocation is needed, because "makememctx()" requires the "store"
object providing "getfile()" to create "memfilectx" object, and this
prevents some code paths from using "makememctx()" instead of
"memctx.__init__()".

This patch also invokes "localrepository.savecommitmessage()", when
"editor" is specified explicitly, to centralize saving commit message
into "memctx" object creation: passing "cmdutil.commiteditor" as
"editor" can achieve both suppressing editor invocation and saving
into ".hg/last-message.txt" for non empty commit messages.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
ec5abb7d1f localrepo: add "editor" argument to "tag()"
Before this patch, "localrepository.tag()" doesn't take "editor"
argument, and this prevents callers from passing "editor" argument to
"localrepository.commit()" invoked internally.

This patch adds "editor" argument to "localrepository.tag()" (and
"_tag()", too), and makes "commands.tag()" invoke it with "editor"
argument.

This patch also omits explicit "localrepository.savecommitmesssage()"
invocation, because "localrepository.commit()" will invoke specified
"editor" and save edited commit message into ".hg/last-message.txt"
automatically.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
8430e60754 qrefresh: use "editor" argument of "commit()" instead of explicit "ui.edit()"
Before this patch, "hg qrefresh" and "hg qfold" invoke "ui.edit()"
explicitly to get commit message edited manually.

This requires explicit "localrepository.savecommitmessage()"
invocation to save edited commit message into ".hg/last-message.txt",
because unexpected exception raising may abort command execution
before saving it in "localrepository.commit()".

This patch uses "editor" argument of "localrepository.commit()"
instead of explicit "ui.edit()" invocation for "hg qnew" and "hg qfold"

"localrepository.commit()" will invoke "desceditor()" function newly
added by this patch, and save edited commit message into
".hg/last-message.txt" automatically.

This patch passes not "editor" but "desceditor" to "commit()", because
"hg qnew" and "hg qfold" require editor function to return edited
message (and invoke "patchheader.setmessage()" with it) if not empty,
or default message otherwise.

This patch also avoids "not q.applied" check at "hg qrefresh --edit",
because it is also checked in "queue.refresh()", and it is not needed
to get commit message from patch header before "queue.refresh()".
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
0a1ee5ebe2 qrefresh: relocate message/patch-header handling to delay message determination
Before this patch, commit message for refreshed MQ changeset is
determined, and written into refreshed patch file before
"localrepository.commit()" invocation.

This makes refactoring to use "editor" argument of "commit()" instead
of explicit "ui.edit()" invocation in succeeding patch difficult.

This patch relocates message/patch-header handling to delay message
determination.
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
9cb2df4ecc qnew: use "editor" argument of "commit()" instead of explicit "ui.edit()"
Before this patch, "hg qnew" invokes "ui.edit()" explicitly to get
commit message edited manually.

This requires explicit "localrepository.savecommitmessage()"
invocation to save edited commit message into ".hg/last-message.txt",
because unexpected exception raising may abort command execution
before saving it in "localrepository.commit()".

This patch uses "editor" argument of "localrepository.commit()"
instead of explicit "ui.edit()" invocation for "hg qnew".

"localrepository.commit()" will invoke "desceditor()" function newly
added by this patch, and save edited commit message into
".hg/last-message.txt" automatically.

This patch passes not "editor" but "desceditor" to "commit()", because
"hg qnew" requires editor function to return edited message if not
empty, or default message otherwise.

This patch applies "rstrip()" on "defaultmsg" at comparison between
"nctx.description()" and "defaultmsg", because the former should be
stripped by "changelog.stripdesc()" and the latter may have tail white
spaces inherited from "patchfn".
2014-05-05 21:26:40 +09:00
FUJIWARA Katsunori
6e45a5e5e2 histedit: use "editor" argument of "commit()" instead of explicit "ui.edit()"
Before this patch, "message" action of "hg histedit" uses "ui.edit()"
explicitly to get commit message edited manually.

This requires explicit "localrepository.savecommitmessage()"
invocation to save edited commit message into ".hg/last-message.txt",
because unexpected exception raising may abort command execution
before saving it in "localrepository.commit()".

This patch uses "editor" argument of "localrepository.commit()"
instead of explicit "ui.edit()" invocation for "message" action of "hg
histedit"

"localrepository.commit()" will invoke "editor()" function newly added
in this patch, and save edited commit message into ".hg/last-message.txt"
automatically.
2014-05-05 21:26:40 +09:00
Yuya Nishihara
2e43b76140 test-pyflakes: detect undefined name error
It should be able to catch the following mistakes at 764c0874d3c8:

    mercurial/exchange.py:590: undefined name 'UnknownPartError'
    mercurial/match.py:346: undefined name 'pat'
    mercurial/win32.py:365: undefined name '_ERROR_NO_MORE_FILES'
    tests/killdaemons.py:46: undefined name 'check'
2014-04-29 12:54:01 +09:00
Yuya Nishihara
50920757c6 run-tests: initialize global variables to suppress pyflakes warning 2014-05-02 18:25:23 +09:00
Matt Mackall
4a8dbad0a6 merge with stable 2014-05-06 12:47:59 -05:00
Thomas Arendsen Hein
aedd3b060c setup.py, make: avoid problems with outdated, existing hgext/__index__.py*
"make clean" already removed __index__.py[cdo], but not the __index__.py
(automatically generated by "python setup.py build_hgextindex").

"setup.py build_hgextindex" did not generate a new index if file
__index__.py[cdo] already existed, because if __index__.py was removed,
the compiled file containing the old information was imported and used.
Generate an empty file (with a new timestamp to generate a new .py[cdo])
instead and make mercurial.extensions ignore the unset docs attribute.

One of the problems was a failed test-help.t, to reproduce:

$ rm hgext/__index__.py*
$ echo 'docs = {"mq": "dummy"}' > hgext/__index__.py
$ make test-help.t

With this a "make clean" or "python setup.py build_hgextindex" helps.
2014-05-05 16:54:15 +02:00
Mads Kiilerich
99c7bacd5e color: don't fail on error messages when no curses (issue4237)
The error only occured when Python didn't have curses - such as on Windows and
when Python was built without curses support.

No curses can also be emulated by (re)moving .../lib/python2.7/curses/ from the
Python installation.

It is left as an exercise to figure out exactly what changed in Mercurial that
triggered this error.
2014-05-03 03:29:30 +02:00
Steve Borho
bb09f925ca win32: backout 6891e5c66508
This change conflicted with TortoiseHg's use of QFileSystemWatcher. Files which
were being monitored (for file-system events) were unable to be reliably updated
using util.atomictempfile.  Often the update would error out in the middle of
the process leaving neither the old or the new file in place.

My guess is that _kernel32.CreateFileA() is triggering an exception that is
not handled correctly within unlink()
2014-05-03 10:33:54 +02:00
Yuya Nishihara
9ac7efcc5e factotum: initialize global variables to suppress pyflakes warning 2014-05-02 18:24:10 +09:00
Matt Mackall
90abbd742c test-check-code-hg: use locate instead of manifest 2014-05-05 13:42:08 -05:00
Matt Mackall
066106a597 test-check-code-hg: drop manual check of non-.py scripts 2014-05-05 13:41:29 -05:00
Matt Mackall
e8b8876b1e test-check-code-hg: use test-repo check 2014-05-05 13:42:58 -05:00
Matt Mackall
ff4d16ffda check-code: look at shebang to identify Python scripts 2014-05-05 13:37:59 -05:00