Commit Graph

4304 Commits

Author SHA1 Message Date
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
Mads Kiilerich
34f9998bde rebase: empty revset should be a gentle no-op with exit code 1, not an error 2014-05-01 16:47:50 +02:00
Mads Kiilerich
9a144bfa2e largefiles: better handling of log from other working directory (issue4236)
When invoked from another directory, the matchers m._cwd will be the absolute
path. The code for calculating relative path to .hglf did not consider that and
log would fail with weird errors and paths.

For now, just don't do any largefile magic when invoked from other directories.
2014-05-01 15:12:49 +02:00
Julien Cristau
24f866301b rebase: don't abort if we're asked to rebase an empty revset
The documentation says we exit 1 if we have nothing to do, so avoid
breaking that contract when we're passed an empty revset.

This was changed in http://www.selenic.com/hg/rev/1d4f2abc281b to
improve the error message; keep the improved message, just not the
abort.
2014-04-23 13:51:35 +02:00
Matt Harbison
66d98ca80b largefiles: remove directories emptied after their files are moved (issue3515) 2014-04-25 22:34:09 -04:00
Yuya Nishihara
178ed58ae3 color: add missing handling of stderr capture introduced by 1428763bd397
It wouldn't raise exception without this change, but _bufferstates was wrong
because of missing _bufferstates.pop() in colorui.popbuffer().
2014-04-27 15:09:48 +09:00
Wagner Bruna
7f9ce654b1 histedit, i18n: replace '+' with concatenation to make hggettext happy 2014-04-22 10:14:16 -03:00
Isaac Jurado
3b2cb9598b churn: compute padding with unicode strings
Most UTF-8 aware terminals convert multibyte sequences into a single displayed
characters.  Because the first column is padded by counting bytes, the second
column is not perfectly aligned in the presence of non ASCII characters.
2014-04-19 15:11:25 +02:00
Lucas Moscovicz
097fe28381 largefiles: changed overridelog to work with graphlog
Log for largefiles was failing for graph log since it was overriding match
instead of matchandpats.

[Mads Kiilerich modified this patch to address his review comments and ended up
rewriting/removing most of it.]
2014-03-05 15:55:09 -08:00
FUJIWARA Katsunori
c0e0086074 i18n: fix "% inside _()" problem 2014-04-16 03:05:00 +09:00
Mads Kiilerich
fafe3113c1 largefiles: revert override, install matchfn outside the try/except restoring it 2014-04-13 18:45:43 +02:00
Mads Kiilerich
2ef89034e8 largefiles: simplify revert - use getstandinsstate like other commands do 2013-04-28 13:18:25 +02:00
Mads Kiilerich
b5e830d7be largefiles: remove dummy assignments for creating an already existing closure 2014-04-13 18:45:43 +02:00
Mads Kiilerich
2cc2b0c179 largefiles: remove silent handling of incorrect invocation of restorematchfn
It is better to get a crash than to continue without noticing errors.
2014-04-13 18:45:43 +02:00
Mads Kiilerich
4308622a72 largefiles: copy override, install matchfn outside the try/except restoring it 2014-04-13 18:45:43 +02:00
Mads Kiilerich
a14df815dc largefiles: clarify installmatchfn documentation 2014-04-13 18:45:43 +02:00
Mads Kiilerich
b4a84e042b largefiles: use more reasonable locking for update 2013-04-27 23:19:52 +02:00
Mads Kiilerich
368894e240 largefiles: full debugdirstate functionality for largefiles
- just reusing the original command with a mockup repo.

This makes it possible to see dates in the lfdirstate and gives less code
duplication.
2013-04-27 23:19:52 +02:00
Mads Kiilerich
4d1cd6d065 largefiles: make cat on standins do something
cat of a standin would silently fail.

The use of standins is mostly an implementation detail, but it is already a bit
leaking. Being able to see the content of standins might be convenient for
debugging.
2013-04-27 23:19:52 +02:00
Mads Kiilerich
6cef420525 largefiles: remove confusing handling of .bad return value - it is void 2014-04-13 18:45:43 +02:00
Mads Kiilerich
428d9fe9e0 largefiles: fix profile of unused largefilesdirstate._ignore 2013-10-03 18:01:21 +02:00
Mads Kiilerich
7cd32f165e largefiles: import whole modules instead of importing parts of them
Be more friendly to demandimport.
2014-04-08 00:48:36 +02:00
Mads Kiilerich
fc84595707 largefiles: update should only create a .orig backup of a largefile once
A .orig of a standin after the update do that a .orig of the actual largefile
is created. The .orig standin was however never removed again and the largefile
.orig was thus overwritten again and again.

The fix: remove the standin .orig when it is used.
2013-04-18 18:56:18 +02:00
Mads Kiilerich
5a86bd87e5 merge: pass merge ancestor to calculateupdates as a list
The list will so far always have one element.
2014-04-06 13:39:51 +02:00
Mads Kiilerich
41480e1b79 merge: move ancestor selection tweaking from manifestmerge to update function
- passing it through calculateupdates.

This will make sure manifestmerge actually use the ancestor it is given.
2014-04-06 13:39:51 +02:00
Mads Kiilerich
f92d923209 convert: backout 41e062383fc9 and 80f42131aca3 -closemap
Closemap solves a very specific use case. It would be better to have a more
generic solution than to have to maintain this forever.

Closemap has not been released yet and removing it now will not break any
backward compatibility contract.

There is no test coverage for closemap but it seems like the same can be
achieved with a simple and much more powerful custom extension:

import hgext.convert.hg
class source(hgext.convert.hg.mercurial_source):
    def getcommit(self, rev):
        c = super(source, self).getcommit(rev)
        if rev in ['''
d643f67092ff123f6a192d52f12e7d123dae229f
3a6a38229d418ba09cb7784c01453a93b4d363f8
facceca31c18f7ef800977055dbcbd7fcb5c5cb2
''']:
            c.extra = c.extra.copy()
            c.extra['close'] = '1'
        return c
hgext.convert.hg.mercurial_source = source
2014-04-16 01:10:08 +02:00
Mads Kiilerich
46b435b7d3 convert: backout 8a62813ea220 and ca6679798c95 - tagmap
Tagmap solves a very specific use case. It would be better to have a more
generic solution than to have to maintain this forever.

Tagmap has not been released yet and removing it now will not break any
backward compatibility contract.

There is no test coverage for tagmap but it seems like the same can be achieved
with a (relatively) simple and much more powerful custom extension:

import hgext.convert.hg
def f(tag):
    return tag.replace('some', 'other')
class source(hgext.convert.hg.mercurial_source):
    def gettags(self):
        return dict((f(tag), node)
                    for tag, node in in super(source, self).gettags().items())
    def getfile(self, name, rev):
        data, flags = super(source, self).getfile(name, rev)
        if name == '.hgtags':
            data = ''.join(l[:41] + f(l[41:]) + '\n' for l in data.splitlines())
        return data, flags
hgext.convert.hg.mercurial_source = source
2014-04-16 01:09:49 +02:00
Pierre-Yves David
c9703fe999 bundle2: add a ui argument to readbundle
The bundle2 unbundler needs a ui argument. We are now passing this information
to `readbundle`.
2014-04-14 15:45:30 -04:00
Pierre-Yves David
009e9f6c33 bundle2: move readbundle into the exchange module
The `readbundle` function is going to understand the bundle2 header. We move the
function to a more suitable place before making any other changes.
2014-04-14 15:33:50 -04:00
Mads Kiilerich
6c7f6f30ff patchbomb: warn when emailing a dirty working directory parent 2014-04-07 23:10:20 +02:00
FUJIWARA Katsunori
039223a68b largefiles: remove no more referred "getoutgoinglfiles()" 2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
0c85153450 largefiles: use "outgoinghooks" to avoid redundant outgoing check
Before this patch, "hg outgoing" invokes "findcommonoutgoing()" not
only in "commands.outgoing()" but also in
"overrides.overrideoutgoing()" (via "getoutgoinglfiles()"), when
largefiles is enabled. The latter is redundant.

This patch uses "outgoinghooks" to avoid redundant outgoing check.

Newly introduced function "overrides.outgoinghook()" is registered
into "outgoinghooks" to get the result of outgoing check in
"commands.outgoing()".

It invokes "lfutil.getlfilestoupload()" directly with the result of
outgoing check to avoid redundant outgoing check in
"getoutgoinglfiles()": "sort()" is needed, because
"lfutil.getlfilestoupload()" doesn't sort the result of it.

This patch also omits "if toupload is None" ("No remote repo") case,
because failure of looking remote repository up should raise exception
in "commands.outgoing()" before invocation of "outgoinghooks".

Newly added "hg outgoing --large --graph" tests examine
"outgoinghooks" invocations in "hg outgoing --graph" code path.
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
22be41c2e5 largefiles: use "summaryremotehooks" to avoid redundant outgoing check
Before this patch, "hg summary --remote --large" invokes
"findcommonoutgoing()" not only in "commands.summary()" but also in
"overrides.overridesummary()" (via "getoutgoinglfiles()"). The latter
is redundant.

This patch uses "summaryremotehooks" to avoid redundant outgoing check.

Newly introduced function "overrides.summaryremotehook()" is
registered into "summaryremotehooks" to get the result of outgoing
check in "commands.summary()".

It invokes "lfutil.getlfilestoupload()" directly with the result of
outgoing check to avoid redundant outgoing check in
"getoutgoinglfiles()".
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
3da856bfcc largefiles: reuse "findcommonoutgoing()" result at "hg push"
Before this patch, "hg push" invokes "findcommonoutgoing()" not only
in "exchange.push()" but also in "lfilesrepo.push()", when largefiles
is enabled. The latter is redundant.

This patch registers own "prepushoutgoinghook" function into
"prepushoutgoinghooks" of "localrepository" to reuse
"findcommonoutgoing()" result.

"prepushoutgoinghook" omits "changelog.nodesbetween()" invocation,
because "findcommonoutgoing()" invocation in "exchange.push()" takes
"onlyheads" argument and it considers "nodesbetween()".
2014-04-16 00:37:24 +09:00
FUJIWARA Katsunori
a3f2ae29d0 largefiles: centralize the logic to get outgoing largefiles
Before this patch, "overrides.getoutgoinglfiles()" (called by
"overrideoutgoing()" and "overridesummary()") and "lfilesrepo.push()"
implement similar logic to get outgoing largefiles separately.

This patch centralizes the logic to get outgoing largefiles in
"lfutil.getlfilestoupload()".

"lfutil.getlfilestoupload()" takes "addfunc" argument, because each
callers need different information (and it is useful for enhancement
in the future).

  - "overrides.getoutgoinglfiles()" needs only filenames
  - "lfilesrepo.push()" needs only hashes of largefiles
2014-04-16 00:37:24 +09:00
Sean Farley
52b090aab5 color: add effect to the template symbol table
Previously, words like 'red' had to be protected by quotes before passing to
the label template function. Now, we add color effects to the symbol table so
that commands like,

$ hg log -r . -T "{label(red, node|short)}\n"

can work without the need for quoting.
2014-04-14 18:21:26 -05:00
Matt Mackall
6f3036019b merge with stable 2014-04-14 15:14:02 -04:00
FUJIWARA Katsunori
89625609bb histedit: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "message"
command in histedit-ing is not saved into ".hg/last-message.txt" until
it is saved by "localrepository.savecommitmessage()" in
"localrepository.commit()".

This may lose such commit message, if unexpected exception is raised.

This patch saves manually edited commit message for "message" comand
in histedit-ing into ".hg/last-message.txt" just after user editing.

This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.

This patch uses repository wrapping class for exception raising before
saving commit message in "localrepository.commit()" easily and
certainly, because such exception requires corner case condition.
2014-04-15 03:21:59 +09:00
Sean Farley
3c09c4d895 shelve: remove unused variable caught by pyflakes 2014-04-03 20:32:56 -05:00
FUJIWARA Katsunori
0eed53de6c i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that format string consists of multiple string
components concatenated implicitly or explicitly,

This patch does below for that regexp pattern to detect "% inside _()"
problems in such case.

  - put "+" into separator part ("[ \t\n]") for explicit concatenation
    ("...." + "...." style)

  - enclose "component and separator" part by "(?:....)+" for
    concatenation itself ("...." "...." or "...." + "....")
2014-04-01 02:46:03 +09:00
FUJIWARA Katsunori
01d8b27701 i18n: fix "% inside _()" problems
Before this patch, "contrib/check-code.py" can't detect these
problems, because the regexp pattern to detect "% inside _()" doesn't
suppose the case that the format string and "%" aren't placed in the
same line.

This patch replaces "\s" in that regexp pattern with "[ \t\n]" to
detect "% inside _()" problems in such case.

"[\s\n]" can't be used in this purpose, because "\s" is automatically
replaced with "[ \t]" by "_preparepats()" and "\s" in "[]" causes
nested "[]" unexpectedly.
2014-04-01 02:46:03 +09:00
FUJIWARA Katsunori
920a8f861c hg: introduce "wirepeersetupfuncs" to setup wire peer by extensions (issue4109)
Since changeset a8955c4d9ef5, "reposetup()" of each extensions is
invoked only on repositories enabling corresponded extensions.

This causes that largefiles specific interactions between the
repository enabling largefiles locally and remote (wire) peer fail,
because there is no way to know whether largefiles is enabled on the
remote repository behind the wire peer, and largefiles specific
"wireproto functions" are not given to any wire peers.

To avoid this problem, largefiles should be enabled in wider scope
than each repositories (e.g. user-wide "${HOME}/.hgrc").

This patch introduces "wirepeersetupfuncs" to setup wire peer by
extensions already enabled. Functions registered into
"wirepeersetupfuncs" are invoked for all wire peers.

This patch uses plain list instead of "util.hooks" for
"wirepeersetupfuncs", because the former allows to control order of
function invocation by order of extension enabling: it may be useful
for workaround of problems with combination of enabled extensions
2014-03-29 01:20:07 +09:00
Mads Kiilerich
f6b400481f convert: more clear documentation of the 'include' default of a 'include .'
At first glance it can be confusing that adding a superfluous include directive
will exclude more files.
2014-03-19 00:19:54 +01:00
FUJIWARA Katsunori
7ccf898121 histedit: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "fold" command
in histedit-ing is never saved into ".hg/last-message.txt", because it
uses "localrepository.commitctx()" instead of
"localrepository.commit()": saving into ".hg/last-message.txt" is
executed only in the latter.

This patch saves manually edited commit message for "fold" command in
histedit-ing into ".hg/last-message.txt" just after user editing.

This is the simplest implementation to fix on stable. Editing and
saving commit message for memctx should be centralized into the
framework like "localrepository.commit()" with "editor" argument or so
in the future.
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
d87cd6b53c qfold: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg qfold -e"
isn't saved into ".hg/last-message.txt" until it is saved by
"localrepository.savecommitmessage()" in "localrepository.commit()".

This may lose such commit message, if unexpected exception is raised.

This patch saves manually edited commit message for "hg qfold -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m/-l options as same as other commands.

This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.

This patch uses repository wrapping class for exception raising before
saving commit message in "localrepository.commit()" easily and
certainly, because such exception requires corner case condition.
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
84f2d9a815 qnew: save manually edited commit message into ".hg/last-message.txt"
Before this patch, manually edited commit message for "hg qnew -e"
isn't saved into ".hg/last-message.txt" until it is saved by
"localrepository.savecommitmessage()" in "localrepository.commit()".

This may lose such commit message, if unexpected exception is raised.

This patch saves manually edited commit message for "hg qnew -e" into
".hg/last-message.txt" just after user editing. This patch doesn't
save the message specified by -m/-l options as same as other commands.

This is the simplest implementation to fix on stable. Editing and
saving commit message should be centralized into the framework of
"localrepository.commit()" with "editor" argument in the future.

This patch uses repository wrapping class for exception raising before
saving commit message in "localrepository.commit()" easily and
certainly, because such exception requires corner case condition.
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
3a5dd1f5ac rebase: use "commitforceeditor" instead of "ui.edit()" for "--collapse"
Before this patch, "rebase --collapse --edit" without "--message" and
"--logfile" invokes editor twice unexpectedly:

  1. explicit "ui.edit()" invocation in rebase extension itself

  2. indirect invocation in "localrepository.commit()" with "editor =
     commitforceeditor" assigned by "--edit" option

This patch uses indirect "commitforceeditor" invocation instead of
"ui.edit()" for "--collapse" without "--message" and "--logfile" to:

  - suppress redundant the former invocation
  - ensure editor invocation even when "--edit" is not specified
2014-03-19 01:07:41 +09:00
FUJIWARA Katsunori
7a7d1bc22c templater: avoid recursive evaluation of string literals completely
Changeset c84f81c3e120 (released with 2.8.1) fixed "recursively
evaluate string literals as templates" problem (issue4103) by
introducing "_evalifliteral()".

But some parts in template expressions below are still processed by
the combination of "compiletemplate()" and "runtemplate()", and may
cause same problem unexpectedly.

  - 'init' and 'hang' of 'fill(text, width, init, hang)'
  - 'expr' of 'sub(pat, repl, expr)'
  - 'label' of 'label(label, expr)'

This patch processes them by "_evalifliteral()" instead of the
combination of "compiletemplate()" and "runtemplate()" to avoid
recursive evaluation of string literals completely.
2014-03-10 01:01:42 +09:00
anuraggoel
08543b09f1 purge: avoid duplicate output for --print (issue4092)
Now "hg purge -p" commands avoids printiing duplication of filenames.

Second patch is the test coverage of first patch which tells that '-p'
does not depend on whether ui.verbose is configured or not,that means it
is independent of '-v'.
2014-02-25 06:30:21 +05:30
Yuya Nishihara
c857975766 rebase: do not try to reactivate deleted divergent bookmark
If the currently active bookmark is divergent one, it may be resolved during
rebase.  Trying to activate it will raise "KeyError: 'W@diverge'".
2014-02-15 16:19:19 +09:00