[PATCH V2] phabricator: migrate [phabricator.auth] to [auth]
# HG changeset patch # User Matt Harbison# Date 1526099641 14400 # Sat May 12 00:34:01 2018 -0400 # Node ID 18219fa2a84fea13114970a73a505724a5d63a43 # Parent b9e6b71dc27246d1f4d6437edfdc9788188aa306 phabricator: migrate [phabricator.auth] to [auth] This resurrects the warning mechanism removed in 20a4543e9a2b. I'm not worried about the copy/paste of the code for a brief transitional period. diff --git a/contrib/phabricator.py b/contrib/phabricator.py --- a/contrib/phabricator.py +++ b/contrib/phabricator.py @@ -31,10 +31,10 @@ Config:: # the internal library. curlcmd = curl --connect-timeout 2 --retry 3 --silent -[phabricator.auth] +[auth] example.url = https://phab.example.com/ # API token. Get it from https://$HOST/conduit/login/ -example.token = cli- +example.phabtoken = cli- """ from __future__ import absolute_import @@ -100,17 +100,13 @@ def urlencodenested(params): process('', params) return util.urlreq.urlencode(flatparams) -def readurltoken(repo): -"""return conduit url, token and make sure they exist +printed_token_warning = False -Currently read from [phabricator] config section. In the future, it might -make sense to read from .arcconfig and .arcrc as well. +def readlegacytoken(repo, url): +"""Transitional support for old phabricator tokens. + +Remove before the 4.7 release. """ -url = repo.ui.config('phabricator', 'url') -if not url: -raise error.Abort(_('config %s.%s is required') - % ('phabricator', 'url')) - groups = {} for key, val in repo.ui.configitems('phabricator.auth'): if '.' not in key: @@ -128,9 +124,47 @@ def readurltoken(repo): if token: break +global printed_token_warning + +if token and not printed_token_warning: +printed_token_warning = True +repo.ui.warn(_('phabricator.auth.token is deprecated - please ' + 'migrate to auth.phabtoken.\n')) +return token + +def readurltoken(repo): +"""return conduit url, token and make sure they exist + +Currently read from [phabricator] config section. In the future, it might +make sense to read from .arcconfig and .arcrc as well. +""" +url = repo.ui.config('phabricator', 'url') +if not url: +raise error.Abort(_('config %s.%s is required') + % ('phabricator', 'url')) + +groups = {} +for key, val in repo.ui.configitems('auth'): +if '.' not in key: +repo.ui.warn(_("ignoring invalid [auth] key '%s'\n") + % key) +continue +group, setting = key.rsplit('.', 1) +groups.setdefault(group, {})[setting] = val + +token = None +for group, auth in groups.iteritems(): +if url != auth.get('url'): +continue +token = auth.get('phabtoken') +if token: +break + if not token: -raise error.Abort(_('Can\'t find conduit token associated to %s') - % (url,)) +token = readlegacytoken(repo, url) +if not token: +raise error.Abort(_('Can\'t find conduit token associated to %s') + % (url,)) return url, token ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3557: commit: add new close-branch command
joerg.sonnenberger created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY ``hg close-branch`` allows closing arbitrary heads. It is equivalent to checking out the given revisions and commit an empty change with ``hg commit --close-branch``. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3557 AFFECTED FILES mercurial/commands.py tests/test-close-branch.t tests/test-completion.t tests/test-globalopts.t tests/test-help.t tests/test-hgweb-json.t CHANGE DETAILS diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -1800,6 +1800,10 @@ "topic": "cat" }, { +"summary": "close the given head revisions", +"topic": "close-branch" + }, + { "summary": "show combined config settings from all hgrc files", "topic": "config" }, diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -65,6 +65,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -144,6 +145,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -840,6 +842,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -2356,6 +2359,13 @@ output the current or given revision of files + + close-branch + + + close the given head revisions + + config diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -308,6 +308,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit @@ -391,6 +392,7 @@ bundlecreate a bundle file cat output the current or given revision of files clone make a copy of an existing repository + close-branch close the given head revisions commitcommit the specified files or all outstanding changes configshow combined config settings from all hgrc files copy mark files as copied for the next commit diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -12,6 +12,7 @@ bundle cat clone + close-branch commit config copy @@ -252,6 +253,7 @@ branches: active, closed, template bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude, template + close-branch: message, logfile, date, user config: untrusted, edit, local, global, template copy: after, force, include, exclude, dry-run debugancestor: diff --git a/tests/test-close-branch.t b/tests/test-close-branch.t new file mode 100644 --- /dev/null +++ b/tests/test-close-branch.t @@ -0,0 +1,41 @@ + $ hg init + $ hg debugbuilddag '+2*2*3*4' + $ hg log -G --template '{rev}:{node|short}' + o 4:e7bd5218ca15 + | + | o 3:6100d3090acf + |/ + | o 2:fa942426a6fd + |/ + | o 1:66f7d451a68b + |/ + o 0:1ea73414a91b + + $ hg close-branch -m 'Close old heads' 1 2 + $ hg heads + changeset: 4:e7bd5218ca15 + parent: 0:1ea73414a91b + user:debugbuilddag + date:Thu Jan 01 00:00:04 1970 + + summary: r4 + + changeset: 3:6100d3090acf + parent: 0:1ea73414a91b + user:debugbuilddag + date:Thu Jan 01 00:00:03 1970 + + summary: r3 + + $ hg close-branch -m 'Close more old heads' 4 + $ hg heads + changeset: 3:6100d3090acf + parent: 0:1ea73414a91b + user:debugbuilddag +
D3538: bdiff: fix yet more fallout from xdiff long/int64 conversion (issue5885)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG273ea09f6550: bdiff: fix yet more fallout from xdiff long/int64 conversion (issue5885) (authored by jcristau, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3538?vs=8658=8679 REVISION DETAIL https://phab.mercurial-scm.org/D3538 AFFECTED FILES mercurial/cext/bdiff.c CHANGE DETAILS diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -261,7 +261,7 @@ void *priv) { PyObject *rl = (PyObject *)priv; - PyObject *m = Py_BuildValue("", a1, a2, b1, b2); + PyObject *m = Py_BuildValue("", a1, a2, b1, b2); if (!m) return -1; if (PyList_Append(rl, m) != 0) { To: jcristau, #hg-reviewers, quark, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3538: bdiff: fix yet more fallout from xdiff long/int64 conversion (issue5885)
durin42 added a comment. queued for stable, many thanks REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3538 To: jcristau, #hg-reviewers, quark, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3556: run-tests: update the test case name format
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Manually typing parenthesis and spaces will be tedious when trying to launch a specific test case. I'm proposing a simpler format that is less hard to remember and type right. There was other possibilities envisaged like `::` or `!`, I think `#` is slight easier to type but I'm open to any suggestion on the new format. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3556 AFFECTED FILES tests/run-tests.py tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1496,9 +1496,9 @@ $ [ $V = C ] #endif - ERROR: test-cases-abc.t (case B) output changed + ERROR: test-cases-abc.t#B output changed !. - Failed test-cases-abc.t (case B): output changed + Failed test-cases-abc.t#B: output changed # Ran 3 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] @@ -1519,9 +1519,9 @@ $ [ $V = C ] #endif - ERROR: test-cases-abc.t (case B) output changed + ERROR: test-cases-abc.t#B output changed !. - Failed test-cases-abc.t (case B): output changed + Failed test-cases-abc.t#B: output changed # Ran 2 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] @@ -1544,9 +1544,9 @@ $ [ $V = C ] #endif - ERROR: test-cases-abc.t (case B) output changed + ERROR: test-cases-abc.t#B output changed !. - Failed test-cases-abc.t (case B): output changed + Failed test-cases-abc.t#B: output changed # Ran 2 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] @@ -1573,7 +1573,7 @@ Support running a specific test case - $ rt "test-cases-abc.t (case B)" + $ rt "test-cases-abc.t#B" --- $TESTTMP/anothertests/cases/test-cases-abc.t +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err @@ -1587,16 +1587,16 @@ $ [ $V = C ] #endif - ERROR: test-cases-abc.t (case B) output changed + ERROR: test-cases-abc.t#B output changed ! - Failed test-cases-abc.t (case B): output changed + Failed test-cases-abc.t#B: output changed # Ran 1 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] Support running multiple test cases in the same file - $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case C)" + $ rt test-cases-abc.t#B test-cases-abc.t#C --- $TESTTMP/anothertests/cases/test-cases-abc.t +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err @@ -1610,16 +1610,16 @@ $ [ $V = C ] #endif - ERROR: test-cases-abc.t (case B) output changed + ERROR: test-cases-abc.t#B output changed !. - Failed test-cases-abc.t (case B): output changed + Failed test-cases-abc.t#B: output changed # Ran 2 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] Support running invalid test cases - $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case D)" + $ rt test-cases-abc.t#B test-cases-abc.t#D --- $TESTTMP/anothertests/cases/test-cases-abc.t +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err @@ -1633,9 +1633,9 @@ $ [ $V = C ] #endif - ERROR: test-cases-abc.t (case B) output changed + ERROR: test-cases-abc.t#B output changed ! - Failed test-cases-abc.t (case B): output changed + Failed test-cases-abc.t#B: output changed # Ran 1 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -120,7 +120,7 @@ } class TestRunnerLexer(lexer.RegexLexer): -testpattern = r'[\w-]+\.(t|py)( \(case [\w-]+\))?' +testpattern = r'[\w-]+\.(t|py)(#[\w-]+)?' tokens = { 'root': [ (r'^Skipped', token.Generic.Skipped, 'skipped'), @@ -1247,7 +1247,7 @@ self._allcases = parsettestcases(path) super(TTest, self).__init__(path, *args, **kwds) if case: -self.name = '%s (case %s)' % (self.name, _strpath(case)) +self.name = '%s#%s' % (self.name, _strpath(case)) self.errpath = b'%s.%s.err' % (self.errpath[:-4], case) self._tmpname += b'-%s' % case self._have = {} @@ -2646,7 +2646,7 @@ expanded_args.append(arg) args = expanded_args -testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))') +testcasepattern = re.compile(r'([\w-]+\.t|py)(#([\w-])+)') tests = [] for t in args: case = None To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3555: run-tests: add support for running specific test cases
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3555 AFFECTED FILES tests/run-tests.py tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1571,7 +1571,77 @@ .. # Ran 2 tests, 0 skipped, 0 failed. +Support running a specific test case + + $ rt "test-cases-abc.t (case B)" + + --- $TESTTMP/anothertests/cases/test-cases-abc.t + +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err + @@ -7,7 +7,7 @@ + $ V=C + #endif + $ echo $V | sed 's/A/C/' + - C + + B + #if C + $ [ $V = C ] + #endif + + ERROR: test-cases-abc.t (case B) output changed + ! + Failed test-cases-abc.t (case B): output changed + # Ran 1 tests, 0 skipped, 1 failed. + python hash seed: * (glob) + [1] + +Support running multiple test cases in the same file + + $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case C)" + + --- $TESTTMP/anothertests/cases/test-cases-abc.t + +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err + @@ -7,7 +7,7 @@ + $ V=C + #endif + $ echo $V | sed 's/A/C/' + - C + + B + #if C + $ [ $V = C ] + #endif + + ERROR: test-cases-abc.t (case B) output changed + !. + Failed test-cases-abc.t (case B): output changed + # Ran 2 tests, 0 skipped, 1 failed. + python hash seed: * (glob) + [1] + +Support running invalid test cases + + $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case D)" + + --- $TESTTMP/anothertests/cases/test-cases-abc.t + +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err + @@ -7,7 +7,7 @@ + $ V=C + #endif + $ echo $V | sed 's/A/C/' + - C + + B + #if C + $ [ $V = C ] + #endif + + ERROR: test-cases-abc.t (case B) output changed + ! + Failed test-cases-abc.t (case B): output changed + # Ran 1 tests, 0 skipped, 1 failed. + python hash seed: * (glob) + [1] + Test automatic pattern replacement +== $ cat << EOF >> common-pattern.py > substitutions = [ diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -2646,16 +2646,28 @@ expanded_args.append(arg) args = expanded_args +testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))') tests = [] for t in args: +case = None + if not (os.path.basename(t).startswith(b'test-') and (t.endswith(b'.py') or t.endswith(b'.t'))): -continue + +m = testcasepattern.match(t) +if m is not None: +t, _, case = m.groups() +else: +continue + if t.endswith(b'.t'): # .t file may contain multiple test cases cases = sorted(parsettestcases(t)) if cases: -tests += [{'path': t, 'case': c} for c in sorted(cases)] +if case is not None and case in cases: +tests += [{'path': t, 'case': case}] +else: +tests += [{'path': t, 'case': c} for c in sorted(cases)] else: tests.append({'path': t}) else: To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3554: xdiff: fix Py_BuildValue types (issue5885)
quark abandoned this revision. quark added a comment. Duplicated with https://phab.mercurial-scm.org/D3538. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3554 To: quark, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3554: xdiff: fix Py_BuildValue types (issue5885)
quark created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Julien Cristau reported and provided the fix [1]. I added an assertion. Note Python documentation (2.7 to 3.5) says "L" in `Py_BuildValue` might be unsupported on some platforms: L (int) [PY_LONG_LONG] Convert a Python integer to a C long long. This format is only available on platforms that support long long (or _int64 on Windows). But it is required to build Python 2.7 itself [2]. So using it won't affect supported platforms. [1]: https://bz.mercurial-scm.org/show_bug.cgi?id=5885#c3 [2]: https://bugs.python.org/issue27961 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3554 AFFECTED FILES mercurial/cext/bdiff.c CHANGE DETAILS diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -261,7 +261,8 @@ void *priv) { PyObject *rl = (PyObject *)priv; - PyObject *m = Py_BuildValue("", a1, a2, b1, b2); + Py_BUILD_ASSERT(sizeof(a1) == sizeof(PY_LONG_LONG)); + PyObject *m = Py_BuildValue("", a1, a2, b1, b2); if (!m) return -1; if (PyList_Append(rl, m) != 0) { To: quark, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. In https://phab.mercurial-scm.org/D2409#44682, @pulkit wrote: > In https://phab.mercurial-scm.org/D2409#43891, @khanchi97 wrote: > > > pulkit: Can you please review it? I have made the requested changes. > > > I am sorry but I will like this to wait before we land the new state format thing. I don't want to put more information in old state files which don't have good format. But yes, if someone else feels we can go with this, I am fine with that too. @pulkit do we have new state format pushed in? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel