D5999: context: use includematcher when checking dir/file conflicts
This revision was automatically updated to reflect the committed changes. Closed by commit rHGcd7059d17cb2: context: use includematcher when checking dir/file conflicts (authored by spectral, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5999?vs=14182=14189 REVISION DETAIL https://phab.mercurial-scm.org/D5999 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1951,7 +1951,7 @@ # Test the other direction -- that this path from p2 isn't a directory # in p1 (test that p1 doesn't have any paths matching `path/*`). -match = self.match(pats=[path + '/'], default=b'path') +match = self.match(include=[path + '/'], default=b'path') matches = self.p1().manifest().matches(match) mfiles = matches.keys() if len(mfiles) > 0: To: spectral, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5998: tests: change the paths slightly in test-rebase-inmemory.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0b2361c2c493: tests: change the paths slightly in test-rebase-inmemory.t (authored by spectral, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5998?vs=14181=14188 REVISION DETAIL https://phab.mercurial-scm.org/D5998 AFFECTED FILES tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -240,19 +240,19 @@ |/ o 0: b173517d0057 'a' - $ mkdir c - $ echo c > c/c - $ hg add c/c - $ hg ci -m 'c/c' + $ mkdir -p c/subdir + $ echo c > c/subdir/file.txt + $ hg add c/subdir/file.txt + $ hg ci -m 'c/subdir/file.txt' $ hg rebase -r . -d 3 -n starting dry-run rebase; repository will not be changed - rebasing 8:755f0104af9b "c/c" (tip) - abort: error: 'c/c' conflicts with file 'c' in 3. + rebasing 8:e147e6e3c490 "c/subdir/file.txt" (tip) + abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3. [255] $ hg rebase -r 3 -d . -n starting dry-run rebase; repository will not be changed rebasing 3:844a7de3e617 "c" - abort: error: file 'c' cannot be written because 'c/' is a folder in 755f0104af9b (containing 1 entries: c/c) + abort: error: file 'c' cannot be written because 'c/' is a folder in e147e6e3c490 (containing 1 entries: c/subdir/file.txt) [255] $ cd .. To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5999: context: use includematcher when checking dir/file conflicts
martinvonz accepted this revision. martinvonz added a comment. This revision is now accepted and ready to land. I suppose `includematcher` can be optimized that way because it's always recursive? Perhaps it should have been called `recursivematcher` or something. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5999 To: spectral, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6004: changegroup: moving non-pruning pf non-ellipsis manifests to _prunemanifests()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Google has an extension that overrides _prunemanifests() and removes nodes that we fetch using another mechanism. That broke when _prunemanifests() no longer got called. It works again if we move the check for "not self._ellipses" inside _prunemanifests(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6004 AFFECTED FILES mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -1073,11 +1073,6 @@ # because of narrow clones). Do this even for the root # directory (tree=='') prunednodes = [] -elif not self._ellipses: -# In non-ellipses case and large repositories, it is better to -# prevent calling of store.rev and store.linkrev on a lot of -# nodes as compared to sending some extra data -prunednodes = nodes.copy() else: # Avoid sending any manifest nodes we can prove the # client already has by checking linkrevs. See the @@ -1110,6 +1105,11 @@ yield tree, [] def _prunemanifests(self, store, nodes, commonrevs): +if not self._ellipses: +# In non-ellipses case and large repositories, it is better to +# prevent calling of store.rev and store.linkrev on a lot of +# nodes as compared to sending some extra data +return nodes.copy() # This is split out as a separate method to allow filtering # commonrevs in extension code. # To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6003: tests: add test for hg-test-mode emacs code
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is just coverage for the compilation-mode support, but that was enough of a hassle that I wanted to have it covered somehow. Test methodology is _extremely_ cargo-culted from the test for compilation-mode in emacs, so I still have no idea what I'm doing. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6003 AFFECTED FILES contrib/hg-test-mode.el tests/test-contrib-emacs.t CHANGE DETAILS diff --git a/tests/test-contrib-emacs.t b/tests/test-contrib-emacs.t new file mode 100644 --- /dev/null +++ b/tests/test-contrib-emacs.t @@ -0,0 +1,8 @@ +#require emacs + $ emacs -q -no-site-file -batch -l $TESTDIR/../contrib/hg-test-mode.el \ + > -f ert-run-tests-batch-and-exit + Running 1 tests (*) (glob) + passed 1/1 hg-test-mode--compilation-mode-support + + Ran 1 tests, 1 results as expected (*) (glob) + diff --git a/contrib/hg-test-mode.el b/contrib/hg-test-mode.el --- a/contrib/hg-test-mode.el +++ b/contrib/hg-test-mode.el @@ -65,4 +65,33 @@ "\\+ \\([^:\n]+\\):\\([0-9]+\\):$" 1 2)) (add-to-list 'compilation-error-regexp-alist 'hg-test-check-code-output)) +(defun hg-test-mode--test-one-error-line-regexp (test) + (erase-buffer) + (setq compilation-locs (make-hash-table)) + (insert (car test)) + (compilation-parse-errors (point-min) (point-max)) + (let ((msg (get-text-property 1 'compilation-message))) +(should msg) +(let ((loc (compilation--message->loc msg)) + (line (nth 1 test)) + (file (nth 2 test))) + (should (equal (compilation--loc->line loc) line)) + (should (equal (caar (compilation--loc->file-struct loc)) file))) + msg)) + +(require 'ert) +(ert-deftest hg-test-mode--compilation-mode-support () + "Test hg-specific compilation-mode regular expressions" + (require 'compile) + (with-temp-buffer +(font-lock-mode -1) +(mapc 'hg-test-mode--test-one-error-line-regexp + '( +("+ contrib/debugshell.py:37:" 37 "contrib/debugshell.py") +("+File \"/tmp/hg/mercurial/commands.py\", line 3115, in help_" + 3115 "/tmp/hg/mercurial/commands.py") +("+File \"mercurial/dispatch.py\", line 225, in dispatch" + 225 "mercurial/dispatch.py") + + (provide 'hg-test-mode) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6002: hghave: add check for GNU emacs
durin42 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/D6002 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -822,3 +822,7 @@ except (ImportError, AttributeError): pass return False + +@check('emacs', 'GNU Emacs') +def has_emacs(): +return matchoutput('emacs --version', b'GNU Emacs') To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6001: contrib: also linkify tracebacks in compilation output when using hg-test-mode
durin42 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/D6001 AFFECTED FILES contrib/hg-test-mode.el CHANGE DETAILS diff --git a/contrib/hg-test-mode.el b/contrib/hg-test-mode.el --- a/contrib/hg-test-mode.el +++ b/contrib/hg-test-mode.el @@ -54,6 +54,11 @@ (run-hooks 'hg-test-mode-hook)) (with-eval-after-load "compile" + ;; Link to Python sources in tracebacks in .t failures. + (add-to-list 'compilation-error-regexp-alist-alist + '(hg-test-output-python-tb + "^\\+ +File ['\"]\\([^'\"]+\\)['\"], line \\([0-9]+\\)," 1 2)) + (add-to-list 'compilation-error-regexp-alist 'hg-test-output-python-tb) ;; Link to source files in test-check-code.t violations. (add-to-list 'compilation-error-regexp-alist-alist '(hg-test-check-code-output To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6000: contrib: add compilation-mode linking for our test output
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY These regular expressions will cause compilation-mode buffers in emacs to link to source when there are check-code errors in the output of a .t test. In the true tradition of this file, I also have no idea what I'm doing. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6000 AFFECTED FILES contrib/hg-test-mode.el CHANGE DETAILS diff --git a/contrib/hg-test-mode.el b/contrib/hg-test-mode.el --- a/contrib/hg-test-mode.el +++ b/contrib/hg-test-mode.el @@ -53,4 +53,11 @@ (setq mode-name "hg-test") (run-hooks 'hg-test-mode-hook)) +(with-eval-after-load "compile" + ;; Link to source files in test-check-code.t violations. + (add-to-list 'compilation-error-regexp-alist-alist + '(hg-test-check-code-output + "\\+ \\([^:\n]+\\):\\([0-9]+\\):$" 1 2)) + (add-to-list 'compilation-error-regexp-alist 'hg-test-check-code-output)) + (provide 'hg-test-mode) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5999: context: use includematcher when checking dir/file conflicts
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is for performance; patternmatcher can't easily interpret its results to make visitchildrenset be the "optimal" set of paths to inspect, but includematcher can. Since there aren't any special patterns being used here, I believe that the two matchers are equivalent. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5999 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1885,7 +1885,7 @@ # Test the other direction -- that this path from p2 isn't a directory # in p1 (test that p1 doesn't have any paths matching `path/*`). -match = self.match(pats=[path + '/'], default=b'path') +match = self.match(include=[path + '/'], default=b'path') matches = self.p1().manifest().matches(match) mfiles = matches.keys() if len(mfiles) > 0: To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5998: tests: change the paths slightly in test-rebase-inmemory.t
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY c/c was a little difficult to understand (and verify that it was the *correct* 'c/' that was being talked about), and it's useful to have multiple directories to prove that we are able to detect this even if there's no files (just a subdirectory) in the immediate directory that's conflicting. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5998 AFFECTED FILES tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -240,19 +240,19 @@ |/ o 0: b173517d0057 'a' - $ mkdir c - $ echo c > c/c - $ hg add c/c - $ hg ci -m 'c/c' + $ mkdir -p c/subdir + $ echo c > c/subdir/file.txt + $ hg add c/subdir/file.txt + $ hg ci -m 'c/subdir/file.txt' $ hg rebase -r . -d 3 -n starting dry-run rebase; repository will not be changed - rebasing 8:755f0104af9b "c/c" (tip) - abort: error: 'c/c' conflicts with file 'c' in 3. + rebasing 8:e147e6e3c490 "c/subdir/file.txt" (tip) + abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3. [255] $ hg rebase -r 3 -d . -n starting dry-run rebase; repository will not be changed rebasing 3:844a7de3e617 "c" - abort: error: file 'c' cannot be written because 'c/' is a folder in 755f0104af9b (containing 1 entries: c/c) + abort: error: file 'c' cannot be written because 'c/' is a folder in e147e6e3c490 (containing 1 entries: c/subdir/file.txt) [255] $ cd .. To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5410: merge: allow to merge non-conflicting changes outside narrowspec
martinvonz added a comment. In https://phab.mercurial-scm.org/D5410#87526, @pulkit wrote: > In https://phab.mercurial-scm.org/D5410#85244, @martinvonz wrote: > > > In https://phab.mercurial-scm.org/D5410#85232, @pulkit wrote: > > > > > In https://phab.mercurial-scm.org/D5410#80207, @martinvonz wrote: > > > > > > > I'm pretty sure this doesn't actually perform the merge, it just drops the changes outside the narrowspec. On commit, we need to record that outside/ has the new nodeid that we got from the side we merged in. To do that, we need to remember what that nodeid is, from the time of `hg merge` to the time of `hg commit`. That probably means storing the nodeid in the dirstate (like git does), or maybe in the merge state. > > > > > > > > > IIUC, dirstate does not contains files outside narrowspec. Maybe we need to do this in merge state? > > > > > > I think neither of them currently contains files outside narrows, so we'd need to extend whichever we decide. It's probably easier to extend the merge state. I'm not sure which I think is cleaner to extend. There's precedent for populating the commit based on the dirstate (index) in git. > > > Or not touch any of them and introduce a new file? Sure, that's another option. It might be the easiest one since it won't involve making the format compatible (although I think that's pretty easy for the merge state). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5410 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2 V3] changelog: prefilter in headrevs()
On Thu, 21 Feb 2019 11:27:24 +0100, Georges Racinet wrote: > # HG changeset patch > # User Georges Racinet > # Date 1550659746 -3600 > # Wed Feb 20 11:49:06 2019 +0100 > # Node ID 1c1f122821291657b33b447e89dc4420b3f833b5 > # Parent 0c7b353ce100e9125251f4ae37a8739242ce537c > # EXP-Topic revset.predicates > changelog: prefilter in headrevs() Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] tests: fixed test too dependent on actual exception wording
On Thu, 21 Feb 2019 12:13:58 +0100, Georges Racinet wrote: > # HG changeset patch > # User Georges Racinet > # Date 1550744590 -3600 > # Thu Feb 21 11:23:10 2019 +0100 > # Node ID 4170f58a6145f75e71a711886daa7439c7d4bed6 > # Parent a87ca1d7e61df30f968f5b0ca1a1f846aef91cb9 > # EXP-Topic test-null-byte-filename > tests: fixed test too dependent on actual exception wording Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5993: cleanup: use () to wrap long lines instead of \
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaaad36b88298: cleanup: use () to wrap long lines instead of \ (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5993?vs=14173=14178 REVISION DETAIL https://phab.mercurial-scm.org/D5993 AFFECTED FILES contrib/debugshell.py contrib/packaging/hg-docker hgext/acl.py hgext/bugzilla.py hgext/convert/cvsps.py hgext/convert/git.py hgext/convert/p4.py hgext/convert/subversion.py hgext/histedit.py hgext/infinitepush/__init__.py hgext/largefiles/lfutil.py hgext/largefiles/reposetup.py hgext/record.py hgext/releasenotes.py hgext/remotefilelog/fileserverclient.py hgext/shelve.py i18n/posplit mercurial/branchmap.py mercurial/bundle2.py mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/debugcommands.py mercurial/exchange.py mercurial/httpconnection.py mercurial/merge.py mercurial/minirst.py mercurial/patch.py mercurial/simplemerge.py mercurial/sparse.py mercurial/subrepo.py mercurial/tags.py mercurial/ui.py setup.py tests/hghave.py tests/run-tests.py tests/test-duplicateoptions.py tests/test-run-tests.py tests/test-simplekeyvaluefile.py CHANGE DETAILS diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -82,8 +82,8 @@ dw = {b'key1': b'value1'} scmutil.simplekeyvaluefile(self.vfs, b'fl').write(dw, firstline=b'1.0') self.assertEqual(self.vfs.read(b'fl'), b'1.0\nkey1=value1\n') -dr = scmutil.simplekeyvaluefile(self.vfs, b'fl')\ -.read(firstlinenonkeyval=True) +dr = scmutil.simplekeyvaluefile( +self.vfs, b'fl').read(firstlinenonkeyval=True) self.assertEqual(dr, {b'__firstline': b'1.0', b'key1': b'value1'}) if __name__ == "__main__": diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py --- a/tests/test-run-tests.py +++ b/tests/test-run-tests.py @@ -37,8 +37,8 @@ """ assert (expected.endswith(b'\n') and output.endswith(b'\n')), 'missing newline' -assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \ - b'single backslash or unknown char' +assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), ( + b'single backslash or unknown char') test = run_tests.TTest(b'test-run-test.t', b'.', b'.') match, exact = test.linematch(expected, output) if isinstance(match, str): diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py --- a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py @@ -41,8 +41,8 @@ seenshort = globalshort.copy() seenlong = globallong.copy() for option in entry[1]: -if (option[0] and option[0] in seenshort) or \ - (option[1] and option[1] in seenlong): +if ((option[0] and option[0] in seenshort) or +(option[1] and option[1] in seenlong)): print("command '" + cmd + "' has duplicate option " + str(option)) seenshort.add(option[0]) seenlong.add(option[1]) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -929,8 +929,8 @@ self.fail('no result code from test') elif out != self._refout: # Diff generation may rely on written .err file. -if (ret != 0 or out != self._refout) and not self._skipped \ -and not self._debug: +if ((ret != 0 or out != self._refout) and not self._skipped +and not self._debug): with open(self.errpath, 'wb') as f: for line in out: f.write(line) @@ -978,8 +978,8 @@ # files are deleted shutil.rmtree(self._chgsockdir, True) -if (self._ret != 0 or self._out != self._refout) and not self._skipped \ -and not self._debug and self._out: +if ((self._ret != 0 or self._out != self._refout) and not self._skipped +and not self._debug and self._out): with open(self.errpath, 'wb') as f: for line in self._out: f.write(line) @@ -1105,8 +1105,8 @@ if 'HGTESTCATAPULTSERVERPIPE' not in env: # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the # non-test one in as a default, otherwise set to devnull -env['HGTESTCATAPULTSERVERPIPE'] = \ -env.get('HGCATAPULTSERVERPIPE', os.devnull) +env['HGTESTCATAPULTSERVERPIPE'] = env.get( +'HGCATAPULTSERVERPIPE', os.devnull) extraextensions = [] for opt in self._extraconfigopts: diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++
D5994: cleanup: prefer nested context managers to \-continuations
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1eb2fc21da12: cleanup: prefer nested context managers to \-continuations (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5994?vs=14164=14179 REVISION DETAIL https://phab.mercurial-scm.org/D5994 AFFECTED FILES hgext/largefiles/overrides.py hgext/narrow/narrowcommands.py mercurial/exchange.py CHANGE DETAILS diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -556,18 +556,18 @@ % stringutil.forcebytestr(err)) pushop.ui.debug(msg) -with wlock or util.nullcontextmanager(), \ -lock or util.nullcontextmanager(), \ -pushop.trmanager or util.nullcontextmanager(): -pushop.repo.checkpush(pushop) -_checkpublish(pushop) -_pushdiscovery(pushop) -if not _forcebundle1(pushop): -_pushbundle2(pushop) -_pushchangeset(pushop) -_pushsyncphase(pushop) -_pushobsolete(pushop) -_pushbookmark(pushop) +with wlock or util.nullcontextmanager(): +with lock or util.nullcontextmanager(): +with pushop.trmanager or util.nullcontextmanager(): +pushop.repo.checkpush(pushop) +_checkpublish(pushop) +_pushdiscovery(pushop) +if not _forcebundle1(pushop): +_pushbundle2(pushop) +_pushchangeset(pushop) +_pushsyncphase(pushop) +_pushobsolete(pushop) +_pushbookmark(pushop) if repo.ui.configbool('experimental', 'remotenames'): logexchange.pullremotenames(repo, remote) diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -278,9 +278,9 @@ p1, p2 = ds.p1(), ds.p2() with ds.parentchange(): ds.setparents(node.nullid, node.nullid) -with wrappedextraprepare,\ - repo.ui.configoverride(overrides, 'widen'): -exchange.pull(repo, remote, heads=common) +with wrappedextraprepare: +with repo.ui.configoverride(overrides, 'widen'): +exchange.pull(repo, remote, heads=common) with ds.parentchange(): ds.setparents(p1, p2) else: @@ -296,11 +296,11 @@ 'ellipses': False, }).result() -with repo.transaction('widening') as tr,\ - repo.ui.configoverride(overrides, 'widen'): -tgetter = lambda: tr -bundle2.processbundle(repo, bundle, -transactiongetter=tgetter) +with repo.transaction('widening') as tr: +with repo.ui.configoverride(overrides, 'widen'): +tgetter = lambda: tr +bundle2.processbundle(repo, bundle, +transactiongetter=tgetter) with repo.transaction('widening'): repo.setnewnarrowpats() diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -664,9 +664,9 @@ _('destination largefile already exists')) copiedfiles.append((src, dest)) orig(src, dest, *args, **kwargs) -with extensions.wrappedfunction(util, 'copyfile', overridecopyfile), \ - extensions.wrappedfunction(scmutil, 'match', overridematch): -result += orig(ui, repo, listpats, opts, rename) +with extensions.wrappedfunction(util, 'copyfile', overridecopyfile): +with extensions.wrappedfunction(scmutil, 'match', overridematch): +result += orig(ui, repo, listpats, opts, rename) lfdirstate = lfutil.openlfdirstate(ui, repo) for (src, dest) in copiedfiles: To: durin42, martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5995: contrib: enforce wrapping too-long lines with () instead of \
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe2472b12c842: contrib: enforce wrapping too-long lines with () instead of \ (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5995?vs=14165=14180 REVISION DETAIL https://phab.mercurial-scm.org/D5995 AFFECTED FILES contrib/check-code.py tests/test-contrib-check-code.t CHANGE DETAILS diff --git a/tests/test-contrib-check-code.t b/tests/test-contrib-check-code.t --- a/tests/test-contrib-check-code.t +++ b/tests/test-contrib-check-code.t @@ -7,6 +7,9 @@ > def toto( arg1, arg2): > del(arg2) > return ( 5+6, 9) + > def badwrap(): + > return 1 + \\ + >2 > NO_CHECK_EOF $ cat > quote.py < # let's use quote in comments @@ -42,6 +45,9 @@ > return ( 5+6, 9) gratuitous whitespace in () or [] missing whitespace in expression + ./wrong.py:5: + > return 1 + \ + Use () to wrap long lines in Python, not \ ./quote.py:5: > '"""', 42+1, """and missing whitespace in expression diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -233,6 +233,7 @@ pypats = [ [ +(r'\\$', 'Use () to wrap long lines in Python, not \\'), (r'^\s*def\s*\w+\s*\(.*,\s*\(', "tuple parameter unpacking not available in Python 3+"), (r'lambda\s*\(.*,.*\)', To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5992: tests: use () instead of \ to wrap lines
This revision was automatically updated to reflect the committed changes. Closed by commit rHG15d3facfa40a: tests: use () instead of \ to wrap lines (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5992?vs=14162=14177 REVISION DETAIL https://phab.mercurial-scm.org/D5992 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1408,8 +1408,8 @@ session = str(uuid.uuid4()) if PYTHON3: session = session.encode('ascii') -hgcatapult = os.getenv('HGTESTCATAPULTSERVERPIPE') or \ -os.getenv('HGCATAPULTSERVERPIPE') +hgcatapult = (os.getenv('HGTESTCATAPULTSERVERPIPE') or + os.getenv('HGCATAPULTSERVERPIPE')) def toggletrace(cmd=None): if not hgcatapult or hgcatapult == os.devnull: return To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5997: mq: disable qrecord during histedit (issue5981)
navaneeth.suresh created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY qrecord during histedit may lead to deadlock-like situations. qpop will throw an error on called during histedit even after qrecord-ing those changes. This patch makes qrecord to abort on histedit. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5997 AFFECTED FILES hgext/record.py tests/test-qrecord.t CHANGE DETAILS diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t --- a/tests/test-qrecord.t +++ b/tests/test-qrecord.t @@ -422,3 +422,42 @@ $ hg diff --nodates $ cd .. + +qrecord should throw an error when histedit in process + + $ hg init issue5981 + $ cd issue5981 + $ cat >> $HGRCPATH < [extensions] + > histedit= + > mq= + > EOF + $ echo > a + $ hg ci -Am 'foo bar' + adding a + $ hg log + changeset: 0:ea55e2ae468f + tag: tip + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: foo bar + + $ hg histedit tip --commands - 2>&1 < edit ea55e2ae468f foo bar + > EOF + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + adding a + Editing (ea55e2ae468f), you may commit or record as needed now. + (hg histedit --continue to resume) + [1] + $ echo 'foo bar' > a + $ hg qrecord -d '0 0' -m aaa a.patch < y + > y + > n + > y + > y + > n + > EOF + abort: histedit in progress, can't qrecord + [255] diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -119,6 +119,8 @@ overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): +if repo.vfs.exists('histedit-state'): +raise error.Abort(_("histedit in progress, can't qrecord")) cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, cmdutil.recordfilter, *pats, **opts) To: navaneeth.suresh, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5299: phabricator: fallback reading arcanist config files
philpep marked 2 inline comments as done. philpep added a comment. Thanks for the review and sorry for taking so long time to update the patch... I made changes to use encoding.environ and vfs like you suggested. Please let me known what I can do to introduce this (or at least part of) this feature, thanks! REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5299 To: philpep, #hg-reviewers Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5299: phabricator: fallback reading arcanist config files
philpep updated this revision to Diff 14175. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5299?vs=14174=14175 REVISION DETAIL https://phab.mercurial-scm.org/D5299 AFFECTED FILES hgext/phabricator.py CHANGE DETAILS diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -37,6 +37,9 @@ # API token. Get it from https://$HOST/conduit/login/ example.phabtoken = cli- + +As a fallback, read config from arc config files (.arcconfig, ~/.arcrc and +/etc/arcconfig) """ from __future__ import absolute_import @@ -46,6 +49,7 @@ import json import operator import re +import os from mercurial.node import bin, nullid from mercurial.i18n import _ @@ -60,13 +64,15 @@ parser, patch, phases, +pycompat, registrar, scmutil, smartset, tags, templateutil, url as urlmod, util, +vfs as vfsmod, ) from mercurial.utils import ( procutil, @@ -171,16 +177,49 @@ process(b'', params) return util.urlreq.urlencode(flatparams) +def readarcconfig(repo): +"""Return url, token, callsign read from arcanist config files + +This read and merge content of /etc/arcconfig, ~/.arcrc and .arconfig. +""" +if pycompat.iswindows: +paths = [ +vfsmod.vfs(encoding.encoding['ProgramData']).join( + 'Phabricator', 'Arcanist', 'config'), +vfsmod.vfs(encoding.environ['AppData']).join('.arcrc') +] +else: +paths = [ +vfsmod.vfs('/etc').join('.arconfig'), +os.path.expanduser('~/.arcrc'), +] +paths.append(vfsmod.vfs(repo.root).join('.arcconfig')) +config = {} +for path in paths: +if vfsmod.vfs(path).exists(): +with open(path, 'rb') as f: +config.update(json.load(f)) +callsign = config.get('repository.callsign') +conduit_uri = config.get('conduit_uri', config.get('config', {}).get('default')) +if conduit_uri is not None: +token = config.get('hosts', {}).get(conduit_uri, {}).get('token') +url = conduit_uri.rstrip('/api/') +return url, token, callsign + def readurltoken(repo): """return conduit url, token and make sure they exist -Currently read from [auth] config section. In the future, it might -make sense to read from .arcconfig and .arcrc as well. +Currently read from [auth] config section and fallback to reading arc +config files. """ url = repo.ui.config(b'phabricator', b'url') if not url: -raise error.Abort(_(b'config %s.%s is required') - % (b'phabricator', b'url')) +url, token, __ = readarcconfig(repo) +if not url or not token: +raise error.Abort(_(b'unable to read phabricator conduit url and ' +b'token from config %s.%s or from arc config ' +b'files') % (b'phabricator', b'url')) +return url, token res = httpconnectionmod.readauthforuri(repo.ui, url, util.url(url).user) token = None @@ -246,7 +285,9 @@ return repophid callsign = repo.ui.config(b'phabricator', b'callsign') if not callsign: -return None +__, __, callsign = readarcconfig(repo) +if not callsign: +return callsign query = callconduit(repo, b'diffusion.repository.search', {b'constraints': {b'callsigns': [callsign]}}) if len(query[r'data']) == 0: To: philpep, #hg-reviewers Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5299: phabricator: fallback reading arcanist config files
philpep updated this revision to Diff 14174. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5299?vs=12590=14174 REVISION DETAIL https://phab.mercurial-scm.org/D5299 AFFECTED FILES hgext/phabricator.py CHANGE DETAILS diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -37,6 +37,9 @@ # API token. Get it from https://$HOST/conduit/login/ example.phabtoken = cli- + +As a fallback, read config from arc config files (.arcconfig, ~/.arcrc and +/etc/arcconfig) """ from __future__ import absolute_import @@ -46,6 +49,7 @@ import json import operator import re +import os from mercurial.node import bin, nullid from mercurial.i18n import _ @@ -67,6 +71,7 @@ templateutil, url as urlmod, util, +vfs as vfsmod, ) from mercurial.utils import ( procutil, @@ -171,16 +176,49 @@ process(b'', params) return util.urlreq.urlencode(flatparams) +def readarcconfig(repo): +"""Return url, token, callsign read from arcanist config files + +This read and merge content of /etc/arcconfig, ~/.arcrc and .arconfig. +""" +if os.name == 'nt': +paths = [ +vfsmod.vfs(encoding.encoding['ProgramData']).join( + 'Phabricator', 'Arcanist', 'config'), +vfsmod.vfs(encoding.environ['AppData']).join('.arcrc') +] +else: +paths = [ +vfsmod.vfs('/etc').join('.arconfig'), +os.path.expanduser('~/.arcrc'), +] +paths.append(vfsmod.vfs(repo.root).join('.arcconfig')) +config = {} +for path in paths: +if os.path.exists(path): +with open(path, 'rb') as f: +config.update(json.load(f)) +callsign = config.get('repository.callsign') +conduit_uri = config.get('conduit_uri', config.get('config', {}).get('default')) +if conduit_uri is not None: +token = config.get('hosts', {}).get(conduit_uri, {}).get('token') +url = conduit_uri.rstrip('/api/') +return url, token, callsign + def readurltoken(repo): """return conduit url, token and make sure they exist -Currently read from [auth] config section. In the future, it might -make sense to read from .arcconfig and .arcrc as well. +Currently read from [auth] config section and fallback to reading arc +config files. """ url = repo.ui.config(b'phabricator', b'url') if not url: -raise error.Abort(_(b'config %s.%s is required') - % (b'phabricator', b'url')) +url, token, __ = readarcconfig(repo) +if not url or not token: +raise error.Abort(_(b'unable to read phabricator conduit url and ' +b'token from config %s.%s or from arc config ' +b'files') % (b'phabricator', b'url')) +return url, token res = httpconnectionmod.readauthforuri(repo.ui, url, util.url(url).user) token = None @@ -246,7 +284,9 @@ return repophid callsign = repo.ui.config(b'phabricator', b'callsign') if not callsign: -return None +__, __, callsign = readarcconfig(repo) +if not callsign: +return callsign query = callconduit(repo, b'diffusion.repository.search', {b'constraints': {b'callsigns': [callsign]}}) if len(query[r'data']) == 0: To: philpep, #hg-reviewers Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5993: cleanup: use () to wrap long lines instead of \
durin42 updated this revision to Diff 14173. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5993?vs=14163=14173 REVISION DETAIL https://phab.mercurial-scm.org/D5993 AFFECTED FILES contrib/debugshell.py contrib/packaging/hg-docker hgext/acl.py hgext/bugzilla.py hgext/convert/cvsps.py hgext/convert/git.py hgext/convert/p4.py hgext/convert/subversion.py hgext/histedit.py hgext/infinitepush/__init__.py hgext/largefiles/lfutil.py hgext/largefiles/reposetup.py hgext/record.py hgext/releasenotes.py hgext/remotefilelog/fileserverclient.py hgext/shelve.py i18n/posplit mercurial/branchmap.py mercurial/bundle2.py mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/debugcommands.py mercurial/exchange.py mercurial/httpconnection.py mercurial/merge.py mercurial/minirst.py mercurial/patch.py mercurial/simplemerge.py mercurial/sparse.py mercurial/subrepo.py mercurial/tags.py mercurial/ui.py setup.py tests/hghave.py tests/run-tests.py tests/test-duplicateoptions.py tests/test-run-tests.py tests/test-simplekeyvaluefile.py CHANGE DETAILS diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -82,8 +82,8 @@ dw = {b'key1': b'value1'} scmutil.simplekeyvaluefile(self.vfs, b'fl').write(dw, firstline=b'1.0') self.assertEqual(self.vfs.read(b'fl'), b'1.0\nkey1=value1\n') -dr = scmutil.simplekeyvaluefile(self.vfs, b'fl')\ -.read(firstlinenonkeyval=True) +dr = scmutil.simplekeyvaluefile( +self.vfs, b'fl').read(firstlinenonkeyval=True) self.assertEqual(dr, {b'__firstline': b'1.0', b'key1': b'value1'}) if __name__ == "__main__": diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py --- a/tests/test-run-tests.py +++ b/tests/test-run-tests.py @@ -37,8 +37,8 @@ """ assert (expected.endswith(b'\n') and output.endswith(b'\n')), 'missing newline' -assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \ - b'single backslash or unknown char' +assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), ( + b'single backslash or unknown char') test = run_tests.TTest(b'test-run-test.t', b'.', b'.') match, exact = test.linematch(expected, output) if isinstance(match, str): diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py --- a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py @@ -41,8 +41,8 @@ seenshort = globalshort.copy() seenlong = globallong.copy() for option in entry[1]: -if (option[0] and option[0] in seenshort) or \ - (option[1] and option[1] in seenlong): +if ((option[0] and option[0] in seenshort) or +(option[1] and option[1] in seenlong)): print("command '" + cmd + "' has duplicate option " + str(option)) seenshort.add(option[0]) seenlong.add(option[1]) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -929,8 +929,8 @@ self.fail('no result code from test') elif out != self._refout: # Diff generation may rely on written .err file. -if (ret != 0 or out != self._refout) and not self._skipped \ -and not self._debug: +if ((ret != 0 or out != self._refout) and not self._skipped +and not self._debug): with open(self.errpath, 'wb') as f: for line in out: f.write(line) @@ -978,8 +978,8 @@ # files are deleted shutil.rmtree(self._chgsockdir, True) -if (self._ret != 0 or self._out != self._refout) and not self._skipped \ -and not self._debug and self._out: +if ((self._ret != 0 or self._out != self._refout) and not self._skipped +and not self._debug and self._out): with open(self.errpath, 'wb') as f: for line in self._out: f.write(line) @@ -1105,8 +1105,8 @@ if 'HGTESTCATAPULTSERVERPIPE' not in env: # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the # non-test one in as a default, otherwise set to devnull -env['HGTESTCATAPULTSERVERPIPE'] = \ -env.get('HGCATAPULTSERVERPIPE', os.devnull) +env['HGTESTCATAPULTSERVERPIPE'] = env.get( +'HGCATAPULTSERVERPIPE', os.devnull) extraextensions = [] for opt in self._extraconfigopts: diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -343,8 +343,8 @@ @check("svn", "subversion client and admin tools") def has_svn(): -return matchoutput('svn --version 2>&1',
D5792: uncommit: added interactive mode(issue6062)
martinvonz added a comment. In https://phab.mercurial-scm.org/D5792#87534, @taapas1128 wrote: > @martinvonz Sure I will try to unify `_fixdirstate()` and `_uncommitdirstate()`. I will follow on the advancements you made. Should I send the new patch as a follow up or and altogether new patch making the amends in this? A new patch please (I've dropped this version). Just pull from the hg-commited repo and make sure it applies there. Note that you'll probably get an obsmarker when you pull, so you may need to `hg touch` some version of this commit in your repo to revive it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5792 To: taapas1128, #hg-reviewers, durin42 Cc: martinvonz, durin42, pulkit, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5792: uncommit: added interactive mode(issue6062)
taapas1128 added a comment. @martinvonz Sure I will try to unify `_fixdirstate()` and `_uncommitdirstate()`. I will follow on the advancements you made. Should I send the new patch as a follow up or and altogether new patch making the amends in this? INLINE COMMENTS > martinvonz wrote in uncommit.py:273 > Unnecessary (done on line 269) Will look into it. > martinvonz wrote in uncommit.py:288 > Why did this moved here? I just moved it down in > https://phab.mercurial-scm.org/D5660. I really should have written a better > commit message explaining what the problem was. But it's also unclear why it > should be moved back. Oh that was a mistake made due to rebasing on top . I will shift that back. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5792 To: taapas1128, #hg-reviewers, durin42 Cc: martinvonz, durin42, pulkit, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5792: uncommit: added interactive mode(issue6062)
martinvonz added a comment. I'll drop this patch from the queue because I think there's a lot that can be cleaned up. I tried to re-unify `_fixdirstate()` and `_uncommitdirstate()` myself. This is my first step: diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -138,7 +138,7 @@ def _fixdirstate(repo, oldctx, newctx, m ds.copy(src, dst) -def _uncommitdirstate(repo, oldctx, match, interactive): +def _uncommitdirstate(repo, oldctx, newctx, match, interactive): """Fix the dirstate after switching the working directory from oldctx to a copy of oldctx not containing changed files matched by match. @@ -217,21 +217,13 @@ def _uncommitdirstate(repo, oldctx, matc ds.remove(f) # Merge old parent and old working dir copies -oldcopies = {} -if interactive: -# Interactive had different meaning of the variables so restoring the -# original meaning to use them -m, a, r = repo.status(oldctx.p1(), oldctx, match=match)[:3] -for f in (m + a): -src = oldctx[f].renamed() -if src: -oldcopies[f] = src[0] +oldcopies = copiesmod.pathcopies(newctx, oldctx, match) oldcopies.update(copies) copies = dict((dst, oldcopies.get(src, src)) for dst, src in oldcopies.iteritems()) # Adjust the dirstate copies for dst, src in copies.iteritems(): -if (src not in ctx or dst in ctx or ds[dst] != 'a'): +if (src not in newctx or dst in newctx or ds[dst] != 'a'): src = None ds.copy(src, dst) @@ -285,11 +277,11 @@ def uncommit(ui, repo, *pats, **opts): # Fully removed the old commit mapping[old.node()] = () -scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True) - with repo.dirstate.parentchange(): repo.dirstate.setparents(newid, node.nullid) -_uncommitdirstate(repo, old, match, interactive) +_uncommitdirstate(repo, old, repo[newid], match, interactive) + +scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True) def _interactiveuncommit(ui, repo, old, match): """ The function which contains all the logic for interactively uncommiting Is there a reason that's broken? Tests seem to pass (test-uncommit.t passes). If not, could you try to continue in the direction of unifying the two method again? INLINE COMMENTS > uncommit.py:141 > + > +def _uncommitdirstate(repo, oldctx, match, interactive): > +"""Fix the dirstate after switching the working directory from Much of this duplicates `_fixdirstate()`. We must be able to share some of this code. > uncommit.py:273 > +if interactive: > +match = scmutil.match(old, pats, opts) > +newid = _interactiveuncommit(ui, repo, old, match) Unnecessary (done on line 269) > uncommit.py:288 > > +scmutil.cleanupnodes(repo, mapping, 'uncommit', fixphase=True) > + Why did this moved here? I just moved it down in https://phab.mercurial-scm.org/D5660. I really should have written a better commit message explaining what the problem was. But it's also unclear why it should be moved back. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5792 To: taapas1128, #hg-reviewers, durin42 Cc: martinvonz, durin42, pulkit, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5410: merge: allow to merge non-conflicting changes outside narrowspec
pulkit added a comment. In https://phab.mercurial-scm.org/D5410#85244, @martinvonz wrote: > In https://phab.mercurial-scm.org/D5410#85232, @pulkit wrote: > > > In https://phab.mercurial-scm.org/D5410#80207, @martinvonz wrote: > > > > > I'm pretty sure this doesn't actually perform the merge, it just drops the changes outside the narrowspec. On commit, we need to record that outside/ has the new nodeid that we got from the side we merged in. To do that, we need to remember what that nodeid is, from the time of `hg merge` to the time of `hg commit`. That probably means storing the nodeid in the dirstate (like git does), or maybe in the merge state. > > > > > > IIUC, dirstate does not contains files outside narrowspec. Maybe we need to do this in merge state? > > > I think neither of them currently contains files outside narrows, so we'd need to extend whichever we decide. It's probably easier to extend the merge state. I'm not sure which I think is cleaner to extend. There's precedent for populating the commit based on the dirstate (index) in git. Or not touch any of them and introduce a new file? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5410 To: pulkit, durin42, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5996: committablectx: move status-related methods closer together
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The modified()/added()/removed()/deleted() clearly belong very close to status(). I separated them in committablectx by the new p[12]copies() methods. This brings the close again. Sorry about the churn. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5996 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1181,6 +1181,14 @@ def files(self): return sorted(self._status.modified + self._status.added + self._status.removed) +def modified(self): +return self._status.modified +def added(self): +return self._status.added +def removed(self): +return self._status.removed +def deleted(self): +return self._status.deleted @propertycache def _copies(self): p1copies = {} @@ -1201,14 +1209,6 @@ return self._copies[0] def p2copies(self): return self._copies[1] -def modified(self): -return self._status.modified -def added(self): -return self._status.added -def removed(self): -return self._status.removed -def deleted(self): -return self._status.deleted def branch(self): return encoding.tolocal(self._extra['branch']) def closesbranch(self): To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6088] New: make `hg debugupgraderepo` to work on repos using zstd compression
https://bz.mercurial-scm.org/show_bug.cgi?id=6088 Bug ID: 6088 Summary: make `hg debugupgraderepo` to work on repos using zstd compression Product: Mercurial Version: 4.8 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: 7895pul...@gmail.com CC: mercurial-devel@mercurial-scm.org `hg debugupgraderepo` refuses to work on repositories which uses zstd compression. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 6087] New: make `hg debugupgraderepo` to work on treemanifest repo
https://bz.mercurial-scm.org/show_bug.cgi?id=6087 Bug ID: 6087 Summary: make `hg debugupgraderepo` to work on treemanifest repo Product: Mercurial Version: 4.8 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: 7895pul...@gmail.com CC: mercurial-devel@mercurial-scm.org `hg debugupgraderepo` is a nice tool to upgrade your repository with the new optimizations done in recent mercurial. However it does not work on repos which uses treemanifest. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH STABLE] subrepo: add test for Windows relative-ish path with drive letter
On Thu, Feb 21, 2019 at 4:16 AM Yuya Nishihara wrote: > On Wed, 20 Feb 2019 20:00:48 -0500, Matt Harbison wrote: > > On Wed, 20 Feb 2019 00:56:42 -0500, Martin von Zweigbergk > > wrote: > > > > > On Fri, Feb 8, 2019 at 6:42 AM Yuya Nishihara wrote: > > > > > >> # HG changeset patch > > >> # User Yuya Nishihara > > >> # Date 1549540241 -32400 > > >> # Thu Feb 07 20:50:41 2019 +0900 > > >> # Branch stable > > >> # Node ID adf01cdceea20b5ad6dacb11dbb1d94e5055e39c > > >> # Parent 87a6e3c953e045d92147925fc71aad7c327fdbfd > > >> subrepo: add test for Windows relative-ish path with drive letter > > >> > > > > > > Queued for stable, thanks. Sorry about the delay. > > > > Not sure what happened, but it looks like the abort is missing its exit > > code. > > Oops. Appears that I didn't simulate Windows result properly in my brain. > > > Do you want a followup, or can you amend it in place? > > Can you send a follow up? It's behind a merge commit, so better to not > rewrite it. > (You can now evolve merge commits using `hg evolve`) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] tests: fixed test too dependent on actual exception wording
# HG changeset patch # User Georges Racinet # Date 1550744590 -3600 # Thu Feb 21 11:23:10 2019 +0100 # Node ID 4170f58a6145f75e71a711886daa7439c7d4bed6 # Parent a87ca1d7e61df30f968f5b0ca1a1f846aef91cb9 # EXP-Topic test-null-byte-filename tests: fixed test too dependent on actual exception wording On one of the machines I use to run the tests prior to submission, the default Python is 2.7.5, with the following wording: must be encoded string without NULL bytes, not str This third form (and possible future ones) are motivation to use a wider catching regexp. diff -r a87ca1d7e61d -r 4170f58a6145 tests/test-remotefilelog-gc.t --- a/tests/test-remotefilelog-gc.t Mon Feb 11 16:34:48 2019 +0300 +++ b/tests/test-remotefilelog-gc.t Thu Feb 21 11:23:10 2019 +0100 @@ -108,6 +108,5 @@ $ printf "asdas\0das" >> $CACHEDIR/repos $ hg gc - abort: invalid path asdas\x00da: stat: embedded null character in path (esc) (py3 !) - abort: invalid path asdas\x00da: stat() argument 1 must be encoded string without null bytes, not str (esc) (no-py3 !) + abort: invalid path asdas\x00da: .*(null|NULL).* (re) [255] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V3] rust-cpython: using rustext.dagop.headrevs in revlog
# HG changeset patch # User Georges Racinet # Date 1547651966 -3600 # Wed Jan 16 16:19:26 2019 +0100 # Node ID 2f378c55646d0fea1d1884b7a963ebd2aadf # Parent 1c1f122821291657b33b447e89dc4420b3f833b5 # EXP-Topic revset.predicates rust-cpython: using rustext.dagop.headrevs in revlog As with the previous oxidation series, revlog plays the role of the factory, either using its parents function, or passing the index. We include below results of revsetbenchmarks.py taken on the PyPy repository on those of contrib/all-revsets.tx that involve `heads()`. In most of the cases, this seems to be either neutral or an improvement. In the cases where it's actually a bit slower, we suspect that differences in `heads()` performance is actually burried in variance on the incoming revset (probably several orders of magnitude slower). The precheck for filtered revisions of parent changeset has a significative performance benefit, too. Result by revset Revision: 0) 0c7b353ce100; rust-cpython: binding for headrevs() 1) Parent of this changeset; changelog: prefilter in headrevs() 2) This changeset revset #0: heads(commonancestors(last(head(), 2))) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.001379 0.001361 0.001381 0.001410 0.001393 0.001372 0.001414 0.001387 0.001411 0.001429 0.001415 1) 0.001351 0.001373 0.001383 0.001392 0.001401 0.001385 0.001405 0.001406 0.001385 0.001424 0.001399 2) 0.001365 0.001362 0.001375 0.001393 0.001370 0.001365 0.001413 0.001386 0.001377 0.001415 0.001411 revset #1: heads(commonancestors(head())) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.047578 0.048578 0.047764 0.048065 0.047289 0.047305 0.047729 0.047370 0.047611 0.048005 0.047755 1) 0.048072 0.047471 0.048351 0.048193 0.048380 0.047968 0.047683 0.047355 0.048587 0.047044 0.048299 2) 0.047124 0.046699 0.046896 0.047250 0.046920 0.047379 0.046855 0.047753 0.047289 0.047219 0.046991 revset #2: heads(all()) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.037654 0.037814 0.037149 0.037457 0.037609 0.037053 0.036825 0.037054 0.037739 0.036816 0.037604 1) 0.021845 58% 0.022172 58% 0.022148 59% 0.022059 58% 0.022261 59% 0.022246 60% 0.021691 58% 0.021967 59% 0.022156 58% 0.021820 59% 0.023141 61% 2) 0.014459 66% 0.014470 65% 0.014420 65% 0.014413 65% 0.014421 64% 0.014492 65% 0.014512 66% 0.014579 66% 0.014500 65% 0.014501 66% 0.014537 62% revset #3: heads(-1:-1) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.003696 0.003681 0.003719 0.003746 0.003725 0.003750 0.003692 0.003747 0.003712 0.003754 0.003763 1) 0.002131 57% 0.002142 58% 0.002147 57% 0.002203 58% 0.002143 57% 0.002208 58% 0.002158 58% 0.002182 58% 0.002169 58% 0.002209 58% 0.002201 58% 2) 0.001490 69% 0.001524 71% 0.001515 70% 0.001528 69% 0.001531 71% 0.001520 68% 0.001549 71% 0.001542 70% 0.001560 71% 0.001559 70% 0.001544 70% revset #4: (-5000:-1000) and heads(-1:-1) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 0.003832 0.003816 0.003747 0.003814 0.003749 0.003894 0.003784 0.003796 0.003915 0.003829 0.003795 1) 0.002282 59% 0.002208 57% 0.002220 59% 0.002240 58% 0.002210 58% 0.002276 58% 0.002250 59% 0.002250 59% 0.002311 59% 0.002230 58% 0.002241 59% 2) 0.001658 72% 0.001662 75% 0.001568 70% 0.001599 71% 0.001588 71% 0.001696 74% 0.001615 71% 0.001593 70% 0.001710 73% 0.001622 72% 0.001616 72% revset #5: heads(matching(tip, "author")) plain min max first last reverse rev..rst rev..ast sort sor..rst sor..ast 0) 7.826449 7.563260 7.581034 7.688493 7.634001 7.777860 7.768228 8.026097 7.767422 7.565254 7.938643 1) 7.750766 7.562555 7.660426 7.574089 7.492220 7.438582 7.562015 7.530635 93% 7.636343 7.636712 7.645113 2) 7.617941 7.519601 7.584922 7.507653 7.547440
[PATCH 1 of 2 V3] changelog: prefilter in headrevs()
# HG changeset patch # User Georges Racinet # Date 1550659746 -3600 # Wed Feb 20 11:49:06 2019 +0100 # Node ID 1c1f122821291657b33b447e89dc4420b3f833b5 # Parent 0c7b353ce100e9125251f4ae37a8739242ce537c # EXP-Topic revset.predicates changelog: prefilter in headrevs() In case where headrevs() is called on some revisions, we perform the check that aren't filtered in advance, and switch revlog to use its unchecked form. This allows to work with alternative implementations that don't have knowledge of the filtering system, such as the Rust one. diff -r 0c7b353ce100 -r 1c1f12282129 mercurial/changelog.py --- a/mercurial/changelog.pyThu Jan 10 18:25:18 2019 +0100 +++ b/mercurial/changelog.pyWed Feb 20 11:49:06 2019 +0100 @@ -22,6 +22,7 @@ error, pycompat, revlog, +util, ) from .utils import ( dateutil, @@ -350,6 +351,27 @@ def reachableroots(self, minroot, heads, roots, includepath=False): return self.index.reachableroots2(minroot, heads, roots, includepath) +def _checknofilteredinrevs(self, revs): +"""raise the appropriate error if 'revs' contains a filtered revision + +This returns a version of 'revs' to be used thereafter by the caller. +In particular, if revs is an iterator, it is converted into a set. +""" +safehasattr = util.safehasattr +if safehasattr(revs, '__next__'): +# Note that inspect.isgenerator() is not true for iterators, +revs = set(revs) + +filteredrevs = self.filteredrevs +if safehasattr(revs, 'first'): # smartset +offenders = revs & filteredrevs +else: +offenders = filteredrevs.intersection(revs) + +for rev in offenders: +raise error.FilteredIndexError(rev) +return revs + def headrevs(self, revs=None): if revs is None and self.filteredrevs: try: @@ -359,6 +381,8 @@ except AttributeError: return self._headrevs() +if self.filteredrevs: +revs = self._checknofilteredinrevs(revs) return super(changelog, self).headrevs(revs) def strip(self, *args, **kwargs): diff -r 0c7b353ce100 -r 1c1f12282129 mercurial/revlog.py --- a/mercurial/revlog.py Thu Jan 10 18:25:18 2019 +0100 +++ b/mercurial/revlog.py Wed Feb 20 11:49:06 2019 +0100 @@ -1121,7 +1121,7 @@ return self.index.headrevs() except AttributeError: return self._headrevs() -return dagop.headrevs(revs, self.parentrevs) +return dagop.headrevs(revs, self._uncheckedparentrevs) def computephases(self, roots): return self.index.computephasesmapsets(roots) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2 RESENT] rewriting: add an option for rewrite commands to use the archived phase
What can we do to make this series go forward? On 13/02/2019 15:38, Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1546394872 -3600 > # Wed Jan 02 03:07:52 2019 +0100 > # Node ID 9939d8e412e3e440f3b564fb96c187745d7a008c > # Parent 61ec4a834e2c88056ff47c0d3a7ff3bcb0f0d912 > # EXP-Topic archived-phase-UX > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 9939d8e412e3 > rewriting: add an option for rewrite commands to use the archived phase > > Using the archived phase for cleanup provide the same effect than stripping, > but in a faster, append-only way. > > We keep the feature experimental for now until it gets a bit more testing. > > diff --git a/mercurial/configitems.py b/mercurial/configitems.py > --- a/mercurial/configitems.py > +++ b/mercurial/configitems.py > @@ -470,6 +470,9 @@ coreconfigitem('experimental', 'bundleco > coreconfigitem('experimental', 'changegroup3', > default=False, > ) > +coreconfigitem('experimental', 'cleanup-as-archived', > +default=False, > +) > coreconfigitem('experimental', 'clientcompressionengines', > default=list, > ) > diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py > --- a/mercurial/scmutil.py > +++ b/mercurial/scmutil.py > @@ -1014,6 +1014,7 @@ def cleanupnodes(repo, replacements, ope > for phase, nodes in toadvance.items(): > phases.advanceboundary(repo, tr, phase, nodes) > > +mayusearchived = repo.ui.config('experimental', > 'cleanup-as-archived') > # Obsolete or strip nodes > if obsolete.isenabled(repo, obsolete.createmarkersopt): > # If a node is already obsoleted, and we want to obsolete it > @@ -1031,6 +1032,17 @@ def cleanupnodes(repo, replacements, ope > if rels: > obsolete.createmarkers(repo, rels, operation=operation, > metadata=metadata) > +elif phases.supportinternal(repo) and mayusearchived: > +# this assume we do not have "unstable" nodes above the cleaned > ones > +allreplaced = set() > +for ns in replacements.keys(): > +allreplaced.update(ns) > +if backup: > +from . import repair # avoid import cycle > +node = min(allreplaced, key=repo.changelog.rev) > +repair.backupbundle(repo, allreplaced, allreplaced, node, > +operation) > +phases.retractboundary(repo, tr, phases.archived, allreplaced) > else: > from . import repair # avoid import cycle > tostrip = list(n for ns in replacements for n in ns) > diff --git a/tests/test-phase-archived.t b/tests/test-phase-archived.t > --- a/tests/test-phase-archived.t > +++ b/tests/test-phase-archived.t > @@ -75,3 +75,69 @@ Test that bundle can unarchive a changes > date:Thu Jan 01 00:00:00 1970 + > summary: root > > + > +Test that history rewriting command can use the archived phase when allowed > to > +-- > + > + $ hg up 'desc(unbundletesting)' > + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > + $ echo bar >> a > + $ hg commit --amend --config experimental.cleanup-as-archived=yes > + $ hg log -G > + @ changeset: 2:d1e73e428f29 > + | tag: tip > + | parent: 0:c1863a3840c6 > + | user:test > + | date:Thu Jan 01 00:00:00 1970 + > + | summary: unbundletesting > + | > + o changeset: 0:c1863a3840c6 > + user:test > + date:Thu Jan 01 00:00:00 1970 + > + summary: root > + > + $ hg log -G --hidden > + @ changeset: 2:d1e73e428f29 > + | tag: tip > + | parent: 0:c1863a3840c6 > + | user:test > + | date:Thu Jan 01 00:00:00 1970 + > + | summary: unbundletesting > + | > + | o changeset: 1:883aadbbf309 > + |/ user:test > + |date:Thu Jan 01 00:00:00 1970 + > + |summary: unbundletesting > + | > + o changeset: 0:c1863a3840c6 > + user:test > + date:Thu Jan 01 00:00:00 1970 + > + summary: root > + > + $ ls -1 .hg/strip-backup/ > + 883aadbbf309-efc55adc-amend.hg > + 883aadbbf309-efc55adc-backup.hg > + $ hg unbundle .hg/strip-backup/883aadbbf309*amend.hg > + adding changesets > + adding manifests > + adding file changes > + added 0 changesets with 0 changes to 1 files > + (run 'hg update' to get a working copy) > + $ hg log -G > + @ changeset: 2:d1e73e428f29 > + | tag: tip > + | parent: 0:c1863a3840c6 > + | user:test > + | date:Thu Jan 01 00:00:00 1970 + > + | summary: unbundletesting > + | > + | o changeset: 1:883aadbbf309 > + |/ user: