Commit Graph

5569 Commits

Author SHA1 Message Date
Jun Wu
cbd2df17c1 chgserver: remove _clearenvaliases
Since we expand environment variables in alias lazily, the _clearenvaliases
hack is no longer necessary.

This resolves an issue that a non-shell alias which has environment variables
in its arguments and is set to use pager will not use pager running with chg.
2016-05-06 23:57:56 +01:00
liscju
45a5b8ca24 largefiles: makes verify batching stat calls to remote
Instead of sending stat calls for each files separately, it sends
one batch call with stat invocations for all files.
2016-05-03 23:48:31 +02:00
liscju
31a5cfa252 largefiles: change basestore._verifyfile to take list of files to check
Makes it easier to use batch stat calls in remotestore to decrease
number of round trips.
2016-05-03 23:31:32 +02:00
timeless
95228c418a rebase: handle successor targets (issue5198)
When a parent has a successor (indicated by revprecursor in state),
we need to use it.
2016-04-11 21:33:07 +00:00
Christian Ebert
81c2d303c5 keyword: replace use of _filerev with _filenode
To be independent of rev numbers.
Analogous to b558712637b8.
2016-04-19 11:00:15 +01:00
Blake Burkhart
a5bebc504a convert: pass absolute paths to git (SEC)
Fixes CVE-2016-3105 (1/1).

Previously, it was possible for the repository path passed to git-ls-remote
to be misinterpreted as a URL.

Always passing an absolute path to git is a simple way to avoid this.
2016-04-06 22:57:46 -05:00
Pierre-Yves David
aab6e0ee27 rebase: restrict rebase destination to the pulled set (issue5214)
Before this patch, `hg pull --rebase` would be a strict sequence of `hg pull`
followed by `hg rebase` if anything was pulled.

Now that rebase pick his default destination the same way than merge, than
`hg rebase` step would abort in the case the repo already had multiple anonymous
heads (because of the ambiguity). (changed in 8822059a608a)

The intend of the user with `hg pull --rebase` is clearly to rebase on pulled
content. This used to be (mostly) enforced by the former default destination for
rebase, "tipmost changeset of the branch" as the tipmost would likely a
changeset that just got pulled. But this intended was no longer enforced with
the new defaul destination (unified with merge).

This changeset makes use of the '_destspace' mechanism introduced in the previous
changeset to enforce this.

This partially fixes issue5214 as no change at all have been made to the new
handling of the case with bookmark (unified with merge).
2016-04-30 18:39:39 +02:00
Pierre-Yves David
da0dc4d591 destutil: add the ability to specify a search space for rebase destination
In the 'hg pull --rebase', we don't want to pick a rebase destination unrelated
to the pull, we lay down basic infrastructure to allow such restriction on
stable (before 3.8 release) in this case. See issue 5214 for details.

Actual usage and test will be in the next patch.
2016-04-30 18:41:08 +02:00
timeless
85999ce49e patchbomb: use single quotes around command hint
Windows command lines use double quotes to quote arguments with spaces.
This change is in a series to unify around using single quotes around
commands, and double quotes around interior arguments.

This changeset is taken on stable for consistency with similar update done
before the freeze.
See dc90bb772edc, 675a0be03493, 518b94d8f911 and 149a699cfd98.
2016-04-14 15:15:49 +00:00
Pulkit Goyal
e613a4c10d py3: make factotum use absolute_import
check-code complains for using urllib2 so that too was fixed.
2016-04-17 02:29:33 +05:30
Pulkit Goyal
d623f99ed3 py3: make extdiff use absolute_import 2016-04-17 02:15:05 +05:30
Pulkit Goyal
e8c7dbca1d py3: make eol use absolute_import 2016-04-17 02:10:55 +05:30
Pulkit Goyal
570e0beb47 py3: make color use absolute_import 2016-04-17 00:53:56 +05:30
timeless
0dd163b523 fetch: use single quotes around command hint
Windows command lines use double quotes to quote arguments with spaces.
This change is in a series to unify around using single quotes around
commands, and double quotes around interior arguments.
2016-04-14 15:20:11 +00:00
Yuya Nishihara
b427a832a6 notify: do not load style file if template is specified (BC)
This patch makes sure that either "tmpl" or "mapfile" is exclusively set,
which is the same behavior as common log-like templates and formatter outputs.

See the previous patch for why.
2016-04-04 22:50:50 +09:00
Yuya Nishihara
59e8edaa91 bugzilla: do not load style file if template is specified (BC)
This prepares for the API change to support template aliases. I'm going to
extract a factory function of templater that reads a map file:

  # original
  templater(mapfile, ..., cache, ...)
  # new
  templater.frommapfile(mapfile, ...)  # read mapfile to build cache/map
  templater(..., cache, ...)           # use specified cache (= map elements)

This will make it clear to isolate stock styles (i.e. map files) from user
aliases. Template aliases should be applied to command arguments and templates
in hgrc, but not to map files. Otherwise, our stock styles and web templates
could be modified unintentionally.

This patch makes sure that either "tmpl" or "mapfile" is exclusively set. It's
theoretically a behavior change, since you could put new keywords in template
by defining them in a map file before:

  # mapfile
  foo = "{rev}"
  # hgrc
  [bugzilla]
  style = mapfile
  template = {foo}

But the old behavior would be a bug because bugzilla.template is documented
as "overrides style if specified". Also, common log-like templates and
formatter doesn't allow using mapfile-keywords in a separate template. So
I decided to make a BC.

Since there was no test for the bugzilla extension, this adds new test that
covers style/template output.
2016-04-04 22:48:34 +09:00
timeless
2778e2894f patchbomb: fix public-is-missing hint
Without this, there is no space between a hash and the -r preceding the next
line in the use hg push hint
2016-04-14 14:26:37 +00:00
Martijn Pieters
7d4b1c457a logtoprocess: new experimental extension
This extension lets you direct specific ui.log() information to shell
commands, spawned in the background. This can be used to, say, capture
timings, commandfailure tracebacks, etc., making the output available
to other command-line tools.
2016-04-05 17:39:59 +01:00
Mads Kiilerich
274ba69e53 convert: keep converted hg parents that are outside convert.hg.revs (BC)
Before, when converting revisions without also including their already
converted parents in convert.hg.revs, the parents would no longer be parents.

That seems unfortunate and we dare to assume that nobody ever wants that.

Instead, preserve parents that are outside the current convert range but
already have been converted.

The parents returned in getcommit() are unconditionally converted, so we
introduce a separate optparents with optional parents.
2016-04-13 00:16:21 +02:00
timeless
109fcbc79e pycompat: switch to util.urlreq/util.urlerr for py3 compat 2016-04-06 23:22:12 +00:00
Mads Kiilerich
069bac6a3e largefiles: introduce push --lfrev to control which revisions are pushed
The default of pushing all largefiles referenced in outgoing revisions is safe,
but also expensive and sometimes not what is needed. We thus introduce a
--lfrev option, similar to what pull already has.

By specifying an empty set of revisions (or null), it is possible to get lazy
(and insecure!) pushes of revisions without referenced largefiles, similar to
how pull works.
2016-03-27 13:00:28 -07:00
Mads Kiilerich
66a29f6996 largefiles: don't access repo.changelog directly in getlfilestoupload
Make it possible to pass both nodes and revisions to getlfilestoupload.
2016-04-13 01:45:45 +02:00
Mads Kiilerich
940d175900 localrepo: refactor prepushoutgoinghook to take a pushop
prepushoutgoinghook was introduced in 8dfcd476a7f7 and largefiles is the only
in-tree use of it. Refactor it to be more useful for other use cases in
largefiles.
2016-04-13 01:09:11 +02:00
Oleg Afanasyev
2f8e102f8e shelve: refactor directory name into constant
Shelve directory name extracted into constant to avoid typos/duplication.
2016-04-08 23:33:28 -07:00
timeless
f77cdcd3b1 pycompat: switch to util.stringio for py3 compat 2016-04-10 20:55:37 +00:00
Julien Cristau
3e185dc2e6 convert: kill dead code
gitread is unused with the new commandline-based code.
2016-04-04 15:39:13 +02:00
Julien Cristau
dd250f1d5d convert: don't ignore errors from git diff-tree 2016-04-04 15:38:48 +02:00
timeless
78639f500c children: use double quotes for arguments
You can't use single quotes in cmd.exe. See f4369d3e818c.
2016-01-06 17:18:18 +00:00
timeless
897045e273 largefiles: use double quotes for arguments
You can't use single quotes in cmd.exe. See f4369d3e818c.
2016-01-12 09:30:39 +00:00
Jun Wu
c59ce363ab chgserver: change random state after fork
Before this patch, extensions expecting a different random state per command
will break since the chg request handler will inherit a same random state
from the parent daemon process.

This patch addresses the issue by calling random.seed() after fork.
2016-04-04 01:59:57 +01:00
Jun Wu
abecf92520 chgserver: use relative path at socket.bind
Before this patch, if the server address is long, the server will fail to
listen and throw the error:

  socket.error: AF_UNIX path too long

It is because AF_UNIX path usually has a very short length limit (107 chars on
common platforms, see sys/un.h).

This patch addresses the issue by using relative path instead. Therefore the
directory length does not matter. It helps run tests with chg using a long
$TMPDIR.
2016-04-04 03:17:59 +01:00
Jun Wu
c99168df8c chgserver: move args copying logic to the correct place
A previous patch moved it to an incorrect place. Since dispatch._earlygetopt
has side effects on args, we need to move it to the place before _earlygetopt.
2016-04-04 01:10:51 +01:00
liscju
bb92aaa17c largefiles: replace invocation of os.path module by vfs in reposetup.py
This commit is part of bigger effort described in 'Windows UTF-8' plan.
2016-03-19 15:31:13 +01:00
liscju
7b0ac0d003 largefiles: replace invocation of os.path module by vfs in overrides.py
This commit is part of bigger effort described in 'Windows UTF-8' plan.
It is not changing all invocations but the ones where change is
obviously correct and doesn't require complicated changes.
2016-03-19 14:50:40 +01:00
Pierre-Yves David
6fceb4873e record: deprecate the extension
The feature has been moved into core behind the -i flag. We can safely
deprecated the extension and point people at the --interactive flag in core.
2016-03-28 12:50:56 -07:00
FUJIWARA Katsunori
a35dfb0209 keyword: use templatefilter to mark a function as template filter
This patch also adds test for filter 'svnisodate' and 'svnutcdate' for
safety, because there is no test using them, yet.
2016-03-30 02:10:44 +09:00
Laurent Charignon
374c190d53 rebase: fix crash when rebase aborts while rebasing obsolete revisions
Before this patch, rebase --continue would crash when trying to resume a rebase
of obsolete revisions whose successors were in the destination.
This patch adds logic to recompute the mapping when rebase is resumed. This
patch also adds a test that showcased the crash before the code change.
2016-03-29 11:50:41 -07:00
Laurent Charignon
b39e6cb3ff rebase: refactor of error handling code path for rebaseskipobsolete
This patch extracts the error handling code path to go in a separate function.
In the next patch we will able to reuse this logic and avoid duplicated code.
2016-03-29 11:49:45 -07:00
Martin von Zweigbergk
a993a6ecbd convert: delete unused imports in git.py
As reported by pyflakes
2016-03-29 10:49:33 -07:00
Matt Mackall
4a96519522 merge with stable 2016-03-29 12:29:00 -05:00
Martin von Zweigbergk
4cc86f7b27 bundle: move writebundle() from changegroup.py to bundle2.py (API)
writebundle() writes a bundle2 bundle or a plain changegroup1. Imagine
away the "2" in "bundle2.py" for a moment and this change should makes
sense. The bundle wraps the changegroup, so it makes sense that it
knows about it. Another sign that this is correct is that the delayed
import of bundle2 in changegroup goes away.

I'll leave it for another time to remove the "2" in "bundle2.py"
(alternatively, extract a new bundle.py from it).
2016-03-28 14:41:29 -07:00
Mateusz Kwapich
843a151296 convert: rewrite gitpipe to use common.commandline (SEC)
CVE-2016-3069 (4/5)
2016-03-22 17:05:11 -07:00
Mateusz Kwapich
e02db5f882 convert: dead code removal - old git calling functions (SEC)
CVE-2016-3069 (3/5)
2016-03-22 17:05:11 -07:00
Mateusz Kwapich
98120175fb convert: rewrite calls to Git to use the new shelling mechanism (SEC)
CVE-2016-3069 (2/5)

One test output changed because we were ignoring git return code in numcommits
before.
2016-03-22 17:05:11 -07:00
Mateusz Kwapich
8103d3a484 convert: add new, non-clowny interface for shelling out to git (SEC)
CVE-2016-3069 (1/5)

To avoid shell injection and for the sake of simplicity let's use the
common.commandline for calling git.
2016-03-22 17:05:11 -07:00
timeless
45450b6576 ui: add prompt argument to write (issue5154) (API)
When code like filemerge._iprompt calls ui.prompt, it expects
the user to see the output in addition to getting the prompt.

Other code such as histedit may call ui.pushbuffer, but its
goal is not to interfere with prompts, so this commit adds
an optional prompt flag to ui.write and has _readline
include that argument.

ui.promptchoice calls ui.prompt which calls ui._readline.

This commit also updates hgext.color.write.
2016-03-25 21:51:00 +00:00
Yuya Nishihara
f0125a308f templater: do not abuse SyntaxError to report errors in template map file
SyntaxError is the class representing syntax errors in Python code. We should
use a dedicated exception class for our needs. With this change, unnecessary
re-wrapping of SyntaxError can be eliminated.
2016-03-26 18:01:04 +09:00
Pierre-Yves David
a74c6e1e14 mq: restrict generated patch name to 75 characters (issue5117)
Super long first line in description lead to very long file name that
windows is unhappy about. We restrict the name to 75 char to avoid the
issue.

75 seems fine and leave some extra room for '__#' suffix in case of conflict.

I does not seems worthwhile to add a dedicated config option to configure the
length. It can be done in the future if there is an actual user demand for it.
2016-03-09 22:21:08 +00:00
FUJIWARA Katsunori
4a0bc54a73 doc: remove deprecated option from synopsis of command help
Before this patch, deprecated options below are used in synopsis of
command help, even though they aren't listed up as available options
by default. These might confuse readers.

  - -n (no-op, now) of strip
  - -a/--active of branches
  - -f/--force of merge
2016-03-01 03:28:46 +09:00
Yuya Nishihara
61b45241f5 zeroconf: forward all arguments passed to ui.configitems() wrapper
cf6cc5344afa added 'ignoresub' argument to ui.configitems(), but zeroconf
wrapper wasn't updated. It caused the following crash:

  Traceback (most recent call last):
    File "bin/hg", line 43, in <module>
      mercurial.dispatch.run()
    File "lib/python/mercurial/dispatch.py", line 54, in run
      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
    File "lib/python/mercurial/dispatch.py", line 120, in dispatch
      ret = _runcatch(req)
    File "lib/python/mercurial/dispatch.py", line 191, in _runcatch
      return _dispatch(req)
    File "lib/python/mercurial/dispatch.py", line 924, in _dispatch
      cmdpats, cmdoptions)
    File "lib/python/mercurial/dispatch.py", line 681, in runcommand
      ret = _runcommand(ui, options, cmd, d)
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
    File "lib/python/hgext/zeroconf/__init__.py", line 180, in cleanupafterdispatch
      return orig(ui, options, cmd, cmdfunc)
    File "lib/python/mercurial/dispatch.py", line 1055, in _runcommand
      return checkargs()
    File "lib/python/mercurial/dispatch.py", line 1015, in checkargs
      return cmdfunc()
    File "lib/python/mercurial/dispatch.py", line 921, in <lambda>
      d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
    File "lib/python/mercurial/util.py", line 991, in check
      return func(*args, **kwargs)
    File "lib/python/mercurial/commands.py", line 5405, in paths
      pathitems = sorted(ui.paths.iteritems())
    File "lib/python/mercurial/util.py", line 723, in __get__
      result = self.func(obj)
    File "lib/python/mercurial/ui.py", line 619, in paths
      return paths(self)
    File "lib/python/mercurial/ui.py", line 1099, in __init__
      for name, loc in ui.configitems('paths', ignoresub=True):
    File "lib/python/mercurial/extensions.py", line 195, in closure
      return func(*(args + a), **kw)
  TypeError: configitems() got an unexpected keyword argument 'ignoresub'

We have no test coverage for zeroconf, so I've added a minimal test that
could reproduce this problem.
2016-02-10 22:53:17 +09:00