diff --git a/.bumpversion.cfg b/.bumpversion.cfg --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 4.15.2 +current_version = 4.16.0 message = release: Bump version {current_version} to {new_version} [bumpversion:file:vcsserver/VERSION] diff --git a/.release.cfg b/.release.cfg --- a/.release.cfg +++ b/.release.cfg @@ -5,12 +5,10 @@ done = false done = true [task:fixes_on_stable] -done = true [task:pip2nix_generated] -done = true [release] -state = prepared -version = 4.15.2 +state = in_progress +version = 4.16.0 diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -.PHONY: clean test test-clean test-only +.PHONY: clean test test-clean test-only generate-pkgs clean: make test-clean - find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' \) -exec rm '{}' ';' + find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' test: make test-clean @@ -15,4 +15,9 @@ test-clean: find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' test-only: - PYTHONHASHSEED=random py.test -vv -r xw -p no:sugar --cov=vcsserver --cov-report=term-missing --cov-report=html vcsserver + PYTHONHASHSEED=random \ + py.test -x -vv -r xw -p no:sugar \ + --cov=vcsserver --cov-report=term-missing --cov-report=html vcsserver + +generate-pkgs: + nix-shell pkgs/shell-generate.nix --command "pip2nix generate --licenses" diff --git a/default.nix b/default.nix --- a/default.nix +++ b/default.nix @@ -5,14 +5,15 @@ # "shell.nix" so that it does not have to clutter this file. args@ -{ pythonPackages ? "python27Packages" +{ system ? builtins.currentSystem +, pythonPackages ? "python27Packages" , pythonExternalOverrides ? self: super: {} , doCheck ? false , ... }: let - pkgs_ = (import {}); + pkgs_ = args.pkgs or (import { inherit system; }); in let diff --git a/pkgs/overlays.nix b/pkgs/overlays.nix --- a/pkgs/overlays.nix +++ b/pkgs/overlays.nix @@ -1,10 +1,10 @@ self: super: { # bump GIT version git = super.lib.overrideDerivation super.git (oldAttrs: { - name = "git-2.19.1"; + name = "git-2.19.2"; src = self.fetchurl { - url = "https://www.kernel.org/pub/software/scm/git/git-2.19.1.tar.xz"; - sha256 = "1dfv43lmdnxz42504jc89sihbv1d4d6kgqcz3c5ji140kfm5cl1l"; + url = "https://www.kernel.org/pub/software/scm/git/git-2.19.2.tar.xz"; + sha256 = "1scbggzghkzzfqg4ky3qh7h9w87c3zya4ls5disz7dbx56is7sgw"; }; # patches come from: https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/version-management/git-and-tools/git diff --git a/pkgs/python-packages.nix b/pkgs/python-packages.nix --- a/pkgs/python-packages.nix +++ b/pkgs/python-packages.nix @@ -99,11 +99,14 @@ self: super: { }; }; "dogpile.cache" = super.buildPythonPackage { - name = "dogpile.cache-0.6.7"; + name = "dogpile.cache-0.7.1"; doCheck = false; + propagatedBuildInputs = [ + self."decorator" + ]; src = fetchurl { - url = "https://files.pythonhosted.org/packages/ee/bd/440da735a11c6087eed7cc8747fc4b995cbac2464168682f8ee1c8e43844/dogpile.cache-0.6.7.tar.gz"; - sha256 = "1aw8rx8vhb75y7zc6gi67g21sw057jdx7i8m3jq7kf3nqavxx9zw"; + url = "https://files.pythonhosted.org/packages/84/3e/dbf1cfc5228f1d3dca80ef714db2c5aaec5cd9efaf54d7e3daef6bc48b19/dogpile.cache-0.7.1.tar.gz"; + sha256 = "0caazmrzhnfqb5yrp8myhw61ny637jj69wcngrpbvi31jlcpy6v9"; }; meta = { license = [ pkgs.lib.licenses.bsdOriginal ]; @@ -154,14 +157,14 @@ self: super: { }; }; "gevent" = super.buildPythonPackage { - name = "gevent-1.3.7"; + name = "gevent-1.4.0"; doCheck = false; propagatedBuildInputs = [ self."greenlet" ]; src = fetchurl { - url = "https://files.pythonhosted.org/packages/10/c1/9499b146bfa43aa4f1e0ed1bab1bd3209a4861d25650c11725036c731cf5/gevent-1.3.7.tar.gz"; - sha256 = "0b0fr04qdk1p4sniv87fh8z5psac60x01pv054kpgi94520g81iz"; + url = "https://files.pythonhosted.org/packages/ed/27/6c49b70808f569b66ec7fac2e78f076e9b204db9cf5768740cff3d5a07ae/gevent-1.4.0.tar.gz"; + sha256 = "1lchr4akw2jkm5v4kz7bdm4wv3knkfhbfn9vkkz4s5yrkcxzmdqy"; }; meta = { license = [ pkgs.lib.licenses.mit ]; @@ -302,11 +305,11 @@ self: super: { }; }; "markupsafe" = super.buildPythonPackage { - name = "markupsafe-1.0"; + name = "markupsafe-1.1.0"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz"; - sha256 = "0rdn1s8x9ni7ss8rfiacj7x1085lx8mh2zdwqslnw8xc3l4nkgm6"; + url = "https://files.pythonhosted.org/packages/ac/7e/1b4c2e05809a4414ebce0892fe1e32c14ace86ca7d50c70f00979ca9b3a3/MarkupSafe-1.1.0.tar.gz"; + sha256 = "1lxirjypbdd3l9jl4vliilhfnhy7c7f2vlldqg1b0i74khn375sf"; }; meta = { license = [ pkgs.lib.licenses.bsdOriginal ]; @@ -335,14 +338,14 @@ self: super: { }; }; "more-itertools" = super.buildPythonPackage { - name = "more-itertools-4.3.0"; + name = "more-itertools-5.0.0"; doCheck = false; propagatedBuildInputs = [ self."six" ]; src = fetchurl { - url = "https://files.pythonhosted.org/packages/88/ff/6d485d7362f39880810278bdc906c13300db05485d9c65971dec1142da6a/more-itertools-4.3.0.tar.gz"; - sha256 = "17h3na0rdh8xq30w4b9pizgkdxmm51896bxw600x84jflg9vaxn4"; + url = "https://files.pythonhosted.org/packages/dd/26/30fc0d541d9fdf55faf5ba4b0fd68f81d5bd2447579224820ad525934178/more-itertools-5.0.0.tar.gz"; + sha256 = "1r12cm6mcdwdzz7d47a6g4l437xsvapdlgyhqay3i2nrlv03da9q"; }; meta = { license = [ pkgs.lib.licenses.mit ]; @@ -360,26 +363,26 @@ self: super: { }; }; "pastedeploy" = super.buildPythonPackage { - name = "pastedeploy-1.5.2"; + name = "pastedeploy-2.0.1"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/0f/90/8e20cdae206c543ea10793cbf4136eb9a8b3f417e04e40a29d72d9922cbd/PasteDeploy-1.5.2.tar.gz"; - sha256 = "1jz3m4hq8v6hyhfjz9425nd3nvn52cvbfipdcd72krjmla4qz1fm"; + url = "https://files.pythonhosted.org/packages/19/a0/5623701df7e2478a68a1b685d1a84518024eef994cde7e4da8449a31616f/PasteDeploy-2.0.1.tar.gz"; + sha256 = "02imfbbx1mi2h546f3sr37m47dk9qizaqhzzlhx8bkzxa6fzn8yl"; }; meta = { license = [ pkgs.lib.licenses.mit ]; }; }; "pathlib2" = super.buildPythonPackage { - name = "pathlib2-2.3.2"; + name = "pathlib2-2.3.3"; doCheck = false; propagatedBuildInputs = [ self."six" self."scandir" ]; src = fetchurl { - url = "https://files.pythonhosted.org/packages/db/a8/7d6439c1aec525ed70810abee5b7d7f3aa35347f59bc28343e8f62019aa2/pathlib2-2.3.2.tar.gz"; - sha256 = "10yb0iv5x2hs631rcppkhbddx799d3h8pcwmkbh2a66ns3w71ccf"; + url = "https://files.pythonhosted.org/packages/bf/d7/a2568f4596b75d2c6e2b4094a7e64f620decc7887f69a1f2811931ea15b9/pathlib2-2.3.3.tar.gz"; + sha256 = "0hpp92vqqgcd8h92msm9slv161b1q160igjwnkf2ag6cx0c96695"; }; meta = { license = [ pkgs.lib.licenses.mit ]; @@ -443,11 +446,11 @@ self: super: { }; }; "pluggy" = super.buildPythonPackage { - name = "pluggy-0.8.0"; + name = "pluggy-0.8.1"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/65/25/81d0de17cd00f8ca994a4e74e3c4baf7cd25072c0b831dad5c7d9d6138f8/pluggy-0.8.0.tar.gz"; - sha256 = "1580p47l2zqzsza8jcnw1h2wh3vvmygk6ly8bvi4w0g8j14sjys4"; + url = "https://files.pythonhosted.org/packages/38/e1/83b10c17688af7b2998fa5342fec58ecbd2a5a7499f31e606ae6640b71ac/pluggy-0.8.1.tar.gz"; + sha256 = "05l6g42p9ilmabw0hlbiyxy6gyzjri41m5l11a8dzgvi77q35p4d"; }; meta = { license = [ pkgs.lib.licenses.mit ]; @@ -469,11 +472,11 @@ self: super: { }; }; "psutil" = super.buildPythonPackage { - name = "psutil-5.4.7"; + name = "psutil-5.4.8"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/7d/9a/1e93d41708f8ed2b564395edfa3389f0fd6d567597401c2e5e2775118d8b/psutil-5.4.7.tar.gz"; - sha256 = "0fsgmvzwbdbszkwfnqhib8jcxm4w6zyhvlxlcda0rfm5cyqj4qsv"; + url = "https://files.pythonhosted.org/packages/e3/58/0eae6e4466e5abf779d7e2b71fac7fba5f59e00ea36ddb3ed690419ccb0f/psutil-5.4.8.tar.gz"; + sha256 = "1hyna338sml2cl1mfb2gs89np18z27mvyhmq4ifh22x07n7mq9kf"; }; meta = { license = [ pkgs.lib.licenses.bsdOriginal ]; @@ -502,35 +505,34 @@ self: super: { }; }; "pygments" = super.buildPythonPackage { - name = "pygments-2.3.0"; + name = "pygments-2.3.1"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/63/a2/91c31c4831853dedca2a08a0f94d788fc26a48f7281c99a303769ad2721b/Pygments-2.3.0.tar.gz"; - sha256 = "1z34ms51dh4jq4h3cizp7vd1dmsxcbvffkjsd2xxfav22nn6lrl2"; + url = "https://files.pythonhosted.org/packages/64/69/413708eaf3a64a6abb8972644e0f20891a55e621c6759e2c3f3891e05d63/Pygments-2.3.1.tar.gz"; + sha256 = "0ji87g09jph8jqcvclgb02qvxasdnr9pzvk90rl66d90yqcxmyjz"; }; meta = { license = [ pkgs.lib.licenses.bsdOriginal ]; }; }; "pyramid" = super.buildPythonPackage { - name = "pyramid-1.9.2"; + name = "pyramid-1.10.1"; doCheck = false; propagatedBuildInputs = [ - self."setuptools" - self."webob" - self."repoze.lru" - self."zope.interface" - self."zope.deprecation" - self."venusian" - self."translationstring" - self."pastedeploy" + self."hupper" self."plaster" self."plaster-pastedeploy" - self."hupper" + self."setuptools" + self."translationstring" + self."venusian" + self."webob" + self."zope.deprecation" + self."zope.interface" + self."repoze.lru" ]; src = fetchurl { - url = "https://files.pythonhosted.org/packages/a0/c1/b321d07cfc4870541989ad131c86a1d593bfe802af0eca9718a0dadfb97a/pyramid-1.9.2.tar.gz"; - sha256 = "09drsl0346nchgxp2j7sa5hlk7mkhfld9wvbd0wicacrp26a92fg"; + url = "https://files.pythonhosted.org/packages/0a/3e/22e3ac9be1b70a01139adba8906ee4b8f628bb469fea3c52f6c97b73063c/pyramid-1.10.1.tar.gz"; + sha256 = "1h5105nfh6rsrfjiyw20aavyibj36la3hajy6vh1fa77xb4y3hrp"; }; meta = { license = [ { fullName = "Repoze Public License"; } { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ]; @@ -656,7 +658,7 @@ self: super: { }; }; "rhodecode-vcsserver" = super.buildPythonPackage { - name = "rhodecode-vcsserver-4.15.2"; + name = "rhodecode-vcsserver-4.16.0"; buildInputs = [ self."pytest" self."py" @@ -667,9 +669,10 @@ self: super: { self."pytest-timeout" self."gprof2dot" self."mock" - self."webtest" self."cov-core" self."coverage" + self."webtest" + self."beautifulsoup4" self."configobj" ]; doCheck = true; @@ -702,6 +705,7 @@ self: super: { self."webob" self."zope.deprecation" self."zope.interface" + self."venusian" self."gevent" self."greenlet" self."gunicorn" @@ -718,9 +722,10 @@ self: super: { self."pytest-timeout" self."gprof2dot" self."mock" - self."webtest" self."cov-core" self."coverage" + self."webtest" + self."beautifulsoup4" ]; src = ./.; meta = { @@ -750,11 +755,11 @@ self: super: { }; }; "setuptools" = super.buildPythonPackage { - name = "setuptools-40.6.2"; + name = "setuptools-40.7.3"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip"; - sha256 = "0r2c5hapirlzm34h7pl1lgkm6gk7bcrlrdj28qgsvaqg3f74vfw6"; + url = "https://files.pythonhosted.org/packages/90/86/00ab839a8647e0fee435fe77f70795865ca4534387872a6c23b22fd85ac8/setuptools-40.7.3.zip"; + sha256 = "0c54kklk7c97g0dhm7ilg9cd4n4s464ps6mspsa5m9hhrcqxsbvh"; }; meta = { license = [ pkgs.lib.licenses.mit ]; @@ -772,11 +777,11 @@ self: super: { }; }; "simplejson" = super.buildPythonPackage { - name = "simplejson-3.11.1"; + name = "simplejson-3.16.0"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/08/48/c97b668d6da7d7bebe7ea1817a6f76394b0ec959cb04214ca833c34359df/simplejson-3.11.1.tar.gz"; - sha256 = "1rr58dppsq73p0qcd9bsw066cdd3v63sqv7j6sqni8frvm4jv8h1"; + url = "https://files.pythonhosted.org/packages/e3/24/c35fb1c1c315fc0fffe61ea00d3f88e85469004713dab488dee4f35b0aff/simplejson-3.16.0.tar.gz"; + sha256 = "19cws1syk8jzq2pw43878dv6fjkb0ifvjpx0i9aajix6kc9jkwxi"; }; meta = { license = [ { fullName = "Academic Free License (AFL)"; } pkgs.lib.licenses.mit ]; @@ -794,11 +799,11 @@ self: super: { }; }; "subprocess32" = super.buildPythonPackage { - name = "subprocess32-3.5.2"; + name = "subprocess32-3.5.3"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/c3/5f/7117737fc7114061837a4f51670d863dd7f7f9c762a6546fa8a0dcfe61c8/subprocess32-3.5.2.tar.gz"; - sha256 = "11v62shwmdys48g7ncs3a8jwwnkcl8d4zcwy6dk73z1zy2f9hazb"; + url = "https://files.pythonhosted.org/packages/be/2b/beeba583e9877e64db10b52a96915afc0feabf7144dcbf2a0d0ea68bf73d/subprocess32-3.5.3.tar.gz"; + sha256 = "1hr5fan8i719hmlmz73hf8rhq74014w07d8ryg7krvvf6692kj3b"; }; meta = { license = [ pkgs.lib.licenses.psfl ]; @@ -855,11 +860,11 @@ self: super: { }; }; "venusian" = super.buildPythonPackage { - name = "venusian-1.1.0"; + name = "venusian-1.2.0"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/38/24/b4b470ab9e0a2e2e9b9030c7735828c8934b4c6b45befd1bb713ec2aeb2d/venusian-1.1.0.tar.gz"; - sha256 = "0zapz131686qm0gazwy8bh11vr57pr89jbwbl50s528sqy9f80lr"; + url = "https://files.pythonhosted.org/packages/7e/6f/40a9d43ac77cb51cb62be5b5662d170f43f8037bdc4eab56336c4ca92bb7/venusian-1.2.0.tar.gz"; + sha256 = "0ghyx66g8ikx9nx1mnwqvdcqm11i1vlq0hnvwl50s48bp22q5v34"; }; meta = { license = [ { fullName = "BSD-derived (http://www.repoze.org/LICENSE.txt)"; } ]; @@ -888,18 +893,18 @@ self: super: { }; }; "webob" = super.buildPythonPackage { - name = "webob-1.7.4"; + name = "webob-1.8.4"; doCheck = false; src = fetchurl { - url = "https://files.pythonhosted.org/packages/75/34/731e23f52371852dfe7490a61644826ba7fe70fd52a377aaca0f4956ba7f/WebOb-1.7.4.tar.gz"; - sha256 = "1na01ljg04z40il7vcrn8g29vaw7nvg1xvhk64cr4jys5wcay44d"; + url = "https://files.pythonhosted.org/packages/e4/6c/99e322c3d4cc11d9060a67a9bf2f7c9c581f40988c11fffe89bb8c36bc5e/WebOb-1.8.4.tar.gz"; + sha256 = "16cfg5y4n6sihz59vsmns2yqbfm0gfsn3l5xgz2g0pdhilaib0x4"; }; meta = { license = [ pkgs.lib.licenses.mit ]; }; }; "webtest" = super.buildPythonPackage { - name = "webtest-2.0.29"; + name = "webtest-2.0.32"; doCheck = false; propagatedBuildInputs = [ self."six" @@ -908,8 +913,8 @@ self: super: { self."beautifulsoup4" ]; src = fetchurl { - url = "https://files.pythonhosted.org/packages/94/de/8f94738be649997da99c47b104aa3c3984ecec51a1d8153ed09638253d56/WebTest-2.0.29.tar.gz"; - sha256 = "0bcj1ica5lnmj5zbvk46x28kgphcsgh7sfnwjmn0cr94mhawrg6v"; + url = "https://files.pythonhosted.org/packages/27/9f/9e74449d272ffbef4fb3012e6dbc53c0b24822d545e7a33a342f80131e59/WebTest-2.0.32.tar.gz"; + sha256 = "0qp0nnbazzm4ibjiyqfcn6f230svk09i4g58zg2i9x1ga06h48a2"; }; meta = { license = [ pkgs.lib.licenses.mit ]; diff --git a/release.nix b/release.nix --- a/release.nix +++ b/release.nix @@ -1,12 +1,20 @@ # This file defines how to "build" for packaging. -{ doCheck ? true +{ pkgs ? import {} +, system ? builtins.currentSystem +, doCheck ? false }: let vcsserver = import ./default.nix { inherit - doCheck; + doCheck + system; + + # disable checkPhase for build + checkPhase = '' + ''; + }; in { diff --git a/requirements.txt b/requirements.txt --- a/requirements.txt +++ b/requirements.txt @@ -4,37 +4,38 @@ https://code.rhodecode.com/upstream/configobj/archive/a11ff0a0bd4fbda9e3a91267e720f88329efb4a6.tar.gz?md5=9916c524ea11a6c418217af6b28d4b3c#egg=configobj==5.0.6 atomicwrites==1.2.1 attrs==18.2.0 -dogpile.cache==0.6.7 +dogpile.cache==0.7.1 dogpile.core==0.4.1 decorator==4.1.2 dulwich==0.13.0 hgsubversion==1.9.3 hg-evolve==8.0.1 mako==1.0.7 -markupsafe==1.0.0 +markupsafe==1.1.0 mercurial==4.6.2 msgpack-python==0.5.6 -pastedeploy==1.5.2 -psutil==5.4.7 -pyramid==1.9.2 +pastedeploy==2.0.1 +psutil==5.4.8 +pyramid==1.10.1 pyramid-mako==1.0.2 -pygments==2.3.0 -pathlib2==2.3.2 +pygments==2.3.1 +pathlib2==2.3.3 repoze.lru==0.7 -simplejson==3.11.1 -subprocess32==3.5.2 +simplejson==3.16.0 +subprocess32==3.5.3 subvertpy==0.10.1 six==1.11.0 translationstring==1.3 -webob==1.7.4 +webob==1.8.4 zope.deprecation==4.3.0 zope.interface==4.5.0 +venusian==1.2.0 ## http servers -gevent==1.3.7 +gevent==1.4.0 greenlet==0.4.15 gunicorn==19.9.0 waitress==1.1.0 diff --git a/requirements_test.txt b/requirements_test.txt --- a/requirements_test.txt +++ b/requirements_test.txt @@ -9,6 +9,8 @@ pytest-timeout==1.3.2 gprof2dot==2017.9.19 mock==1.0.1 -webtest==2.0.29 cov-core==1.15.0 coverage==4.5.1 + +webtest==2.0.32 +beautifulsoup4==4.6.3 diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2017 RodeCode GmbH +# Copyright (C) 2014-2019 RodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/VERSION b/vcsserver/VERSION --- a/vcsserver/VERSION +++ b/vcsserver/VERSION @@ -1,1 +1,1 @@ -4.15.2 \ No newline at end of file +4.16.0 \ No newline at end of file diff --git a/vcsserver/__init__.py b/vcsserver/__init__.py --- a/vcsserver/__init__.py +++ b/vcsserver/__init__.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/base.py b/vcsserver/base.py --- a/vcsserver/base.py +++ b/vcsserver/base.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -84,8 +84,11 @@ def raise_from_original(new_type): Raise a new exception type with original args and traceback. """ exc_type, exc_value, exc_traceback = sys.exc_info() + new_exc = new_type(*exc_value.args) + # store the original traceback into the new exc + new_exc._org_exc_tb = traceback.format_exc(exc_traceback) try: - raise new_type(*exc_value.args), None, exc_traceback + raise new_exc, None, exc_traceback finally: del exc_traceback diff --git a/vcsserver/exceptions.py b/vcsserver/exceptions.py --- a/vcsserver/exceptions.py +++ b/vcsserver/exceptions.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,6 +37,7 @@ def _make_exception(kind, org_exc, *args exc = Exception(*args) exc._vcs_kind = kind exc._org_exc = org_exc + exc._org_exc_tb = '' return exc diff --git a/vcsserver/git.py b/vcsserver/git.py --- a/vcsserver/git.py +++ b/vcsserver/git.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ import urllib import urllib2 from functools import wraps +import more_itertools from dulwich import index, objects from dulwich.client import HttpGitClient, LocalGitClient from dulwich.errors import ( @@ -118,6 +119,15 @@ class GitRemote(object): repo = self._factory.repo(wire) repo[ref] = commit_id + def _remote_conf(self, config): + params = [ + '-c', 'core.askpass=""', + ] + ssl_cert_dir = config.get('vcs_ssl_dir') + if ssl_cert_dir: + params.extend(['-c', 'http.sslCAinfo={}'.format(ssl_cert_dir)]) + return params + @reraise_safe_exceptions def add_object(self, wire, content): repo = self._factory.repo(wire) @@ -456,11 +466,11 @@ class GitRemote(object): repo = self._factory.repo(wire) if refs and not isinstance(refs, (list, tuple)): refs = [refs] - + config = self._wire_to_config(wire) # get all remote refs we'll use to fetch later output, __ = self.run_git_command( wire, ['ls-remote', url], fail_on_stderr=False, - _copts=['-c', 'core.askpass=""'], + _copts=self._remote_conf(config), extra_env={'GIT_TERMINAL_PROMPT': '0'}) remote_refs = collections.OrderedDict() @@ -486,13 +496,16 @@ class GitRemote(object): fetch_refs.append('{}:{}'.format(ref, ref)) elif not refs: fetch_refs.append('{}:{}'.format(ref, ref)) - + log.debug('Finished obtaining fetch refs, total: %s', len(fetch_refs)) if fetch_refs: - _out, _err = self.run_git_command( - wire, ['fetch', url, '--force', '--prune', '--'] + fetch_refs, - fail_on_stderr=False, - _copts=['-c', 'core.askpass=""'], - extra_env={'GIT_TERMINAL_PROMPT': '0'}) + for chunk in more_itertools.chunked(fetch_refs, 1024 * 4): + fetch_refs_chunks = list(chunk) + log.debug('Fetching %s refs from import url', len(fetch_refs_chunks)) + _out, _err = self.run_git_command( + wire, ['fetch', url, '--force', '--prune', '--'] + fetch_refs_chunks, + fail_on_stderr=False, + _copts=self._remote_conf(config), + extra_env={'GIT_TERMINAL_PROMPT': '0'}) return remote_refs @@ -500,11 +513,11 @@ class GitRemote(object): def sync_push(self, wire, url, refs=None): if not self.check_url(url, wire): return - + config = self._wire_to_config(wire) repo = self._factory.repo(wire) self.run_git_command( wire, ['push', url, '--mirror'], fail_on_stderr=False, - _copts=['-c', 'core.askpass=""'], + _copts=self._remote_conf(config), extra_env={'GIT_TERMINAL_PROMPT': '0'}) @reraise_safe_exceptions @@ -711,6 +724,16 @@ class GitRemote(object): repo = self._factory.repo(wire) return install_git_hooks(repo.path, repo.bare, force_create=force) + @reraise_safe_exceptions + def get_hooks_info(self, wire): + from vcsserver.hook_utils import ( + get_git_pre_hook_version, get_git_post_hook_version) + repo = self._factory.repo(wire) + return { + 'pre_version': get_git_pre_hook_version(repo.path, repo.bare), + 'post_version': get_git_post_hook_version(repo.path, repo.bare), + } + def str_to_dulwich(value): """ diff --git a/vcsserver/git_lfs/__init__.py b/vcsserver/git_lfs/__init__.py --- a/vcsserver/git_lfs/__init__.py +++ b/vcsserver/git_lfs/__init__.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/git_lfs/app.py b/vcsserver/git_lfs/app.py --- a/vcsserver/git_lfs/app.py +++ b/vcsserver/git_lfs/app.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/git_lfs/lib.py b/vcsserver/git_lfs/lib.py --- a/vcsserver/git_lfs/lib.py +++ b/vcsserver/git_lfs/lib.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/git_lfs/tests/__init__.py b/vcsserver/git_lfs/tests/__init__.py --- a/vcsserver/git_lfs/tests/__init__.py +++ b/vcsserver/git_lfs/tests/__init__.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/git_lfs/tests/test_lfs_app.py b/vcsserver/git_lfs/tests/test_lfs_app.py --- a/vcsserver/git_lfs/tests/test_lfs_app.py +++ b/vcsserver/git_lfs/tests/test_lfs_app.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/git_lfs/tests/test_lib.py b/vcsserver/git_lfs/tests/test_lib.py --- a/vcsserver/git_lfs/tests/test_lib.py +++ b/vcsserver/git_lfs/tests/test_lib.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/git_lfs/utils.py b/vcsserver/git_lfs/utils.py --- a/vcsserver/git_lfs/utils.py +++ b/vcsserver/git_lfs/utils.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/hg.py b/vcsserver/hg.py --- a/vcsserver/hg.py +++ b/vcsserver/hg.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ from mercurial import commands from mercurial import unionrepo from mercurial import verify +import vcsserver from vcsserver import exceptions from vcsserver.base import RepoFactory, obfuscate_qs, raise_from_original from vcsserver.hgcompat import ( @@ -793,3 +794,10 @@ class HgRemote(object): def install_hooks(self, wire, force=False): # we don't need any special hooks for Mercurial pass + + @reraise_safe_exceptions + def get_hooks_info(self, wire): + return { + 'pre_version': vcsserver.__version__, + 'post_version': vcsserver.__version__, + } diff --git a/vcsserver/hgcompat.py b/vcsserver/hgcompat.py --- a/vcsserver/hgcompat.py +++ b/vcsserver/hgcompat.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/hgpatches.py b/vcsserver/hgpatches.py --- a/vcsserver/hgpatches.py +++ b/vcsserver/hgpatches.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -63,7 +63,7 @@ def _dynamic_capabilities_wrapper(lfprot def patch_subrepo_type_mapping(): from collections import defaultdict from hgcompat import subrepo - from exceptions import SubrepoMergeException + from vcsserver.exceptions import SubrepoMergeException class NoOpSubrepo(subrepo.abstractsubrepo): diff --git a/vcsserver/hook_utils/__init__.py b/vcsserver/hook_utils/__init__.py --- a/vcsserver/hook_utils/__init__.py +++ b/vcsserver/hook_utils/__init__.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,6 +29,14 @@ import vcsserver log = logging.getLogger(__name__) +def get_git_hooks_path(repo_path, bare): + hooks_path = os.path.join(repo_path, 'hooks') + if not bare: + hooks_path = os.path.join(repo_path, '.git', 'hooks') + + return hooks_path + + def install_git_hooks(repo_path, bare, executable=None, force_create=False): """ Creates a RhodeCode hook inside a git repository @@ -38,9 +46,8 @@ def install_git_hooks(repo_path, bare, e :param force_create: Create even if same name hook exists """ executable = executable or sys.executable - hooks_path = os.path.join(repo_path, 'hooks') - if not bare: - hooks_path = os.path.join(repo_path, '.git', 'hooks') + hooks_path = get_git_hooks_path(repo_path, bare) + if not os.path.isdir(hooks_path): os.makedirs(hooks_path, mode=0o777) @@ -78,6 +85,12 @@ def install_git_hooks(repo_path, bare, e return True +def get_svn_hooks_path(repo_path): + hooks_path = os.path.join(repo_path, 'hooks') + + return hooks_path + + def install_svn_hooks(repo_path, executable=None, force_create=False): """ Creates RhodeCode hooks inside a svn repository @@ -87,7 +100,7 @@ def install_svn_hooks(repo_path, executa :param force_create: Create even if same name hook exists """ executable = executable or sys.executable - hooks_path = os.path.join(repo_path, 'hooks') + hooks_path = get_svn_hooks_path(repo_path) if not os.path.isdir(hooks_path): os.makedirs(hooks_path, mode=0o777) @@ -127,6 +140,19 @@ def install_svn_hooks(repo_path, executa return True +def get_version_from_hook(hook_path): + version = '' + hook_content = read_hook_content(hook_path) + matches = re.search(r'(?:RC_HOOK_VER)\s*=\s*(.*)', hook_content) + if matches: + try: + version = matches.groups()[0] + log.debug('got version %s from hooks.', version) + except Exception: + log.exception("Exception while reading the hook version.") + return version.replace("'", "") + + def check_rhodecode_hook(hook_path): """ Check if the hook was created by RhodeCode @@ -134,16 +160,11 @@ def check_rhodecode_hook(hook_path): if not os.path.exists(hook_path): return True - log.debug('hook exists, checking if it is from rhodecode') - hook_content = read_hook_content(hook_path) - matches = re.search(r'(?:RC_HOOK_VER)\s*=\s*(.*)', hook_content) - if matches: - try: - version = matches.groups()[0] - log.debug('got version %s from hooks.', version) - return True - except Exception: - log.exception("Exception while reading the hook version.") + log.debug('hook exists, checking if it is from RhodeCode') + + version = get_version_from_hook(hook_path) + if version: + return True return False @@ -152,3 +173,31 @@ def read_hook_content(hook_path): with open(hook_path, 'rb') as f: content = f.read() return content + + +def get_git_pre_hook_version(repo_path, bare): + hooks_path = get_git_hooks_path(repo_path, bare) + _hook_file = os.path.join(hooks_path, 'pre-receive') + version = get_version_from_hook(_hook_file) + return version + + +def get_git_post_hook_version(repo_path, bare): + hooks_path = get_git_hooks_path(repo_path, bare) + _hook_file = os.path.join(hooks_path, 'post-receive') + version = get_version_from_hook(_hook_file) + return version + + +def get_svn_pre_hook_version(repo_path): + hooks_path = get_svn_hooks_path(repo_path) + _hook_file = os.path.join(hooks_path, 'pre-commit') + version = get_version_from_hook(_hook_file) + return version + + +def get_svn_post_hook_version(repo_path): + hooks_path = get_svn_hooks_path(repo_path) + _hook_file = os.path.join(hooks_path, 'post-commit') + version = get_version_from_hook(_hook_file) + return version diff --git a/vcsserver/hooks.py b/vcsserver/hooks.py --- a/vcsserver/hooks.py +++ b/vcsserver/hooks.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -511,15 +511,14 @@ def git_pre_receive(unused_repo_path, re type_ = push_ref['type'] new_branch = push_ref['old_rev'] == empty_commit_id - if type_ == 'heads' and not new_branch: + delete_branch = push_ref['new_rev'] == empty_commit_id + if type_ == 'heads' and not (new_branch or delete_branch): old_rev = push_ref['old_rev'] new_rev = push_ref['new_rev'] - cmd = [settings.GIT_EXECUTABLE, 'rev-list', - old_rev, '^{}'.format(new_rev)] + cmd = [settings.GIT_EXECUTABLE, 'rev-list', old_rev, '^{}'.format(new_rev)] stdout, stderr = subprocessio.run_command( cmd, env=os.environ.copy()) - # means we're having some non-reachable objects, this forced push - # was used + # means we're having some non-reachable objects, this forced push was used if stdout: push_ref['pruned_sha'] = stdout.splitlines() diff --git a/vcsserver/http_main.py b/vcsserver/http_main.py --- a/vcsserver/http_main.py +++ b/vcsserver/http_main.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -362,8 +362,10 @@ class HTTPApplication(object): org_exc = getattr(e, '_org_exc', None) org_exc_name = None + org_exc_tb = '' if org_exc: org_exc_name = org_exc.__class__.__name__ + org_exc_tb = getattr(e, '_org_exc_tb', '') # replace our "faked" exception with our org exc_info[0] = org_exc.__class__ exc_info[1] = org_exc @@ -383,6 +385,7 @@ class HTTPApplication(object): 'message': e.message, 'traceback': tb_info, 'org_exc': org_exc_name, + 'org_exc_tb': org_exc_tb, 'type': type_ } } diff --git a/vcsserver/lib/__init__.py b/vcsserver/lib/__init__.py --- a/vcsserver/lib/__init__.py +++ b/vcsserver/lib/__init__.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/lib/exc_tracking.py b/vcsserver/lib/exc_tracking.py --- a/vcsserver/lib/exc_tracking.py +++ b/vcsserver/lib/exc_tracking.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/lib/memory_lru_dict.py b/vcsserver/lib/memory_lru_dict.py --- a/vcsserver/lib/memory_lru_dict.py +++ b/vcsserver/lib/memory_lru_dict.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/lib/rc_cache/__init__.py b/vcsserver/lib/rc_cache/__init__.py --- a/vcsserver/lib/rc_cache/__init__.py +++ b/vcsserver/lib/rc_cache/__init__.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/lib/rc_cache/backends.py b/vcsserver/lib/rc_cache/backends.py --- a/vcsserver/lib/rc_cache/backends.py +++ b/vcsserver/lib/rc_cache/backends.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/lib/rc_cache/region_meta.py b/vcsserver/lib/rc_cache/region_meta.py --- a/vcsserver/lib/rc_cache/region_meta.py +++ b/vcsserver/lib/rc_cache/region_meta.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/lib/rc_cache/util.py b/vcsserver/lib/rc_cache/util.py --- a/vcsserver/lib/rc_cache/util.py +++ b/vcsserver/lib/rc_cache/util.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/pygrack.py b/vcsserver/pygrack.py --- a/vcsserver/pygrack.py +++ b/vcsserver/pygrack.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/remote_wsgi.py b/vcsserver/remote_wsgi.py --- a/vcsserver/remote_wsgi.py +++ b/vcsserver/remote_wsgi.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/scm_app.py b/vcsserver/scm_app.py --- a/vcsserver/scm_app.py +++ b/vcsserver/scm_app.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/server.py b/vcsserver/server.py --- a/vcsserver/server.py +++ b/vcsserver/server.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/settings.py b/vcsserver/settings.py --- a/vcsserver/settings.py +++ b/vcsserver/settings.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/subprocessio.py b/vcsserver/subprocessio.py --- a/vcsserver/subprocessio.py +++ b/vcsserver/subprocessio.py @@ -66,15 +66,17 @@ class StreamFeeder(Thread): def run(self): t = self.writeiface - if self.bytes: - os.write(t, self.bytes) - else: - s = self.source - b = s.read(4096) - while b: - os.write(t, b) + try: + if self.bytes: + os.write(t, self.bytes) + else: + s = self.source b = s.read(4096) - os.close(t) + while b: + os.write(t, b) + b = s.read(4096) + finally: + os.close(t) @property def output(self): @@ -436,6 +438,7 @@ class SubprocessIOChunker(object): self.process = _p self.output = bg_out self.error = bg_err + self.inputstream = inputstream def __iter__(self): return self @@ -484,6 +487,10 @@ class SubprocessIOChunker(object): self.error.close() except: pass + try: + os.close(self.inputstream) + except: + pass def __del__(self): self.close() diff --git a/vcsserver/svn.py b/vcsserver/svn.py --- a/vcsserver/svn.py +++ b/vcsserver/svn.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -458,6 +458,16 @@ class SvnRemote(object): return install_svn_hooks( repo_path, executable=executable, force_create=force) + @reraise_safe_exceptions + def get_hooks_info(self, wire): + from vcsserver.hook_utils import ( + get_svn_pre_hook_version, get_svn_post_hook_version) + repo_path = wire['path'] + return { + 'pre_version': get_svn_pre_hook_version(repo_path), + 'post_version': get_svn_post_hook_version(repo_path), + } + class SvnDiffer(object): """ diff --git a/vcsserver/tests/__init__.py b/vcsserver/tests/__init__.py --- a/vcsserver/tests/__init__.py +++ b/vcsserver/tests/__init__.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/conftest.py b/vcsserver/tests/conftest.py --- a/vcsserver/tests/conftest.py +++ b/vcsserver/tests/conftest.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/fixture.py b/vcsserver/tests/fixture.py --- a/vcsserver/tests/fixture.py +++ b/vcsserver/tests/fixture.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_git.py b/vcsserver/tests/test_git.py --- a/vcsserver/tests/test_git.py +++ b/vcsserver/tests/test_git.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_hg.py b/vcsserver/tests/test_hg.py --- a/vcsserver/tests/test_hg.py +++ b/vcsserver/tests/test_hg.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_hgpatches.py b/vcsserver/tests/test_hgpatches.py --- a/vcsserver/tests/test_hgpatches.py +++ b/vcsserver/tests/test_hgpatches.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_hooks.py b/vcsserver/tests/test_hooks.py --- a/vcsserver/tests/test_hooks.py +++ b/vcsserver/tests/test_hooks.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_install_hooks.py b/vcsserver/tests/test_install_hooks.py --- a/vcsserver/tests/test_install_hooks.py +++ b/vcsserver/tests/test_install_hooks.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_main_http.py b/vcsserver/tests/test_main_http.py --- a/vcsserver/tests/test_main_http.py +++ b/vcsserver/tests/test_main_http.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_pygrack.py b/vcsserver/tests/test_pygrack.py --- a/vcsserver/tests/test_pygrack.py +++ b/vcsserver/tests/test_pygrack.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_scm_app.py b/vcsserver/tests/test_scm_app.py --- a/vcsserver/tests/test_scm_app.py +++ b/vcsserver/tests/test_scm_app.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_server.py b/vcsserver/tests/test_server.py --- a/vcsserver/tests/test_server.py +++ b/vcsserver/tests/test_server.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_subprocessio.py b/vcsserver/tests/test_subprocessio.py --- a/vcsserver/tests/test_subprocessio.py +++ b/vcsserver/tests/test_subprocessio.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,6 +24,29 @@ import pytest from vcsserver import subprocessio +class KindaFilelike(object): # pragma: no cover + + def __init__(self, data, size): + chunks = size / len(data) + + self.stream = self._get_stream(data, chunks) + + def _get_stream(self, data, chunks): + for x in xrange(chunks): + yield data + + def read(self, n): + + buffer_stream = '' + for chunk in self.stream: + buffer_stream += chunk + if len(buffer_stream) >= n: + break + + # self.stream = self.bytes[n:] + return buffer_stream + + @pytest.fixture(scope='module') def environ(): """Delete coverage variables, as they make the tests fail.""" @@ -101,8 +124,9 @@ def test_output_with_no_input_does_not_f @pytest.mark.parametrize('size', [1, 10 ** 5]) def test_output_with_input(size, environ): - data = 'X' * size - inputstream = io.BytesIO(data) + data_len = size + inputstream = KindaFilelike('X', size) + # This acts like the cat command. args = _get_python_args('shutil.copyfileobj(sys.stdin, sys.stdout)') output = ''.join( @@ -111,14 +135,14 @@ def test_output_with_input(size, environ ) ) - print("{} {}".format(len(data * size), len(output))) - assert output == data + assert len(output) == data_len @pytest.mark.parametrize('size', [1, 10 ** 5]) def test_output_with_input_skipping_iterator(size, environ): - data = 'X' * size - inputstream = io.BytesIO(data) + data_len = size + inputstream = KindaFilelike('X', size) + # This acts like the cat command. args = _get_python_args('shutil.copyfileobj(sys.stdin, sys.stdout)') @@ -128,5 +152,4 @@ def test_output_with_input_skipping_iter ) output = ''.join(chunker.output) - print("{} {}".format(len(data * size), len(output))) - assert output == data + assert len(output) == data_len diff --git a/vcsserver/tests/test_svn.py b/vcsserver/tests/test_svn.py --- a/vcsserver/tests/test_svn.py +++ b/vcsserver/tests/test_svn.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tests/test_wsgi_app_caller.py b/vcsserver/tests/test_wsgi_app_caller.py --- a/vcsserver/tests/test_wsgi_app_caller.py +++ b/vcsserver/tests/test_wsgi_app_caller.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/tweens.py b/vcsserver/tweens.py --- a/vcsserver/tweens.py +++ b/vcsserver/tweens.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/utils.py b/vcsserver/utils.py --- a/vcsserver/utils.py +++ b/vcsserver/utils.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/vcsserver/wsgi_app_caller.py b/vcsserver/wsgi_app_caller.py --- a/vcsserver/wsgi_app_caller.py +++ b/vcsserver/wsgi_app_caller.py @@ -1,5 +1,5 @@ # RhodeCode VCSServer provides access to different vcs backends via network. -# Copyright (C) 2014-2018 RhodeCode GmbH +# Copyright (C) 2014-2019 RhodeCode GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by