D2222: convert: make hg sha1 regex consistently be a bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2a28bdb63f05: convert: make hg sha1 regex consistently be a bytes (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D?vs=5621&id=5625 REVISION DETAIL https://phab.mercurial-scm.org/D AFFECTED FILES hgext/convert/hg.py CHANGE DETAILS diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -42,7 +42,7 @@ mapfile = common.mapfile NoRepo = common.NoRepo -sha1re = re.compile(r'\b[0-9a-f]{12,40}\b') +sha1re = re.compile(br'\b[0-9a-f]{12,40}\b') class mercurial_sink(common.converter_sink): def __init__(self, ui, repotype, path): To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2220: convert: open all files in binary mode
This revision was automatically updated to reflect the committed changes. Closed by commit rHG42a393ea56d2: convert: open all files in binary mode (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2220?vs=5619&id=5623 REVISION DETAIL https://phab.mercurial-scm.org/D2220 AFFECTED FILES hgext/convert/common.py hgext/convert/convcmd.py hgext/convert/cvs.py hgext/convert/cvsps.py hgext/convert/filemap.py hgext/convert/hg.py hgext/convert/subversion.py CHANGE DETAILS diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -231,7 +231,7 @@ def httpcheck(ui, path, proto): try: opener = urlreq.buildopener() -rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path)) +rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path), 'rb') data = rsp.read() except urlerr.httperror as inst: if inst.code != 404: @@ -639,7 +639,7 @@ return if self.convertfp is None: self.convertfp = open(os.path.join(self.wc, '.svn', 'hg-shamap'), - 'a') + 'ab') self.convertfp.write('%s %d\n' % (destrev, self.revnum(rev))) self.convertfp.flush() @@ -1158,7 +1158,7 @@ if created: hook = os.path.join(created, 'hooks', 'pre-revprop-change') -fp = open(hook, 'w') +fp = open(hook, 'wb') fp.write(pre_revprop_change) fp.close() util.setflags(hook, False, True) @@ -1308,7 +1308,7 @@ self.setexec = [] fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') -fp = os.fdopen(fd, pycompat.sysstr('w')) +fp = os.fdopen(fd, pycompat.sysstr('wb')) fp.write(commit.desc) fp.close() try: diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -625,7 +625,7 @@ def converted(self, rev, destrev): if self.convertfp is None: -self.convertfp = open(self.repo.vfs.join('shamap'), 'a') +self.convertfp = open(self.repo.vfs.join('shamap'), 'ab') self.convertfp.write('%s %s\n' % (destrev, rev)) self.convertfp.flush() diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -71,7 +71,7 @@ (lex.infile, lex.lineno, listname, name)) return 1 return 0 -lex = shlex.shlex(open(path), path, True) +lex = shlex.shlex(open(path, 'rb'), path, True) lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?' cmd = lex.get_token() while cmd: diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -132,7 +132,7 @@ # Get the real directory in the repository try: -prefix = open(os.path.join('CVS','Repository')).read().strip() +prefix = open(os.path.join('CVS','Repository'), 'rb').read().strip() directory = prefix if prefix == ".": prefix = "" @@ -144,7 +144,7 @@ # Use the Root file in the sandbox, if it exists try: -root = open(os.path.join('CVS','Root')).read().strip() +root = open(os.path.join('CVS','Root'), 'rb').read().strip() except IOError: pass @@ -177,7 +177,7 @@ if cache == 'update': try: ui.note(_('reading cvs log cache %s\n') % cachefile) -oldlog = pickle.load(open(cachefile)) +oldlog = pickle.load(open(cachefile, 'rb')) for e in oldlog: if not (util.safehasattr(e, 'branchpoints') and util.safehasattr(e, 'commitid') and @@ -486,7 +486,7 @@ # write the new cachefile ui.note(_('writing cvs log cache %s\n') % cachefile) -pickle.dump(log, open(cachefile, 'w')) +pickle.dump(log, open(cachefile, 'wb')) else: log = oldlog diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -46,8 +46,8 @@ self.tags = {} self.lastbranch = {} self.socket = None -self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1] -self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1] +self.cvsroot = open(os.path.join(cvs, "Root"), 'rb').read()[:-1] +self.cvsrepo = open(os.path.join(cvs, "Repository"), 'rb').read()[:-1] self.encoding = encoding.encoding self._connect() @@ -141,7 +141,7 @@ passw = "A" cvspass = os.path.expanduser("~/.cvspass")
D2223: py3: whitelist test-convert-clonebranches.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8b33eb349e0b: py3: whitelist test-convert-clonebranches.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2223?vs=5622&id=5626 REVISION DETAIL https://phab.mercurial-scm.org/D2223 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -32,6 +32,7 @@ test-confused-revert.t test-contrib-check-code.t test-contrib-check-commit.t +test-convert-clonebranches.t test-copy-move-merge.t test-debugindexdot.t test-debugrename.t To: durin42, pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2221: convcmd: pass encoding name as a sysstr
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6df206ef4b10: convcmd: pass encoding name as a sysstr (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2221?vs=5620&id=5624 REVISION DETAIL https://phab.mercurial-scm.org/D2221 AFFECTED FILES hgext/convert/convcmd.py CHANGE DETAILS diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -16,6 +16,7 @@ encoding, error, hg, +pycompat, scmutil, util, ) @@ -55,9 +56,10 @@ def recode(s): if isinstance(s, unicode): -return s.encode(orig_encoding, 'replace') +return s.encode(pycompat.sysstr(orig_encoding), 'replace') else: -return s.decode('utf-8').encode(orig_encoding, 'replace') +return s.decode('utf-8').encode( +pycompat.sysstr(orig_encoding), 'replace') def mapbranch(branch, branchmap): ''' To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] test-narrow: partially stabilize on Windows
# HG changeset patch # User Matt Harbison # Date 1518501276 18000 # Tue Feb 13 00:54:36 2018 -0500 # Node ID 06a3f7c52e76f980ed3e58b119dd88ee1c679530 # Parent 434f9de0dcc58f26cf3903e0b6464e8852e2386d test-narrow: partially stabilize on Windows test-narrow-strip.t is still broken. I don't see any feature condititionals, so it might be an actual problem. diff --git a/tests/test-narrow-patterns.t b/tests/test-narrow-patterns.t --- a/tests/test-narrow-patterns.t +++ b/tests/test-narrow-patterns.t @@ -23,8 +23,21 @@ > hg add $d/bar > hg commit -m "add $d/bar" > done +#if execbit $ chmod +x dir1/dirA/foo $ hg commit -m "make dir1/dirA/foo executable" +#else + $ hg import --bypass - < # HG changeset patch + > make dir1/dirA/foo executable + > + > diff --git a/dir1/dirA/foo b/dir1/dirA/foo + > old mode 100644 + > new mode 100755 + > EOF + applying patch from stdin + $ hg update -qr tip +#endif $ hg log -G -T '{rev} {node|short} {files}\n' @ 13 c87ca422d521 dir1/dirA/foo | @@ -149,10 +162,14 @@ dir2 dir2/bar dir2/foo + +#if execbit $ test -x dir1/dirA/foo && echo executable executable $ test -x dir1/dirA/bar || echo not executable not executable +#endif + $ hg log -G -T '{rev} {node|short}{if(ellipsis, "...")} {files}\n' @ 8 c87ca422d521 dir1/dirA/foo | diff --git a/tests/test-narrow-update.t b/tests/test-narrow-update.t --- a/tests/test-narrow-update.t +++ b/tests/test-narrow-update.t @@ -47,7 +47,7 @@ $ hg update -q 'desc("modify inside")' $ find * inside - inside/f1 (glob) + inside/f1 $ cat inside/f1 modified @@ -56,7 +56,7 @@ $ hg update -q 'desc("modify outside")' $ find * inside - inside/f1 (glob) + inside/f1 $ cat inside/f1 modified ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 6 V3] archive: migrate to the fileprefetch callback mechanism
# HG changeset patch # User Matt Harbison # Date 1518328183 18000 # Sun Feb 11 00:49:43 2018 -0500 # Node ID 243fe0926905286bbce9078de38ea1565b03028a # Parent f5461e496adbb52ed35e71e8a00c9f0b6b5b9c0f archive: migrate to the fileprefetch callback mechanism diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -22,6 +22,7 @@ error, formatter, match as matchmod, +scmutil, util, vfs as vfsmod, ) @@ -338,7 +339,7 @@ total = len(files) if total: files.sort() -cmdutil._prefetchfiles(repo, ctx, files) +scmutil.fileprefetchhooks(repo, ctx, files) repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total) for i, f in enumerate(files): ff = ctx.flags(f) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -556,7 +556,7 @@ files = [f for f in files if match(f)] rev = self._state[1] ctx = self._repo[rev] -cmdutil._prefetchfiles(self._repo, ctx, files) +scmutil.fileprefetchhooks(self._repo, ctx, files) total = abstractsubrepo.archive(self, archiver, prefix, match) for subpath in ctx.substate: s = subrepo(ctx, subpath, True) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 6 V3] revert: drop the remnant of the prefetchfiles hook
# HG changeset patch # User Matt Harbison # Date 1518327627 18000 # Sun Feb 11 00:40:27 2018 -0500 # Node ID b5f3a374445c80e0608566537e989c543b9c7046 # Parent c63a31b38a09c007b3e4e7f09de8c3b591b55d0b revert: drop the remnant of the prefetchfiles hook diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2871,8 +2871,8 @@ _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) oplist = [actions[name][0] for name in needdata] -_prefetchfiles(repo, ctx, - [f for sublist in oplist for f in sublist]) +prefetch = scmutil.fileprefetchhooks +prefetch(repo, ctx, [f for sublist in oplist for f in sublist]) _performrevert(repo, parents, ctx, actions, interactive, tobackup) if targetsubs: @@ -2891,11 +2891,6 @@ _revertprefetch = _revertprefetchstub -def _prefetchfiles(repo, ctx, files): -"""Let extensions changing the storage layer prefetch content for any non -merge based command.""" -scmutil.fileprefetchhooks(repo, ctx, files) - def _performrevert(repo, parents, ctx, actions, interactive=False, tobackup=None): """function that actually perform all the actions computed for revert ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 6 of 6 V3] merge: invoke scmutil.fileprefetchhooks() prior to applying updates
# HG changeset patch # User Matt Harbison # Date 1518373556 18000 # Sun Feb 11 13:25:56 2018 -0500 # Node ID 434f9de0dcc58f26cf3903e0b6464e8852e2386d # Parent b5f3a374445c80e0608566537e989c543b9c7046 merge: invoke scmutil.fileprefetchhooks() prior to applying updates This moves the file list calculation into core, so other extensions don't need to duplicate it. diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -333,8 +333,6 @@ wrapfunction(hg, 'clone', wrapper.hgclone) wrapfunction(hg, 'postshare', wrapper.hgpostshare) -wrapfunction(merge, 'applyupdates', wrapper.mergemodapplyupdates) - scmutil.fileprefetchhooks.add('lfs', wrapper._prefetchfiles) # Make bundle choose changegroup3 instead of changegroup2. This affects diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -251,9 +251,7 @@ def _prefetchfiles(repo, ctx, files): """Ensure that required LFS blobs are present, fetching them as a group if -needed. - -This is centralized logic for various prefetch hooks.""" +needed.""" pointers = [] localstore = repo.svfs.lfslocalblobstore @@ -266,25 +264,6 @@ if pointers: repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore) -def mergemodapplyupdates(orig, repo, actions, wctx, mctx, overwrite, - labels=None): -"""Ensure that the required LFS blobs are present before applying updates, -fetching them as a group if needed. - -This has the effect of ensuring all necessary LFS blobs are present before -making working directory changes during an update (including after clone and -share) or merge.""" - -# Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they -# don't touch mctx. 'cd' is skipped, because changed/deleted never resolves -# to something from the remote side. -oplist = [actions[a] for a in 'g dc dg m'.split()] - -_prefetchfiles(repo, mctx, - [f for sublist in oplist for f, args, msg in sublist]) - -return orig(repo, actions, wctx, mctx, overwrite, labels) - def _canskipupload(repo): # if remotestore is a null store, upload is a no-op and can be skipped return isinstance(repo.svfs.lfsremoteblobstore, blobstore._nullremote) diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -1385,6 +1385,16 @@ if i > 0: yield i, f +def _prefetchfiles(repo, ctx, actions): +"""Invoke ``scmutil.fileprefetchhooks()`` for the files relevant to the dict +of merge actions. ``ctx`` is the context being merged in.""" + +# Skipping 'a', 'am', 'f', 'r', 'dm', 'e', 'k', 'p' and 'pr', because they +# don't touch the context to be merged in. 'cd' is skipped, because +# changed/deleted never resolves to something from the remote side. +oplist = [actions[a] for a in 'g dc dg m'.split()] +prefetch = scmutil.fileprefetchhooks +prefetch(repo, ctx, [f for sublist in oplist for f, args, msg in sublist]) def applyupdates(repo, actions, wctx, mctx, overwrite, labels=None): """apply the merge action list to the working directory @@ -1396,6 +1406,8 @@ describes how many files were affected by the update. """ +_prefetchfiles(repo, mctx, actions) + updated, merged, removed = 0, 0, 0 ms = mergestate.clean(repo, wctx.p1().node(), mctx.node(), labels) moves = [] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 6 V3] cmdutil: convert the prefetchfiles() hook to a callback mechanism (API)
# HG changeset patch # User Matt Harbison # Date 1518326637 18000 # Sun Feb 11 00:23:57 2018 -0500 # Node ID 7d3abc6fcc2f39cd890c0062121dcb0ac44df45a # Parent e99e6917138593d2dddf7e0f5506dbd3f6c87743 cmdutil: convert the prefetchfiles() hook to a callback mechanism (API) Yuya suggested a list of callbacks instead of function wrapping. This means that one extension can't block another from processing the list. .. api:: File prefetching is now handled by registering a callback with scmutil.fileprefetchhooks. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2865,8 +2865,9 @@ if not opts.get('dry_run'): needdata = ('revert', 'add', 'undelete') if _revertprefetch is not _revertprefetchstub: -ui.deprecwarn("'cmdutil._revertprefetch' is deprecated, use " - "'cmdutil._prefetchfiles'", '4.6', stacklevel=1) +ui.deprecwarn("'cmdutil._revertprefetch' is deprecated, " + "add a callback to 'scmutil.fileprefetchhooks'", + '4.6', stacklevel=1) _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata]) oplist = [actions[name][0] for name in needdata] @@ -2893,6 +2894,7 @@ def _prefetchfiles(repo, ctx, files): """Let extensions changing the storage layer prefetch content for any non merge based command.""" +scmutil.fileprefetchhooks(repo, ctx, files) def _performrevert(repo, parents, ctx, actions, interactive=False, tobackup=None): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1222,6 +1222,11 @@ 'unbundle', ] +# a list of (repo, ctx, files) functions called by various commands to allow +# extensions to ensure the corresponding files are available locally, before the +# command uses them. +fileprefetchhooks = util.hooks() + # A marker that tells the evolve extension to suppress its own reporting _reportstroubledchangesets = True ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 6 V3] lfs: migrate to the fileprefetch callback mechanism
# HG changeset patch # User Matt Harbison # Date 1518327015 18000 # Sun Feb 11 00:30:15 2018 -0500 # Node ID f5461e496adbb52ed35e71e8a00c9f0b6b5b9c0f # Parent 7d3abc6fcc2f39cd890c0062121dcb0ac44df45a lfs: migrate to the fileprefetch callback mechanism diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -334,7 +334,8 @@ wrapfunction(hg, 'postshare', wrapper.hgpostshare) wrapfunction(merge, 'applyupdates', wrapper.mergemodapplyupdates) -wrapfunction(cmdutil, '_prefetchfiles', wrapper.cmdutilprefetchfiles) + +scmutil.fileprefetchhooks.add('lfs', wrapper._prefetchfiles) # Make bundle choose changegroup3 instead of changegroup2. This affects # "hg bundle" command. Note: it does not cover all bundle formats like diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -266,12 +266,6 @@ if pointers: repo.svfs.lfsremoteblobstore.readbatch(pointers, localstore) -def cmdutilprefetchfiles(orig, repo, ctx, files): -"""Prefetch the indicated files before they are accessed by a command.""" -orig(repo, ctx, files) - -_prefetchfiles(repo, ctx, files) - def mergemodapplyupdates(orig, repo, actions, wctx, mctx, overwrite, labels=None): """Ensure that the required LFS blobs are present before applying updates, ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 6 V3] cat: migrate to the fileprefetch callback mechanism
# HG changeset patch # User Matt Harbison # Date 1518328282 18000 # Sun Feb 11 00:51:22 2018 -0500 # Node ID c63a31b38a09c007b3e4e7f09de8c3b591b55d0b # Parent 243fe0926905286bbce9078de38ea1565b03028a cat: migrate to the fileprefetch callback mechanism diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2187,14 +2187,14 @@ mfnode = ctx.manifestnode() try: if mfnode and mfl[mfnode].find(file)[0]: -_prefetchfiles(repo, ctx, [file]) +scmutil.fileprefetchhooks(repo, ctx, [file]) write(file) return 0 except KeyError: pass files = [f for f in ctx.walk(matcher)] -_prefetchfiles(repo, ctx, files) +scmutil.fileprefetchhooks(repo, ctx, files) for abs in files: write(abs) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2223: py3: whitelist test-convert-clonebranches.t
durin42 created this revision. Herald added a reviewer: pulkit. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2223 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -32,6 +32,7 @@ test-confused-revert.t test-contrib-check-code.t test-contrib-check-commit.t +test-convert-clonebranches.t test-copy-move-merge.t test-debugindexdot.t test-debugrename.t To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2220: convert: open all files in binary 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/D2220 AFFECTED FILES hgext/convert/common.py hgext/convert/convcmd.py hgext/convert/cvs.py hgext/convert/cvsps.py hgext/convert/filemap.py hgext/convert/hg.py hgext/convert/subversion.py CHANGE DETAILS diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -231,7 +231,7 @@ def httpcheck(ui, path, proto): try: opener = urlreq.buildopener() -rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path)) +rsp = opener.open('%s://%s/!svn/ver/0/.svn' % (proto, path), 'rb') data = rsp.read() except urlerr.httperror as inst: if inst.code != 404: @@ -639,7 +639,7 @@ return if self.convertfp is None: self.convertfp = open(os.path.join(self.wc, '.svn', 'hg-shamap'), - 'a') + 'ab') self.convertfp.write('%s %d\n' % (destrev, self.revnum(rev))) self.convertfp.flush() @@ -1158,7 +1158,7 @@ if created: hook = os.path.join(created, 'hooks', 'pre-revprop-change') -fp = open(hook, 'w') +fp = open(hook, 'wb') fp.write(pre_revprop_change) fp.close() util.setflags(hook, False, True) @@ -1308,7 +1308,7 @@ self.setexec = [] fd, messagefile = tempfile.mkstemp(prefix='hg-convert-') -fp = os.fdopen(fd, pycompat.sysstr('w')) +fp = os.fdopen(fd, pycompat.sysstr('wb')) fp.write(commit.desc) fp.close() try: diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -625,7 +625,7 @@ def converted(self, rev, destrev): if self.convertfp is None: -self.convertfp = open(self.repo.vfs.join('shamap'), 'a') +self.convertfp = open(self.repo.vfs.join('shamap'), 'ab') self.convertfp.write('%s %s\n' % (destrev, rev)) self.convertfp.flush() diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -71,7 +71,7 @@ (lex.infile, lex.lineno, listname, name)) return 1 return 0 -lex = shlex.shlex(open(path), path, True) +lex = shlex.shlex(open(path, 'rb'), path, True) lex.wordchars += '!@#$%^&*()-=+[]{}|;:,./<>?' cmd = lex.get_token() while cmd: diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -132,7 +132,7 @@ # Get the real directory in the repository try: -prefix = open(os.path.join('CVS','Repository')).read().strip() +prefix = open(os.path.join('CVS','Repository'), 'rb').read().strip() directory = prefix if prefix == ".": prefix = "" @@ -144,7 +144,7 @@ # Use the Root file in the sandbox, if it exists try: -root = open(os.path.join('CVS','Root')).read().strip() +root = open(os.path.join('CVS','Root'), 'rb').read().strip() except IOError: pass @@ -177,7 +177,7 @@ if cache == 'update': try: ui.note(_('reading cvs log cache %s\n') % cachefile) -oldlog = pickle.load(open(cachefile)) +oldlog = pickle.load(open(cachefile, 'rb')) for e in oldlog: if not (util.safehasattr(e, 'branchpoints') and util.safehasattr(e, 'commitid') and @@ -486,7 +486,7 @@ # write the new cachefile ui.note(_('writing cvs log cache %s\n') % cachefile) -pickle.dump(log, open(cachefile, 'w')) +pickle.dump(log, open(cachefile, 'wb')) else: log = oldlog diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py --- a/hgext/convert/cvs.py +++ b/hgext/convert/cvs.py @@ -46,8 +46,8 @@ self.tags = {} self.lastbranch = {} self.socket = None -self.cvsroot = open(os.path.join(cvs, "Root")).read()[:-1] -self.cvsrepo = open(os.path.join(cvs, "Repository")).read()[:-1] +self.cvsroot = open(os.path.join(cvs, "Root"), 'rb').read()[:-1] +self.cvsrepo = open(os.path.join(cvs, "Repository"), 'rb').read()[:-1] self.encoding = encoding.encoding self._connect() @@ -141,7 +141,7 @@ passw = "A" cvspass = os.path.expanduser("~/.cvspass") try: -pf = open(cvspass) +pf = open(cvspass, 'rb') for line in pf.rea
D2222: convert: make hg sha1 regex consistently be a bytes
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/D AFFECTED FILES hgext/convert/hg.py CHANGE DETAILS diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -42,7 +42,7 @@ mapfile = common.mapfile NoRepo = common.NoRepo -sha1re = re.compile(r'\b[0-9a-f]{12,40}\b') +sha1re = re.compile(br'\b[0-9a-f]{12,40}\b') class mercurial_sink(common.converter_sink): def __init__(self, ui, repotype, path): 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
D2221: convcmd: pass encoding name as a sysstr
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/D2221 AFFECTED FILES hgext/convert/convcmd.py CHANGE DETAILS diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -16,6 +16,7 @@ encoding, error, hg, +pycompat, scmutil, util, ) @@ -55,9 +56,10 @@ def recode(s): if isinstance(s, unicode): -return s.encode(orig_encoding, 'replace') +return s.encode(pycompat.sysstr(orig_encoding), 'replace') else: -return s.decode('utf-8').encode(orig_encoding, 'replace') +return s.decode('utf-8').encode( +pycompat.sysstr(orig_encoding), 'replace') def mapbranch(branch, branchmap): ''' 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
D2214: httppeer: change logic around argument handling
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The code to process arguments only makes sense if there are arguments. So change an "else" to "elif args", remove an "if" that isn't necessary, and add some docs for good measure. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2214 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -252,6 +252,8 @@ # with infinite recursion when trying to look up capabilities # for the first time. postargsok = self._caps is not None and 'httppostargs' in self._caps + +# Send arguments via POST. if postargsok and args: strargs = urlreq.urlencode(sorted(args.items())) if not data: @@ -265,20 +267,27 @@ argsio.length = len(strargs) data = _multifile(argsio, data) headers[r'X-HgArgs-Post'] = len(strargs) -else: -if len(args) > 0: -httpheader = self.capable('httpheader') -if httpheader: -headersize = int(httpheader.split(',', 1)[0]) +elif args: +# Calling self.capable() can infinite loop if we are calling +# "capabilities". But that command should never accept wire +# protocol arguments. So this should never happen. +assert cmd != 'capabilities' +httpheader = self.capable('httpheader') +if httpheader: +headersize = int(httpheader.split(',', 1)[0]) + +# Send arguments via HTTP headers. if headersize > 0: # The headers can typically carry more data than the URL. encargs = urlreq.urlencode(sorted(args.items())) for header, value in encodevalueinheaders(encargs, 'X-HgArg', headersize): headers[header] = value varyheaders.append(header) +# Send arguments via query string (Mercurial <1.9). else: q += sorted(args.items()) + qs = '?%s' % urlreq.urlencode(q) cu = "%s%s" % (self._url, qs) size = 0 To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2215: httppeer: remove redundant code to fetch capabilities
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY _fetchcaps() is called by httppeer.instance(), which is the only instantiator of httppeer. Since _fetchcaps() always sets self._caps and since https://phab.mercurial-scm.org/rHG197d10e157ce848129ff5e7a53cf81d4ca63a932 removed the fallback for cases where the remote doesn't support capabilities, we can remove some dead code from httppeer.capabilities(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2215 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -221,13 +221,9 @@ # Begin of _basewirepeer interface. def capabilities(self): -if self._caps is None: -try: -self._fetchcaps() -except error.RepoError: -self._caps = set() -self.ui.debug('capabilities: %s\n' % - (' '.join(self._caps or ['none']))) +# self._fetchcaps() should have been called as part of peer +# handshake. So self._caps should always be set. +assert self._caps is not None return self._caps # End of _basewirepeer interface. To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2218: wireprotoserver: rename webproto to httpv1protocolhandler
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This matches our naming convention for the SSH server's protocol handler. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2218 AFFECTED FILES mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -105,7 +105,7 @@ return ''.join(chunks) -class webproto(baseprotocolhandler): +class httpv1protocolhandler(baseprotocolhandler): def __init__(self, req, ui): self._req = req self._ui = ui @@ -201,7 +201,7 @@ if cmd not in wireproto.commands: return None -proto = webproto(req, repo.ui) +proto = httpv1protocolhandler(req, repo.ui) return { 'cmd': cmd, To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2216: httppeer: remove httpspeer
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY All it did was verify at construction time that Mercurial supports TLS. instance() is what's used to construct peer instances. So we can just inline this check into that function and do away with the type variant. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2216 AFFECTED FILES mercurial/httppeer.py CHANGE DETAILS diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -480,22 +480,15 @@ def _abort(self, exception): raise exception -class httpspeer(httppeer): -def __init__(self, ui, path): -if not url.has_https: -raise error.Abort(_('Python support for SSL and HTTPS ' - 'is not installed')) -httppeer.__init__(self, ui, path) - def instance(ui, path, create): if create: raise error.Abort(_('cannot create new http repository')) try: -if path.startswith('https:'): -inst = httpspeer(ui, path) -else: -inst = httppeer(ui, path) +if path.startswith('https:') and not url.has_https: +raise error.Abort(_('Python support for SSL and HTTPS ' +'is not installed')) +inst = httppeer(ui, path) inst._fetchcaps() return inst To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2212: util: convert traceback-related sysstrs to sysbytes in getstackframes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7ec26f27ca83: util: convert traceback-related sysstrs to sysbytes in getstackframes (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2212?vs=5604&id=5611 REVISION DETAIL https://phab.mercurial-scm.org/D2212 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -3171,7 +3171,7 @@ Not be used in production code but very convenient while developing. ''' -entries = [(fileline % (fn, ln), func) +entries = [(fileline % (pycompat.sysbytes(fn), ln), pycompat.sysbytes(func)) for fn, ln, func, _text in traceback.extract_stack()[:-skip - 1] ][-depth:] if entries: To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2211: util: format line number of stack trace using %d
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2874896a6e3b: util: format line number of stack trace using %d (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2211?vs=5603&id=5610 REVISION DETAIL https://phab.mercurial-scm.org/D2211 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -3159,7 +3159,7 @@ results.append(hook(*args)) return results -def getstackframes(skip=0, line=' %-*s in %s\n', fileline='%s:%s', depth=0): +def getstackframes(skip=0, line=' %-*s in %s\n', fileline='%s:%d', depth=0): '''Yields lines for a nicely formatted stacktrace. Skips the 'skip' last entries, then return the last 'depth' entries. Each file+linenumber is formatted according to fileline. To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2219: wireprotoserver: add version to HTTP protocol name (API)
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This matches what we did for the SSH protocol handler in https://phab.mercurial-scm.org/rHGac33dc94e1d53cf3fae22fd7e7c07805300ab42a. .. api:: HTTP protocol handlers now advertises its internal name as ``http-v1`` instead of ``http``. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2219 AFFECTED FILES mercurial/wireproto.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -112,7 +112,7 @@ @property def name(self): -return 'http' +return 'http-v1' def getargs(self, args): knownargs = self._args() diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -778,7 +778,7 @@ caps.append('bundle2=' + urlreq.quote(capsblob)) caps.append('unbundle=%s' % ','.join(bundle2.bundlepriority)) -if proto.name == 'http': +if proto.name == 'http-v1': caps.append('httpheader=%d' % repo.ui.configint('server', 'maxhttpheaderlen')) if repo.ui.configbool('experimental', 'httppostargs'): @@ -852,7 +852,7 @@ if not bundle1allowed(repo, 'pull'): if not exchange.bundle2requested(opts.get('bundlecaps')): -if proto.name == 'http': +if proto.name == 'http-v1': return ooberror(bundle2required) raise error.Abort(bundle2requiredmain, hint=bundle2requiredhint) @@ -878,7 +878,7 @@ except error.Abort as exc: # cleanly forward Abort error to the client if not exchange.bundle2requested(opts.get('bundlecaps')): -if proto.name == 'http': +if proto.name == 'http-v1': return ooberror(str(exc) + '\n') raise # cannot do better for bundle1 + ssh # bundle2 request expect a bundle2 reply @@ -983,7 +983,7 @@ gen = exchange.readbundle(repo.ui, fp, None) if (isinstance(gen, changegroupmod.cg1unpacker) and not bundle1allowed(repo, 'push')): -if proto.name == 'http': +if proto.name == 'http-v1': # need to special case http because stderr do not get to # the http client on failed push so we need to abuse # some other error type to make sure the message get to To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2217: wireproto: improve docstring for "hello"
indygreg 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/D2217 AFFECTED FILES mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -901,13 +901,16 @@ @wireprotocommand('hello') def hello(repo, proto): -'''the hello command returns a set of lines describing various -interesting things about the server, in an RFC822-like format. -Currently the only one defined is "capabilities", which -consists of a line in the form: +"""Called as part of SSH handshake to obtain server info. + +Returns a list of lines describing interesting things about the +server, in an RFC822-like format. -capabilities: space separated list of tokens -''' +Currently, the only one defined is ``capabilities``, which consists of a +line of space separated tokens describing server abilities: + +capabilities: +""" caps = capabilities(repo, proto).data return bytesresponse('capabilities: %s\n' % caps) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2210: util: call warnings.warn() with a sysstr in nouideprecwarn
This revision was automatically updated to reflect the committed changes. Closed by commit rHG02ed94dd9fd6: util: call warnings.warn() with a sysstr in nouideprecwarn (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2210?vs=5602&id=5609 REVISION DETAIL https://phab.mercurial-scm.org/D2210 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -253,7 +253,7 @@ if _dowarn: msg += ("\n(compatibility will be dropped after Mercurial-%s," " update your code.)") % version -warnings.warn(msg, DeprecationWarning, stacklevel + 1) +warnings.warn(pycompat.sysstr(msg), DeprecationWarning, stacklevel + 1) DIGESTS = { 'md5': hashlib.md5, To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2209: ui: convert stack traces to sysbytes before logging
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdf1760b58fda: ui: convert stack traces to sysbytes before logging (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2209?vs=5601&id=5608 REVISION DETAIL https://phab.mercurial-scm.org/D2209 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1620,10 +1620,12 @@ else: curframe = inspect.currentframe() calframe = inspect.getouterframes(curframe, 2) -self.write_err('%s at: %s:%s (%s)\n' - % ((msg,) + calframe[stacklevel][1:4])) -self.log('develwarn', '%s at: %s:%s (%s)\n', - msg, *calframe[stacklevel][1:4]) +fname, lineno, fmsg = calframe[stacklevel][1:4] +fname, fmsg = pycompat.sysbytes(fname), pycompat.sysbytes(fmsg) +self.write_err('%s at: %s:%d (%s)\n' + % (msg, fname, lineno, fmsg)) +self.log('develwarn', '%s at: %s:%d (%s)\n', + msg, fname, lineno, fmsg) curframe = calframe = None # avoid cycles def deprecwarn(self, msg, version, stacklevel=2): To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2213: py3: whitelist another 11 passing tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHGce9f1c32810b: py3: whitelist another 11 passing tests (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2213?vs=5605&id=5612 REVISION DETAIL https://phab.mercurial-scm.org/D2213 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -8,10 +8,12 @@ test-backwards-remove.t test-bheads.t test-bisect2.t +test-bookmarks-current.t test-bookmarks-merge.t test-bookmarks-strip.t test-branch-option.t test-branch-tag-confict.t +test-bundle-phases.t test-bundle-vs-outgoing.t test-casecollision.t test-cat.t @@ -85,6 +87,7 @@ test-glog-topological.t test-gpg.t test-hghave.t +test-http-clone-r.t test-imports-checker.t test-inherit-mode.t test-issue1089.t @@ -102,13 +105,16 @@ test-issue672.t test-issue842.t test-journal-exists.t +test-largefiles-small-disk.t test-locate.t test-logexchange.t test-lrucachedict.py +test-mactext.t test-manifest-merging.t test-manifest.py test-manifest.t test-match.py +test-merge-closedheads.t test-merge-commit.t test-merge-default.t test-merge-internal-tools-pattern.t @@ -125,8 +131,11 @@ test-merge7.t test-merge8.t test-mq-qimport-fail-cleanup.t +test-mq-qqueue.t test-mq-qsave.t +test-newbranch.t test-obshistory.t +test-obsmarkers-effectflag.t test-obsolete-changeset-exchange.t test-obsolete-checkheads.t test-obsolete-distributed.t @@ -187,14 +196,16 @@ test-sparse-merges.t test-sparse-requirement.t test-sparse-verbose-json.t +test-ssh-clone-r.t test-status-terse.t test-strip-cross.t test-strip.t test-unamend.t test-uncommit.t test-unified-test.t test-unrelated-pull.t test-up-local-change.t +test-update-branches.t test-update-dest.t test-update-issue1456.t test-update-names.t To: durin42, pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2208: ui: use pycompat.bytestr() to get a bytes-repr of config default
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8f5c7f906f9b: ui: use pycompat.bytestr() to get a bytes-repr of config default (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2208?vs=5600&id=5607 REVISION DETAIL https://phab.mercurial-scm.org/D2208 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -498,7 +498,7 @@ and default != itemdefault): msg = ("specifying a mismatched default value for a registered " "config item: '%s.%s' '%s'") -msg %= (section, name, default) +msg %= (section, name, pycompat.bytestr(default)) self.develwarn(msg, 2, 'warn-config-default') for s, n in alternates: To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2207: tests: add tons of b prefixes in test-devel-warnings.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0dde5f53b4ce: tests: add tons of b prefixes in test-devel-warnings.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2207?vs=5599&id=5606 REVISION DETAIL https://phab.mercurial-scm.org/D2207 AFFECTED FILES tests/test-devel-warnings.t CHANGE DETAILS diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t --- a/tests/test-devel-warnings.t +++ b/tests/test-devel-warnings.t @@ -17,17 +17,17 @@ > > @command(b'buggytransaction', [], '') > def buggylocking(ui, repo): - > tr = repo.transaction('buggy') + > tr = repo.transaction(b'buggy') > # make sure we rollback the transaction as we don't want to rely on the__del__ > tr.release() > > @command(b'properlocking', [], '') > def properlocking(ui, repo): > """check that reentrance is fine""" > wl = repo.wlock() > lo = repo.lock() - > tr = repo.transaction('proper') - > tr2 = repo.transaction('proper') + > tr = repo.transaction(b'proper') + > tr2 = repo.transaction(b'proper') > lo2 = repo.lock() > wl2 = repo.wlock() > wl2.release() @@ -46,34 +46,34 @@ > > @command(b'no-wlock-write', [], '') > def nowlockwrite(ui, repo): - > with repo.vfs(b'branch', 'a'): + > with repo.vfs(b'branch', b'a'): > pass > > @command(b'no-lock-write', [], '') > def nolockwrite(ui, repo): - > with repo.svfs(b'fncache', 'a'): + > with repo.svfs(b'fncache', b'a'): > pass > > @command(b'stripintr', [], '') > def stripintr(ui, repo): > lo = repo.lock() - > tr = repo.transaction('foobar') + > tr = repo.transaction(b'foobar') > try: - > repair.strip(repo.ui, repo, [repo['.'].node()]) + > repair.strip(repo.ui, repo, [repo[b'.'].node()]) > finally: > lo.release() > @command(b'oldanddeprecated', [], '') > def oldanddeprecated(ui, repo): > """test deprecation warning API""" > def foobar(ui): - > ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337') + > ui.deprecwarn(b'foorbar is deprecated, go shopping', b'42.1337') > foobar(ui) > @command(b'nouiwarning', [], '') > def nouiwarning(ui, repo): - > util.nouideprecwarn('this is a test', '13.37') + > util.nouideprecwarn(b'this is a test', b'13.37') > @command(b'programmingerror', [], '') > def programmingerror(ui, repo): - > raise error.ProgrammingError('something went wrong', hint='try again') + > raise error.ProgrammingError(b'something went wrong', hint=b'try again') > EOF $ cat << EOF >> $HGRCPATH @@ -331,7 +331,7 @@ $ hg nouiwarning $TESTTMP/buggylocking.py:*: DeprecationWarning: this is a test (glob) (compatibility will be dropped after Mercurial-13.37, update your code.) -util.nouideprecwarn('this is a test', '13.37') +util.nouideprecwarn(b'this is a test', b'13.37') (disabled outside of test run) @@ -350,25 +350,25 @@ > configtable = {} > configitem = registrar.configitem(configtable) > - > configitem('test', 'some', default='foo') - > configitem('test', 'dynamic', default=configitems.dynamicdefault) - > configitem('test', 'callable', default=list) + > configitem(b'test', b'some', default=b'foo') + > configitem(b'test', b'dynamic', default=configitems.dynamicdefault) + > configitem(b'test', b'callable', default=list) > # overwrite a core config - > configitem('ui', 'quiet', default=False) - > configitem('ui', 'interactive', default=None) + > configitem(b'ui', b'quiet', default=False) + > configitem(b'ui', b'interactive', default=None) > > @command(b'buggyconfig') > def cmdbuggyconfig(ui, repo): - > repo.ui.config('ui', 'quiet', True) - > repo.ui.config('ui', 'interactive', False) - > repo.ui.config('test', 'some', 'bar') - > repo.ui.config('test', 'some', 'foo') - > repo.ui.config('test', 'dynamic', 'some-required-default') - > repo.ui.config('test', 'dynamic') - > repo.ui.config('test', 'callable', []) - > repo.ui.config('test', 'callable', 'foo') - > repo.ui.config('test', 'unregistered') - > repo.ui.config('unregistered', 'unregistered') + > repo.ui.config(b'ui', b'quiet', True) + > repo.ui.config(b'ui', b'interactive', False) + > repo.ui.config(b'test', b'some', b'bar') + > repo.ui.config(b'test', b'some', b'foo') + > repo.ui.config(b'test', b'dynamic', b'some-required-default') + > repo.ui.config(b'test', b'dynamic') + > repo.ui.config(b'test', b'callable', []) + > repo.ui.config(b'test', b'callable', b'foo') + > repo.ui.config(b'test', b'unregistered') + > repo.ui.config(b'unregistered', b'unregistered') > EOF $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyc
D2211: util: format line number of stack trace using %d
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Required on Python 3, functional on Python 2. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2211 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -3159,7 +3159,7 @@ results.append(hook(*args)) return results -def getstackframes(skip=0, line=' %-*s in %s\n', fileline='%s:%s', depth=0): +def getstackframes(skip=0, line=' %-*s in %s\n', fileline='%s:%d', depth=0): '''Yields lines for a nicely formatted stacktrace. Skips the 'skip' last entries, then return the last 'depth' entries. Each file+linenumber is formatted according to fileline. 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
D2210: util: call warnings.warn() with a sysstr in nouideprecwarn
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This preserves nouideprecwarn wanting a bytes, which is consistent with the rest of hg. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2210 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -253,7 +253,7 @@ if _dowarn: msg += ("\n(compatibility will be dropped after Mercurial-%s," " update your code.)") % version -warnings.warn(msg, DeprecationWarning, stacklevel + 1) +warnings.warn(pycompat.sysstr(msg), DeprecationWarning, stacklevel + 1) DIGESTS = { 'md5': hashlib.md5, 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
D2209: ui: convert stack traces to sysbytes before logging
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY They're coming back as unicodes, so sysbytes seems like the best we can do. This is like https://phab.mercurial-scm.org/D2171 and https://phab.mercurial-scm.org/D2172, but those fail on Python 2.7.5 (seriously!), so this is my version of the same change. I actually wrote this before reviewing those, then discarded it, then came back to it after finding out 2.7.5 is a silly place. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2209 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1620,10 +1620,12 @@ else: curframe = inspect.currentframe() calframe = inspect.getouterframes(curframe, 2) -self.write_err('%s at: %s:%s (%s)\n' - % ((msg,) + calframe[stacklevel][1:4])) -self.log('develwarn', '%s at: %s:%s (%s)\n', - msg, *calframe[stacklevel][1:4]) +fname, lineno, fmsg = calframe[stacklevel][1:4] +fname, fmsg = pycompat.sysbytes(fname), pycompat.sysbytes(fmsg) +self.write_err('%s at: %s:%d (%s)\n' + % (msg, fname, lineno, fmsg)) +self.log('develwarn', '%s at: %s:%d (%s)\n', + msg, fname, lineno, fmsg) curframe = calframe = None # avoid cycles def deprecwarn(self, msg, version, stacklevel=2): 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
D2212: util: convert traceback-related sysstrs to sysbytes in getstackframes
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY With this change, test-devel-warnings.t passes except for differences in how ProgrammingError is formatted and one mysterious traceback inside of transaction.__del__. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2212 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -3171,7 +3171,7 @@ Not be used in production code but very convenient while developing. ''' -entries = [(fileline % (fn, ln), func) +entries = [(fileline % (pycompat.sysbytes(fn), ln), pycompat.sysbytes(func)) for fn, ln, func, _text in traceback.extract_stack()[:-skip - 1] ][-depth:] if entries: 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
D2213: py3: whitelist another 11 passing tests
durin42 created this revision. Herald added a reviewer: pulkit. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2213 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -8,10 +8,12 @@ test-backwards-remove.t test-bheads.t test-bisect2.t +test-bookmarks-current.t test-bookmarks-merge.t test-bookmarks-strip.t test-branch-option.t test-branch-tag-confict.t +test-bundle-phases.t test-bundle-vs-outgoing.t test-casecollision.t test-cat.t @@ -85,6 +87,7 @@ test-glog-topological.t test-gpg.t test-hghave.t +test-http-clone-r.t test-imports-checker.t test-inherit-mode.t test-issue1089.t @@ -102,13 +105,16 @@ test-issue672.t test-issue842.t test-journal-exists.t +test-largefiles-small-disk.t test-locate.t test-logexchange.t test-lrucachedict.py +test-mactext.t test-manifest-merging.t test-manifest.py test-manifest.t test-match.py +test-merge-closedheads.t test-merge-commit.t test-merge-default.t test-merge-internal-tools-pattern.t @@ -125,8 +131,11 @@ test-merge7.t test-merge8.t test-mq-qimport-fail-cleanup.t +test-mq-qqueue.t test-mq-qsave.t +test-newbranch.t test-obshistory.t +test-obsmarkers-effectflag.t test-obsolete-changeset-exchange.t test-obsolete-checkheads.t test-obsolete-distributed.t @@ -187,14 +196,16 @@ test-sparse-merges.t test-sparse-requirement.t test-sparse-verbose-json.t +test-ssh-clone-r.t test-status-terse.t test-strip-cross.t test-strip.t test-unamend.t test-uncommit.t test-unified-test.t test-unrelated-pull.t test-up-local-change.t +test-update-branches.t test-update-dest.t test-update-issue1456.t test-update-names.t To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2208: ui: use pycompat.bytestr() to get a bytes-repr of config default
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We don't know what type we'll get here, so we need something that'll behave like a repr without returning a unicode. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2208 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -498,7 +498,7 @@ and default != itemdefault): msg = ("specifying a mismatched default value for a registered " "config item: '%s.%s' '%s'") -msg %= (section, name, default) +msg %= (section, name, pycompat.bytestr(default)) self.develwarn(msg, 2, 'warn-config-default') for s, n in alternates: 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
D2207: tests: add tons of b prefixes in test-devel-warnings.t
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because it's just b prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2207 AFFECTED FILES tests/test-devel-warnings.t CHANGE DETAILS diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t --- a/tests/test-devel-warnings.t +++ b/tests/test-devel-warnings.t @@ -17,17 +17,17 @@ > > @command(b'buggytransaction', [], '') > def buggylocking(ui, repo): - > tr = repo.transaction('buggy') + > tr = repo.transaction(b'buggy') > # make sure we rollback the transaction as we don't want to rely on the__del__ > tr.release() > > @command(b'properlocking', [], '') > def properlocking(ui, repo): > """check that reentrance is fine""" > wl = repo.wlock() > lo = repo.lock() - > tr = repo.transaction('proper') - > tr2 = repo.transaction('proper') + > tr = repo.transaction(b'proper') + > tr2 = repo.transaction(b'proper') > lo2 = repo.lock() > wl2 = repo.wlock() > wl2.release() @@ -46,34 +46,34 @@ > > @command(b'no-wlock-write', [], '') > def nowlockwrite(ui, repo): - > with repo.vfs(b'branch', 'a'): + > with repo.vfs(b'branch', b'a'): > pass > > @command(b'no-lock-write', [], '') > def nolockwrite(ui, repo): - > with repo.svfs(b'fncache', 'a'): + > with repo.svfs(b'fncache', b'a'): > pass > > @command(b'stripintr', [], '') > def stripintr(ui, repo): > lo = repo.lock() - > tr = repo.transaction('foobar') + > tr = repo.transaction(b'foobar') > try: - > repair.strip(repo.ui, repo, [repo['.'].node()]) + > repair.strip(repo.ui, repo, [repo[b'.'].node()]) > finally: > lo.release() > @command(b'oldanddeprecated', [], '') > def oldanddeprecated(ui, repo): > """test deprecation warning API""" > def foobar(ui): - > ui.deprecwarn('foorbar is deprecated, go shopping', '42.1337') + > ui.deprecwarn(b'foorbar is deprecated, go shopping', b'42.1337') > foobar(ui) > @command(b'nouiwarning', [], '') > def nouiwarning(ui, repo): - > util.nouideprecwarn('this is a test', '13.37') + > util.nouideprecwarn(b'this is a test', b'13.37') > @command(b'programmingerror', [], '') > def programmingerror(ui, repo): - > raise error.ProgrammingError('something went wrong', hint='try again') + > raise error.ProgrammingError(b'something went wrong', hint=b'try again') > EOF $ cat << EOF >> $HGRCPATH @@ -331,7 +331,7 @@ $ hg nouiwarning $TESTTMP/buggylocking.py:*: DeprecationWarning: this is a test (glob) (compatibility will be dropped after Mercurial-13.37, update your code.) -util.nouideprecwarn('this is a test', '13.37') +util.nouideprecwarn(b'this is a test', b'13.37') (disabled outside of test run) @@ -350,25 +350,25 @@ > configtable = {} > configitem = registrar.configitem(configtable) > - > configitem('test', 'some', default='foo') - > configitem('test', 'dynamic', default=configitems.dynamicdefault) - > configitem('test', 'callable', default=list) + > configitem(b'test', b'some', default=b'foo') + > configitem(b'test', b'dynamic', default=configitems.dynamicdefault) + > configitem(b'test', b'callable', default=list) > # overwrite a core config - > configitem('ui', 'quiet', default=False) - > configitem('ui', 'interactive', default=None) + > configitem(b'ui', b'quiet', default=False) + > configitem(b'ui', b'interactive', default=None) > > @command(b'buggyconfig') > def cmdbuggyconfig(ui, repo): - > repo.ui.config('ui', 'quiet', True) - > repo.ui.config('ui', 'interactive', False) - > repo.ui.config('test', 'some', 'bar') - > repo.ui.config('test', 'some', 'foo') - > repo.ui.config('test', 'dynamic', 'some-required-default') - > repo.ui.config('test', 'dynamic') - > repo.ui.config('test', 'callable', []) - > repo.ui.config('test', 'callable', 'foo') - > repo.ui.config('test', 'unregistered') - > repo.ui.config('unregistered', 'unregistered') + > repo.ui.config(b'ui', b'quiet', True) + > repo.ui.config(b'ui', b'interactive', False) + > repo.ui.config(b'test', b'some', b'bar') + > repo.ui.config(b'test', b'some', b'foo') + > repo.ui.config(b'test', b'dynamic', b'some-required-default') + > repo.ui.config(b'test', b'dynamic') + > repo.ui.config(b'test', b'callable', []) + > repo.ui.config(b'test', b'callable', b'foo') + > repo.ui.config(b'test', b'unregistered') + > repo.ui.config(b'unregistered', b'unregistered') > EOF $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig To: durin42, #hg-reviewers Cc: mercurial-devel ___
[PATCH] minifileset: allow 'path:' patterns to have an explicit trailing slash
# HG changeset patch # User Matt Harbison # Date 1518488713 18000 # Mon Feb 12 21:25:13 2018 -0500 # Node ID e99e6917138593d2dddf7e0f5506dbd3f6c87743 # Parent 9b5df6e19a4f308e14703a8136cd0530c1e1d1a9 minifileset: allow 'path:' patterns to have an explicit trailing slash We allow for it on the command line, with `hg status`, for example. I thought that I copied this "n.startswith(p) and (len(n) == pl or n[pl] == '/')" pattern from somewhere, but I don't see it now. diff --git a/mercurial/minifileset.py b/mercurial/minifileset.py --- a/mercurial/minifileset.py +++ b/mercurial/minifileset.py @@ -26,7 +26,7 @@ raise error.ParseError(_('reserved character: %s') % c) return lambda n, s: n.endswith(ext) elif name.startswith('path:'): # directory or full path test -p = name[5:] # prefix +p = name[5:] if name[-1] != '/' else name[5:-1] # prefix pl = len(p) f = lambda n, s: n.startswith(p) and (len(n) == pl or n[pl] == '/') return f diff --git a/tests/test-minifileset.py b/tests/test-minifileset.py --- a/tests/test-minifileset.py +++ b/tests/test-minifileset.py @@ -25,6 +25,8 @@ check('"path:a" & (**.b | **.c)', [('a/b.b', 0), ('a/c.c', 0)], [('b/c.c', 0)]) check('(path:a & **.b) | **.c', [('a/b.b', 0), ('a/c.c', 0), ('b/c.c', 0)], []) +check('path:a/', [('a/b.b', 0), ('a/c.c', 0)], [('ab/c.c', 0)]) +check('path:a', [('a/b.b', 0), ('a/c.c', 0)], [('ab/c.c', 0)]) check('**.bin - size("<20B")', [('b.bin', 21)], [('a.bin', 11), ('b.txt', 21)]) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D2169: py3: explicitly cast bool to bytes
This appears to break histedit tests for me somehow, which is curious because I swear they passed once. I'll drop it for now and try to come back to it. > On Feb 12, 2018, at 21:48, indygreg (Gregory Szorc) > wrote: > > This revision was automatically updated to reflect the committed changes. > Closed by commit rHGd78a51982262: py3: explicitly cast bool to bytes > (authored by indygreg, committed by ). > > REPOSITORY > rHG Mercurial > > CHANGES SINCE LAST UPDATE > https://phab.mercurial-scm.org/D2169?vs=5470&id=5592 > > REVISION DETAIL > https://phab.mercurial-scm.org/D2169 > > AFFECTED FILES > hgext/histedit.py > > CHANGE DETAILS > > diff --git a/hgext/histedit.py b/hgext/histedit.py > --- a/hgext/histedit.py > +++ b/hgext/histedit.py > @@ -344,7 +344,7 @@ > fp.write('v1\n') > fp.write('%s\n' % node.hex(self.parentctxnode)) > fp.write('%s\n' % node.hex(self.topmost)) > -fp.write('%s\n' % self.keep) > +fp.write('%s\n' % 'True' if self.keep else 'False') > fp.write('%d\n' % len(self.actions)) > for action in self.actions: > fp.write('%s\n' % action.tostate()) > > > > To: indygreg, durin42, #hg-reviewers, pulkit > Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D2171: ui: use named attributes on FrameInfo instance
This one I'm going to have to discard, along with D2172. I'll mail my version instead. Sigh. > On Feb 12, 2018, at 21:48, indygreg (Gregory Szorc) > wrote: > > This revision was automatically updated to reflect the committed changes. > Closed by commit rHGffcc3b977e43: ui: use named attributes on FrameInfo > instance (authored by indygreg, committed by ). > > REPOSITORY > rHG Mercurial > > CHANGES SINCE LAST UPDATE > https://phab.mercurial-scm.org/D2171?vs=5472&id=5594 > > REVISION DETAIL > https://phab.mercurial-scm.org/D2171 > > AFFECTED FILES > mercurial/ui.py > > CHANGE DETAILS > > diff --git a/mercurial/ui.py b/mercurial/ui.py > --- a/mercurial/ui.py > +++ b/mercurial/ui.py > @@ -1620,11 +1620,15 @@ > else: > curframe = inspect.currentframe() > calframe = inspect.getouterframes(curframe, 2) > -self.write_err('%s at: %s:%s (%s)\n' > - % ((msg,) + calframe[stacklevel][1:4])) > +frameinfo = calframe[stacklevel] > + > +self.write_err('%s at: %s:%s (%s)\n' % ( > +msg, frameinfo.filename, frameinfo.lineno, > +frameinfo.function)) > self.log('develwarn', '%s at: %s:%s (%s)\n', > - msg, *calframe[stacklevel][1:4]) > -curframe = calframe = None # avoid cycles > + msg, frameinfo.filename, frameinfo.lineno, > + frameinfo.function) > +curframe = calframe = frameinfo = None # avoid cycles > > def deprecwarn(self, msg, version, stacklevel=2): > """issue a deprecation warning > > > > To: indygreg, #hg-reviewers, pulkit, durin42 > Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2176: py3: convert traceback representation to bytes when logging
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9446246e4d1a: py3: convert traceback representation to bytes when logging (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2176?vs=5477&id=5598 REVISION DETAIL https://phab.mercurial-scm.org/D2176 AFFECTED FILES mercurial/dispatch.py CHANGE DETAILS diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -992,6 +992,7 @@ this function returns False, ignored otherwise. """ warning = _exceptionwarning(ui) -ui.log("commandexception", "%s\n%s\n", warning, traceback.format_exc()) +ui.log("commandexception", "%s\n%s\n", warning, + pycompat.sysbytes(traceback.format_exc())) ui.warn(warning) return False # re-raise the exception To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2172: py3: convert FrameInfo members to bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG20dbe0eee139: py3: convert FrameInfo members to bytes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2172?vs=5473&id=5595 REVISION DETAIL https://phab.mercurial-scm.org/D2172 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1622,12 +1622,12 @@ calframe = inspect.getouterframes(curframe, 2) frameinfo = calframe[stacklevel] -self.write_err('%s at: %s:%s (%s)\n' % ( -msg, frameinfo.filename, frameinfo.lineno, -frameinfo.function)) -self.log('develwarn', '%s at: %s:%s (%s)\n', - msg, frameinfo.filename, frameinfo.lineno, - frameinfo.function) +self.write_err('%s at: %s:%d (%s)\n' % ( +msg, pycompat.sysbytes(frameinfo.filename), +frameinfo.lineno, pycompat.sysbytes(frameinfo.function))) +self.log('develwarn', '%s at: %s:%d (%s)\n', + msg, pycompat.sysbytes(frameinfo.filename), + frameinfo.lineno, pycompat.sysbytes(frameinfo.function)) curframe = calframe = frameinfo = None # avoid cycles def deprecwarn(self, msg, version, stacklevel=2): To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2173: py3: add missing b'' literal to sshprotoext.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2e1d3924fa5b: py3: add missing b'' literal to sshprotoext.py (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2173?vs=5474&id=5596 REVISION DETAIL https://phab.mercurial-scm.org/D2173 AFFECTED FILES tests/sshprotoext.py CHANGE DETAILS diff --git a/tests/sshprotoext.py b/tests/sshprotoext.py --- a/tests/sshprotoext.py +++ b/tests/sshprotoext.py @@ -68,7 +68,7 @@ l = self._fin.readline() assert l == b'between\n' l = self._fin.readline() -assert l == 'pairs 81\n' +assert l == b'pairs 81\n' self._fin.read(81) # Send the upgrade response. To: indygreg, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2157: py3: use string for "close" value in commit extras
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb44a47214122: py3: use string for "close" value in commit extras (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2157?vs=5458&id=5583 REVISION DETAIL https://phab.mercurial-scm.org/D2157 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1551,7 +1551,7 @@ extra = {} if opts.get('close_branch'): -extra['close'] = 1 +extra['close'] = '1' if not bheads: raise error.Abort(_('can only close branch heads')) To: indygreg, #hg-reviewers, pulkit, durin42 Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2174: py3: convert context to bytes instead of str
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdd905ea1ea60: py3: convert context to bytes instead of str (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2174?vs=5475&id=5597 REVISION DETAIL https://phab.mercurial-scm.org/D2174 AFFECTED FILES mercurial/debugcommands.py CHANGE DETAILS diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2356,7 +2356,7 @@ """ # passed to successorssets caching computation from one call to another cache = {} -ctx2str = str +ctx2str = bytes node2str = short for rev in scmutil.revrange(repo, revs): ctx = repo[rev] To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2170: py3: make dummyssh compatible with Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9996ec844c1e: py3: make dummyssh compatible with Python 3 (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2170?vs=5471&id=5593 REVISION DETAIL https://phab.mercurial-scm.org/D2170 AFFECTED FILES tests/dummyssh CHANGE DETAILS diff --git a/tests/dummyssh b/tests/dummyssh --- a/tests/dummyssh +++ b/tests/dummyssh @@ -15,8 +15,8 @@ log = open("dummylog", "ab") log.write(b"Got arguments") for i, arg in enumerate(sys.argv[1:]): -log.write(b" %d:%s" % (i + 1, arg)) -log.write("\n") +log.write(b" %d:%s" % (i + 1, arg.encode('latin1'))) +log.write(b"\n") log.close() hgcmd = sys.argv[2] if os.name == 'nt': To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2169: py3: explicitly cast bool to bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd78a51982262: py3: explicitly cast bool to bytes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2169?vs=5470&id=5592 REVISION DETAIL https://phab.mercurial-scm.org/D2169 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -344,7 +344,7 @@ fp.write('v1\n') fp.write('%s\n' % node.hex(self.parentctxnode)) fp.write('%s\n' % node.hex(self.topmost)) -fp.write('%s\n' % self.keep) +fp.write('%s\n' % 'True' if self.keep else 'False') fp.write('%d\n' % len(self.actions)) for action in self.actions: fp.write('%s\n' % action.tostate()) To: indygreg, durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2171: ui: use named attributes on FrameInfo instance
This revision was automatically updated to reflect the committed changes. Closed by commit rHGffcc3b977e43: ui: use named attributes on FrameInfo instance (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2171?vs=5472&id=5594 REVISION DETAIL https://phab.mercurial-scm.org/D2171 AFFECTED FILES mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1620,11 +1620,15 @@ else: curframe = inspect.currentframe() calframe = inspect.getouterframes(curframe, 2) -self.write_err('%s at: %s:%s (%s)\n' - % ((msg,) + calframe[stacklevel][1:4])) +frameinfo = calframe[stacklevel] + +self.write_err('%s at: %s:%s (%s)\n' % ( +msg, frameinfo.filename, frameinfo.lineno, +frameinfo.function)) self.log('develwarn', '%s at: %s:%s (%s)\n', - msg, *calframe[stacklevel][1:4]) -curframe = calframe = None # avoid cycles + msg, frameinfo.filename, frameinfo.lineno, + frameinfo.function) +curframe = calframe = frameinfo = None # avoid cycles def deprecwarn(self, msg, version, stacklevel=2): """issue a deprecation warning To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2167: py3: cast character set to bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6ea7f1c10c81: py3: cast character set to bytes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2167?vs=5468&id=5590 REVISION DETAIL https://phab.mercurial-scm.org/D2167 AFFECTED FILES mercurial/mail.py CHANGE DETAILS diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -187,7 +187,7 @@ def codec2iana(cs): '' -cs = email.charset.Charset(cs).input_charset.lower() +cs = pycompat.sysbytes(email.charset.Charset(cs).input_charset.lower()) # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1" if cs.startswith("iso") and not cs.startswith("iso-"): To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2168: mail: import email.utils not email.Utils
This revision was automatically updated to reflect the committed changes. Closed by commit rHG54dfb65e2f82: mail: import email.utils not email.Utils (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2168?vs=5469&id=5591 REVISION DETAIL https://phab.mercurial-scm.org/D2168 AFFECTED FILES mercurial/mail.py CHANGE DETAILS diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -288,13 +288,13 @@ addr = addr.encode('ascii') except UnicodeDecodeError: raise error.Abort(_('invalid local address: %s') % addr) -return email.Utils.formataddr((name, addr)) +return email.utils.formataddr((name, addr)) def addressencode(ui, address, charsets=None, display=False): '''Turns address into RFC-2047 compliant header.''' if display or not address: return address or '' -name, addr = email.Utils.parseaddr(address) +name, addr = email.utils.parseaddr(address) return _addressencode(ui, name, addr, charsets) def addrlistencode(ui, addrs, charsets=None, display=False): @@ -305,7 +305,7 @@ return [a.strip() for a in addrs if a.strip()] result = [] -for name, addr in email.Utils.getaddresses(addrs): +for name, addr in email.utils.getaddresses(addrs): if name or addr: result.append(_addressencode(ui, name, addr, charsets)) return result To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2163: py3: use raw string for key in **kwargs
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb587a889b97e: py3: use raw string for key in **kwargs (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2163?vs=5464&id=5587 REVISION DETAIL https://phab.mercurial-scm.org/D2163 AFFECTED FILES mercurial/bundle2.py CHANGE DETAILS diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1729,7 +1729,7 @@ extrakwargs = {} targetphase = inpart.params.get('targetphase') if targetphase is not None: -extrakwargs['targetphase'] = int(targetphase) +extrakwargs[r'targetphase'] = int(targetphase) ret = _processchangegroup(op, cg, tr, 'bundle2', 'bundle2', expectedtotal=nbchangesets, **extrakwargs) if op.reply is not None: To: indygreg, #hg-reviewers, pulkit, durin42 Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2166: py3: cast decode() argument to system string
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9e47bfbeb723: py3: cast decode() argument to system string (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2166?vs=5467&id=5589 REVISION DETAIL https://phab.mercurial-scm.org/D2166 AFFECTED FILES mercurial/mail.py CHANGE DETAILS diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -206,7 +206,7 @@ return mimetextqp(s, subtype, 'us-ascii') for charset in cs: try: -s.decode(charset) +s.decode(pycompat.sysstr(charset)) return mimetextqp(s, subtype, codec2iana(charset)) except UnicodeDecodeError: pass To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2161: py3: use b'' for changegroup version literals
This revision was automatically updated to reflect the committed changes. Closed by commit rHG83246d6920f2: py3: use b'' for changegroup version literals (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2161?vs=5462&id=5585 REVISION DETAIL https://phab.mercurial-scm.org/D2161 AFFECTED FILES tests/flagprocessorext.py CHANGE DETAILS diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py --- a/tests/flagprocessorext.py +++ b/tests/flagprocessorext.py @@ -45,14 +45,14 @@ def supportedoutgoingversions(orig, repo): versions = orig(repo) -versions.discard('01') -versions.discard('02') -versions.add('03') +versions.discard(b'01') +versions.discard(b'02') +versions.add(b'03') return versions def allsupportedversions(orig, ui): versions = orig(ui) -versions.add('03') +versions.add(b'03') return versions def noopaddrevision(orig, self, text, transaction, link, p1, p2, @@ -106,7 +106,7 @@ # Teach exchange to use changegroup 3 for k in exchange._bundlespeccgversions.keys(): -exchange._bundlespeccgversions[k] = '03' +exchange._bundlespeccgversions[k] = b'03' # Add wrappers for addrevision, responsible to set flags depending on the # revision data contents. To: indygreg, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2160: py3: use b'' in inline extension
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa42817fede27: py3: use b'' in inline extension (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2160?vs=5461&id=5584 REVISION DETAIL https://phab.mercurial-scm.org/D2160 AFFECTED FILES tests/test-largefiles-small-disk.t CHANGE DETAILS diff --git a/tests/test-largefiles-small-disk.t b/tests/test-largefiles-small-disk.t --- a/tests/test-largefiles-small-disk.t +++ b/tests/test-largefiles-small-disk.t @@ -11,7 +11,7 @@ > _origcopyfileobj = shutil.copyfileobj > def copyfileobj(fsrc, fdst, length=16*1024): > # allow journal files (used by transaction) to be written - > if 'journal.' in fdst.name: + > if b'journal.' in fdst.name: > return _origcopyfileobj(fsrc, fdst, length) > fdst.write(fsrc.read(4)) > raise IOError(errno.ENOSPC, os.strerror(errno.ENOSPC)) To: indygreg, #hg-reviewers, pulkit Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2156: py3: catch TypeError during template operations
This revision was automatically updated to reflect the committed changes. Closed by commit rHG230489fc0b41: py3: catch TypeError during template operations (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2156?vs=5457&id=5580 REVISION DETAIL https://phab.mercurial-scm.org/D2156 AFFECTED FILES mercurial/templatekw.py CHANGE DETAILS diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -192,11 +192,15 @@ def one(v, tag=name): try: vmapping.update(v) -except (AttributeError, ValueError): +# Python 2 raises ValueError if the type of v is wrong. Python +# 3 raises TypeError. +except (AttributeError, TypeError, ValueError): try: +# Python 2 raises ValueError trying to destructure an e.g. +# bytes. Python 3 raises TypeError. for a, b in v: vmapping[a] = b -except ValueError: +except (TypeError, ValueError): vmapping[name] = v return templ(tag, **pycompat.strkwargs(vmapping)) lastname = 'last_' + name To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2154: py3: use system strings when calling __import__
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc4146cf4dd20: py3: use system strings when calling __import__ (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2154?vs=5455&id=5579 REVISION DETAIL https://phab.mercurial-scm.org/D2154 AFFECTED FILES mercurial/hook.py CHANGE DETAILS diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -49,12 +49,12 @@ modname = modfile with demandimport.deactivated(): try: -obj = __import__(modname) +obj = __import__(pycompat.sysstr(modname)) except (ImportError, SyntaxError): e1 = sys.exc_info() try: # extensions are loaded with hgext_ prefix -obj = __import__("hgext_%s" % modname) +obj = __import__(r"hgext_%s" % pycompat.sysstr(modname)) except (ImportError, SyntaxError): e2 = sys.exc_info() if ui.tracebackflag: To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2155: py3: use bytes literals for test extension
This revision was automatically updated to reflect the committed changes. Closed by commit rHG361276a36d49: py3: use bytes literals for test extension (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2155?vs=5456&id=5581 REVISION DETAIL https://phab.mercurial-scm.org/D2155 AFFECTED FILES tests/test-hook.t CHANGE DETAILS diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -417,9 +417,9 @@ > def printargs(ui, args): > a = list(args.items()) > a.sort() - > ui.write('hook args:\n') + > ui.write(b'hook args:\n') > for k, v in a: - >ui.write(' %s %s\n' % (k, v)) + >ui.write(b' %s %s\n' % (k, v)) > > def passhook(ui, repo, **args): > printargs(ui, args) @@ -432,19 +432,19 @@ > pass > > def raisehook(**args): - > raise LocalException('exception from hook') + > raise LocalException(b'exception from hook') > > def aborthook(**args): - > raise error.Abort('raise abort from hook') + > raise error.Abort(b'raise abort from hook') > > def brokenhook(**args): > return 1 + {} > > def verbosehook(ui, **args): - > ui.note('verbose output from hook\n') + > ui.note(b'verbose output from hook\n') > > def printtags(ui, repo, **args): - > ui.write('%s\n' % sorted(repo.tags())) + > ui.write(b'%s\n' % sorted(repo.tags())) > > class container: > unreachable = 1 @@ -667,7 +667,7 @@ $ cd hooks $ cat > testhooks.py < def testhook(ui, **args): - > ui.write('hook works\n') + > ui.write(b'hook works\n') > EOF $ echo '[hooks]' > ../repo/.hg/hgrc $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc @@ -886,7 +886,7 @@ > def uisetup(ui): > class untrustedui(ui.__class__): > def _trusted(self, fp, f): - > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'): + > if util.normpath(fp.name).endswith(b'untrusted/.hg/hgrc'): > return False > return super(untrustedui, self)._trusted(fp, f) > ui.__class__ = untrustedui To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2153: py3: open patches.queue in binary mode
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbff95b002e33: py3: open patches.queue in binary mode (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2153?vs=5454&id=5578 REVISION DETAIL https://phab.mercurial-scm.org/D2153 AFFECTED FILES hgext/mq.py CHANGE DETAILS diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -445,9 +445,9 @@ def __init__(self, ui, baseui, path, patchdir=None): self.basepath = path try: -fh = open(os.path.join(path, 'patches.queue')) -cur = fh.read().rstrip() -fh.close() +with open(os.path.join(path, 'patches.queue'), r'rb') as fh: +cur = fh.read().rstrip() + if not cur: curpath = os.path.join(path, 'patches') else: To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2162: py3: preserve chunks as an iterable of bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc1104fe76e69: py3: preserve chunks as an iterable of bytes (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2162?vs=5463&id=5586 REVISION DETAIL https://phab.mercurial-scm.org/D2162 AFFECTED FILES mercurial/logcmdutil.py CHANGE DETAILS diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -81,7 +81,7 @@ if fp is not None or ui.canwritewithoutlabels(): out = fp or ui if stat: -chunks = patch.diffstat(util.iterlines(chunks), width=width) +chunks = [patch.diffstat(util.iterlines(chunks), width=width)] for chunk in util.filechunkiter(util.chunkbuffer(chunks)): out.write(chunk) else: To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2164: py3: avoid changing dictionary during iteration
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc02771617a70: py3: avoid changing dictionary during iteration (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2164?vs=5465&id=5588 REVISION DETAIL https://phab.mercurial-scm.org/D2164 AFFECTED FILES mercurial/copies.py CHANGE DETAILS diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -123,7 +123,7 @@ t[k] = v # remove criss-crossed copies -for k, v in t.items(): +for k, v in list(t.items()): if k in src and v in dst: del t[k] To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2152: py3: compare against bytes instead of str
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc33a99506e13: py3: compare against bytes instead of str (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2152?vs=5453&id=5577 REVISION DETAIL https://phab.mercurial-scm.org/D2152 AFFECTED FILES hgext/mq.py CHANGE DETAILS diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -650,7 +650,7 @@ self.seriesdirty = True def pushable(self, idx): -if isinstance(idx, str): +if isinstance(idx, bytes): idx = self.series.index(idx) patchguards = self.seriesguards[idx] if not patchguards: To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2159: py3: use hex(hasher.digest())
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6426878f7f0f: py3: use hex(hasher.digest()) (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2159?vs=5460&id=5582 REVISION DETAIL https://phab.mercurial-scm.org/D2159 AFFECTED FILES hgext/largefiles/lfutil.py CHANGE DETAILS diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -15,6 +15,7 @@ import stat from mercurial.i18n import _ +from mercurial.node import hex from mercurial import ( dirstate, @@ -371,7 +372,7 @@ for data in instream: hasher.update(data) outfile.write(data) -return hasher.hexdigest() +return hex(hasher.digest()) def hashfile(file): if not os.path.exists(file): @@ -404,7 +405,7 @@ h = hashlib.sha1() for chunk in util.filechunkiter(fileobj): h.update(chunk) -return h.hexdigest() +return hex(h.digest()) def httpsendfile(ui, filename): return httpconnection.httpsendfile(ui, filename, 'rb') To: indygreg, #hg-reviewers, pulkit, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2175: py3: use b'' in mockblackbox.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf49c3ee5b02f: py3: use b'' in mockblackbox.py (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2175?vs=5476&id=5576 REVISION DETAIL https://phab.mercurial-scm.org/D2175 AFFECTED FILES tests/mockblackbox.py CHANGE DETAILS diff --git a/tests/mockblackbox.py b/tests/mockblackbox.py --- a/tests/mockblackbox.py +++ b/tests/mockblackbox.py @@ -5,7 +5,7 @@ # XXX: we should probably offer a devel option to do this in blackbox directly def getuser(): -return 'bob' +return b'bob' def getpid(): return 5000 To: indygreg, #hg-reviewers, pulkit, durin42 Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2205: sshpeer: log remote capabilities after protocol upgrade
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This helps reduce variance with version 1 and will help prevent test output divergence as we start testing protocol version 2 more widely. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2205 AFFECTED FILES mercurial/sshpeer.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -484,6 +484,7 @@ devel-peer-request: pairs: 81 bytes sending between command protocol upgraded to exp-ssh-v2-0001 + remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN url: ssh://user@dummy/server local: no pushable: yes @@ -500,6 +501,7 @@ devel-peer-request: pairs: 81 bytes sending between command protocol upgraded to exp-ssh-v2-0001 + remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN Main capabilities: batch branchmap diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -313,6 +313,8 @@ if not capsline.startswith('capabilities: '): badresponse() +ui.debug('remote: %s\n' % capsline) + caps.update(capsline.split(':')[1].split()) # Trailing newline. stdout.read(1) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2206: tests: test using both versions of SSH protocol
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Now that the version 2 of the SSH protocol is usable in core, we can start actively testing it more widely outside of low-level protocol tests. We add #testcases variants to a handful of tests so we exercise both version 1 and version 2 of the SSH protocol when testing. This will allow us to more easily find regressions and variances as protocol 2 is developed. It will also make it easier to continue testing with protocol version 1 once version 2 is enabled by default. There are a handful of tests using ssh:// that should also gain test variances. One - test-push-race.t - already has a #testcases. This would require combinatorial cases. I didn't want to go down that rabbit hole, so that test is unchanged. Thinking aloud, there is probably an opportunity to automatically run tests with multiple server/protocol implementations. Ideally any test that performed server interaction would run with all supported server implementations and protocols so we could find variances between servers and protocols. But this has been a long-standing issue with our test harness. I don't think it is an easily solved problem. But it would be nice... REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2206 AFFECTED FILES tests/test-bundle2-exchange.t tests/test-bundle2-pushback.t tests/test-bundle2-remote-changegroup.t tests/test-clone.t tests/test-largefiles-wireproto.t tests/test-pull.t tests/test-ssh-bundle1.t tests/test-ssh-clone-r.t tests/test-ssh.t CHANGE DETAILS diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -1,3 +1,12 @@ +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif This test tries to exercise the ssh functionality with a dummy script @@ -481,14 +490,16 @@ $ hg pull --debug ssh://user@dummy/remote --config devel.debug.peer-request=yes pulling from ssh://user@dummy/remote running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re) + sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !) devel-peer-request: hello sending hello command devel-peer-request: between devel-peer-request: pairs: 81 bytes sending between command - remote: 384 + remote: 384 (sshv1 !) + protocol upgraded to exp-ssh-v2-0001 (sshv2 !) remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN - remote: 1 + remote: 1 (sshv1 !) query 1; heads devel-peer-request: batch devel-peer-request: cmds: 141 bytes diff --git a/tests/test-ssh-clone-r.t b/tests/test-ssh-clone-r.t --- a/tests/test-ssh-clone-r.t +++ b/tests/test-ssh-clone-r.t @@ -1,5 +1,15 @@ This test tries to exercise the ssh functionality with a dummy script +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + creating 'remote' repo $ hg init remote diff --git a/tests/test-ssh-bundle1.t b/tests/test-ssh-bundle1.t --- a/tests/test-ssh-bundle1.t +++ b/tests/test-ssh-bundle1.t @@ -1,6 +1,16 @@ This test is a duplicate of 'test-http.t' feel free to factor out parts that are not bundle1/bundle2 specific. +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + $ cat << EOF >> $HGRCPATH > [devel] > # This test is dedicated to interaction through old bundle @@ -465,11 +475,13 @@ $ hg pull --debug ssh://user@dummy/remote pulling from ssh://user@dummy/remote running .* ".*/dummyssh" ['"]user@dummy['"] ('|")hg -R remote serve --stdio('|") (re) + sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !) sending hello command sending between command - remote: 384 + protocol upgraded to exp-ssh-v2-0001 (sshv2 !) + remote: 384 (sshv1 !) remote: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN - remote: 1 + remote: 1 (sshv1 !) preparing listkeys for "bookmarks" sending listkeys command received listkey for "bookmarks": 45 bytes diff --git a/tests/test-pull.t b/tests/test-pull.t --- a/tests/test-pull.t +++ b/tests/test-pull.t @@ -1,5 +1,15 @@ #require serve +#testcases sshv1 sshv2 + +#if sshv2 + $ cat >> $HGRCPATH << EOF + > [experimental] + > sshpeer.advertise-v2 = true + > sshserver.support-v2 = true + > EOF +#endif + $ hg init test $ cd test diff --git a/tests/te
D2203: wireprotoserver: move SSH server operation to a standalone function
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The server-side processing logic will soon get a bit more complicated in order to handle protocol switches. We will use a state machine to help make the transitions clearer. To prepare for this, we move SSH server operation into a standalone function. We structure it as a very simple state machine. It only has two states for now, with one state containing the bulk of the logic. But things will evolve shortly. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2203 AFFECTED FILES mercurial/wireprotoserver.py tests/sshprotoext.py tests/test-sshserver.py CHANGE DETAILS diff --git a/tests/test-sshserver.py b/tests/test-sshserver.py --- a/tests/test-sshserver.py +++ b/tests/test-sshserver.py @@ -23,8 +23,11 @@ def assertparse(self, cmd, input, expected): server = mockserver(input) +proto = wireprotoserver.sshv1protocolhandler(server._ui, + server._fin, + server._fout) _func, spec = wireproto.commands[cmd] -self.assertEqual(server._proto.getargs(spec), expected) +self.assertEqual(proto.getargs(spec), expected) def mockserver(inbytes): ui = mockui(inbytes) diff --git a/tests/sshprotoext.py b/tests/sshprotoext.py --- a/tests/sshprotoext.py +++ b/tests/sshprotoext.py @@ -48,7 +48,9 @@ wireprotoserver._sshv1respondbytes(self._fout, b'') l = self._fin.readline() assert l == b'between\n' -rsp = wireproto.dispatch(self._repo, self._proto, b'between') +proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, + self._fout) +rsp = wireproto.dispatch(self._repo, proto, b'between') wireprotoserver._sshv1respondbytes(self._fout, rsp.data) super(prehelloserver, self).serve_forever() @@ -72,8 +74,10 @@ self._fin.read(81) # Send the upgrade response. +proto = wireprotoserver.sshv1protocolhandler(self._ui, self._fin, + self._fout) self._fout.write(b'upgraded %s %s\n' % (token, name)) -servercaps = wireproto.capabilities(self._repo, self._proto) +servercaps = wireproto.capabilities(self._repo, proto) rsp = b'capabilities: %s' % servercaps.data self._fout.write(b'%d\n' % len(rsp)) self._fout.write(rsp) diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -409,6 +409,56 @@ client = encoding.environ.get('SSH_CLIENT', '').split(' ', 1)[0] return 'remote:ssh:' + client +def _runsshserver(ui, repo, fin, fout): +state = 'protov1-serving' +proto = sshv1protocolhandler(ui, fin, fout) + +while True: +if state == 'protov1-serving': +# Commands are issued on new lines. +request = fin.readline()[:-1] + +# Empty lines signal to terminate the connection. +if not request: +state = 'shutdown' +continue + +available = wireproto.commands.commandavailable(request, proto) + +# This command isn't available. Send an empty response and go +# back to waiting for a new command. +if not available: +_sshv1respondbytes(fout, b'') +continue + +rsp = wireproto.dispatch(repo, proto, request) + +if isinstance(rsp, bytes): +_sshv1respondbytes(fout, rsp) +elif isinstance(rsp, wireprototypes.bytesresponse): +_sshv1respondbytes(fout, rsp.data) +elif isinstance(rsp, wireprototypes.streamres): +_sshv1respondstream(fout, rsp) +elif isinstance(rsp, wireprototypes.streamreslegacy): +_sshv1respondstream(fout, rsp) +elif isinstance(rsp, wireprototypes.pushres): +_sshv1respondbytes(fout, b'') +_sshv1respondbytes(fout, bytes(rsp.res)) +elif isinstance(rsp, wireprototypes.pusherr): +_sshv1respondbytes(fout, rsp.res) +elif isinstance(rsp, wireprototypes.ooberror): +_sshv1respondooberror(fout, ui.ferr, rsp.message) +else: +raise error.ProgrammingError('unhandled response type from ' + 'wire protocol command: %s' % rsp) + +elif state == 'shutdown': +break + +else: +raise error.ProgrammingError('unhandled ssh server state: %s' % + state) + class sshserver(object): def __init__(self, ui, repo): self._ui = ui @
D2204: wireprotoserver: handle SSH protocol version 2 upgrade requests
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This commit teaches the SSH server to recognize the "upgrade" request line that clients send when they wish to switch the channel to version 2 of the SSH protocol. Servers don't honor upgrade requests unless an experimental config option is set. Since the built-in server now supports upgrade requests, our test server to test the handshake has been deleted. Existing tests use the built-in server and their output doesn't change. The upgrade is handled in our state machine. The end result is a bit wonky, as the server transitions back to version 1 state immediately after upgrading. But this will change as soon as version 2 has an actual protocol that differs from version 1. Tests demonstrating that the new server is a bit more strict about the upgrade handshake have been added. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2204 AFFECTED FILES mercurial/configitems.py mercurial/wireprotoserver.py tests/sshprotoext.py tests/test-ssh-proto.t CHANGE DETAILS diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t --- a/tests/test-ssh-proto.t +++ b/tests/test-ssh-proto.t @@ -453,9 +453,17 @@ local: no pushable: yes +Enable version 2 support on server. We need to do this in hgrc because we can't +use --config with `hg serve --stdio`. + + $ cat >> server/.hg/hgrc << EOF + > [experimental] + > sshserver.support-v2 = true + > EOF + Send an upgrade request to a server that supports upgrade - $ SSHSERVERMODE=upgradev2 hg -R server serve --stdio << EOF + $ hg -R server serve --stdio << EOF > upgrade this-is-some-token proto=exp-ssh-v2-0001 > hello > between @@ -466,7 +474,7 @@ 383 capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN - $ SSHSERVERMODE=upgradev2 hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server + $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) sending upgrade request: * proto=exp-ssh-v2-0001 (glob) @@ -482,7 +490,7 @@ Verify the peer has capabilities - $ SSHSERVERMODE=upgradev2 hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server + $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) sending upgrade request: * proto=exp-ssh-v2-0001 (glob) @@ -527,3 +535,96 @@ remote-changegroup http https + +Command after upgrade to version 2 is processed + + $ hg -R server serve --stdio << EOF + > upgrade this-is-some-token proto=exp-ssh-v2-0001 + > hello + > between + > pairs 81 + > -hello + > EOF + upgraded this-is-some-token exp-ssh-v2-0001 + 383 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + 384 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + +Multiple upgrades is not allowed + + $ hg -R server serve --stdio << EOF + > upgrade this-is-some-token proto=exp-ssh-v2-0001 + > hello + > between + > pairs 81 + > -upgrade another-token proto=irrelevant + > hello + > EOF + upgraded this-is-some-token exp-ssh-v2-0001 + 383 + capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN + cannot upgrade protocols multiple times + - + + +Malformed upgrade request line (not exactly 3 space delimited tokens) + + $ hg -R server serve --stdio << EOF + > upgrade + > EOF + 0 + + $ hg -R server serve --stdio << EOF + > upgrade token + > EOF + 0 + + $ hg -R server serve --stdio << EOF + > upgrade token foo=bar extra-token + > EOF + 0 + +Upgrade request to unsupported protocol is ignored + + $ hg -R server serve --stdio << EOF + > upgrade this-is-some-token proto=unknown1,unknown2 + > hello + > between + > pairs 81 + > -
D2201: narrowspec: move module into core
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Having support for parsing the narrow specification in core is necessary for moving many other parts of narrow to core. We do still want to harmonize the narrow spec with the sparse spec. And the format needs to be documented. But this shouldn't hold up the code moving to core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2201 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowdirstate.py hgext/narrow/narrowrepo.py hgext/narrow/narrowspec.py hgext/narrow/narrowwirepeer.py mercurial/narrowspec.py tests/test-narrow-expanddirstate.t CHANGE DETAILS diff --git a/tests/test-narrow-expanddirstate.t b/tests/test-narrow-expanddirstate.t --- a/tests/test-narrow-expanddirstate.t +++ b/tests/test-narrow-expanddirstate.t @@ -51,22 +51,22 @@ > from mercurial import extensions > from mercurial import localrepo > from mercurial import match as matchmod + > from mercurial import narrowspec > from mercurial import patch > from mercurial import util as hgutil > > def expandnarrowspec(ui, repo, newincludes=None): > if not newincludes: > return > import sys > newincludes = set([newincludes]) - > narrowhg = extensions.find('narrow') > includes, excludes = repo.narrowpats - > currentmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) + > currentmatcher = narrowspec.match(repo.root, includes, excludes) > includes = includes | newincludes > if not repo.currenttransaction(): > ui.develwarn('expandnarrowspec called outside of transaction!') > repo.setnarrowpats(includes, excludes) - > newmatcher = narrowhg.narrowspec.match(repo.root, includes, excludes) + > newmatcher = narrowspec.match(repo.root, includes, excludes) > added = matchmod.differencematcher(newmatcher, currentmatcher) > for f in repo['.'].manifest().walk(added): > repo.dirstate.normallookup(f) diff --git a/hgext/narrow/narrowspec.py b/mercurial/narrowspec.py rename from hgext/narrow/narrowspec.py rename to mercurial/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/mercurial/narrowspec.py @@ -9,8 +9,8 @@ import errno -from mercurial.i18n import _ -from mercurial import ( +from .i18n import _ +from . import ( error, hg, match as matchmod, @@ -89,7 +89,7 @@ # We use newlines as separators in the narrowspec file, so don't allow them # in patterns. if _numlines(pat) > 1: -raise error.Abort('newlines are not allowed in narrowspec paths') +raise error.Abort(_('newlines are not allowed in narrowspec paths')) components = pat.split('/') if '.' in components or '..' in components: diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -12,11 +12,10 @@ error, extensions, hg, +narrowspec, node, ) -from . import narrowspec - def uisetup(): def peersetup(ui, peer): # We must set up the expansion before reposetup below, since it's used diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -12,12 +12,12 @@ hg, localrepo, match as matchmod, +narrowspec, scmutil, ) from . import ( narrowrevlog, -narrowspec, ) # When narrowing is finalized and no longer subject to format changes, diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py --- a/hgext/narrow/narrowdirstate.py +++ b/hgext/narrow/narrowdirstate.py @@ -13,11 +13,10 @@ error, extensions, match as matchmod, +narrowspec, util as hgutil, ) -from . import narrowspec - def setup(repo): """Add narrow spec dirstate ignore, block changes outside narrow spec.""" diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -18,6 +18,7 @@ extensions, hg, merge, +narrowspec, node, registrar, repair, @@ -28,7 +29,6 @@ from . import ( narrowbundle2, narrowrepo, -narrowspec, ) table = {} diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -24,14 +24,14 @@ error, exchange, extensions, +narrowspec, repair, util, wireproto, ) from . import ( narrowrepo, -narrowspec, ) NARROWCAP = 'narrow' To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2200: hg: move share._getsrcrepo into core
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The fact we were calling this from extensions was a sign that it should live in core. We were also able to remove some extra attribute aliases from the share extension. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2200 AFFECTED FILES hgext/journal.py hgext/narrow/narrowrepo.py hgext/narrow/narrowspec.py hgext/share.py mercurial/hg.py CHANGE DETAILS diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -202,6 +202,24 @@ return '' return os.path.basename(os.path.normpath(path)) +def sharedreposource(repo): +"""Returns repository object for source repository of a shared repo. + +If repo is not a shared repository, returns None. +""" +if repo.sharedpath == repo.path: +return None + +if util.safehasattr(repo, 'srcrepo') and repo.srcrepo: +return repo.srcrepo + +# the sharedpath always ends in the .hg; we want the path to the repo +source = repo.vfs.split(repo.sharedpath)[0] +srcurl, branches = parseurl(source) +srcrepo = repository(repo.ui, srcurl) +repo.srcrepo = srcrepo +return srcrepo + def share(ui, source, dest=None, update=True, bookmarks=True, defaultpath=None, relative=False): '''create a shared repository''' diff --git a/hgext/share.py b/hgext/share.py --- a/hgext/share.py +++ b/hgext/share.py @@ -52,9 +52,6 @@ util, ) -repository = hg.repository -parseurl = hg.parseurl - cmdtable = {} command = registrar.command(cmdtable) # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for @@ -135,27 +132,9 @@ return False return hg.sharedbookmarks in shared -def _getsrcrepo(repo): -""" -Returns the source repository object for a given shared repository. -If repo is not a shared repository, return None. -""" -if repo.sharedpath == repo.path: -return None - -if util.safehasattr(repo, 'srcrepo') and repo.srcrepo: -return repo.srcrepo - -# the sharedpath always ends in the .hg; we want the path to the repo -source = repo.vfs.split(repo.sharedpath)[0] -srcurl, branches = parseurl(source) -srcrepo = repository(repo.ui, srcurl) -repo.srcrepo = srcrepo -return srcrepo - def getbkfile(orig, repo): if _hassharedbookmarks(repo): -srcrepo = _getsrcrepo(repo) +srcrepo = hg.sharedreposource(repo) if srcrepo is not None: # just orig(srcrepo) doesn't work as expected, because # HG_PENDING refers repo.root. @@ -186,7 +165,7 @@ orig(self, tr) if _hassharedbookmarks(self._repo): -srcrepo = _getsrcrepo(self._repo) +srcrepo = hg.sharedreposource(self._repo) if srcrepo is not None: category = 'share-bookmarks' tr.addpostclose(category, lambda tr: self._writerepo(srcrepo)) @@ -196,6 +175,6 @@ orig(self, repo) if _hassharedbookmarks(self._repo): -srcrepo = _getsrcrepo(self._repo) +srcrepo = hg.sharedreposource(self._repo) if srcrepo is not None: orig(self, srcrepo) diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -12,14 +12,11 @@ from mercurial.i18n import _ from mercurial import ( error, +hg, match as matchmod, util, ) -from .. import ( -share, -) - FILENAME = 'narrowspec' def _parsestoredpatterns(text): @@ -133,7 +130,7 @@ def load(repo): if repo.shared(): -repo = share._getsrcrepo(repo) +repo = hg.sharedreposource(repo) try: spec = repo.vfs.read(FILENAME) except IOError as e: @@ -150,7 +147,7 @@ def save(repo, includepats, excludepats): spec = format(includepats, excludepats) if repo.shared(): -repo = share._getsrcrepo(repo) +repo = hg.sharedreposource(repo) repo.vfs.write(FILENAME, spec) def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -9,15 +9,12 @@ from mercurial import ( bundlerepo, +hg, localrepo, match as matchmod, scmutil, ) -from .. import ( -share, -) - from . import ( narrowrevlog, narrowspec, @@ -37,7 +34,7 @@ def unsharenarrowspec(orig, ui, repo, repopath): if (REQUIREMENT in repo.requirements and repo.path == repopath and repo.shared()): -srcrepo = share._getsrcrepo(repo) +srcrepo = hg.sharedreposource(repo) with srcrepo.vfs(narrowspec.FILENAME) as f: spec = f.read() with repo.vfs(narrowspec.FILENAME, 'w') as f: diff --git a/hgext/journal.py b/hgext/journa
D2202: tests: remove code to support Mercurial 4.3
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Now that narrow lives in core, we don't need the legacy support. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2202 AFFECTED FILES tests/test-narrow-expanddirstate.t CHANGE DETAILS diff --git a/tests/test-narrow-expanddirstate.t b/tests/test-narrow-expanddirstate.t --- a/tests/test-narrow-expanddirstate.t +++ b/tests/test-narrow-expanddirstate.t @@ -75,23 +75,13 @@ > def wrapds(orig, self): > ds = orig(self) > class expandingdirstate(ds.__class__): - > # Mercurial 4.4 uses this version. > @hgutil.propertycache > def _map(self): > ret = super(expandingdirstate, self)._map > with repo.wlock(), repo.lock(), repo.transaction( > 'expandnarrowspec'): > expandnarrowspec(ui, repo, os.environ.get('DIRSTATEINCLUDES')) > return ret - > # Mercurial 4.3.3 and earlier uses this version. It seems that - > # narrowhg does not currently support this version, but we include - > # it just in case backwards compatibility is restored. - > def _read(self): - > ret = super(expandingdirstate, self)._read() - > with repo.wlock(), repo.lock(), repo.transaction( - > 'expandnarrowspec'): - > expandnarrowspec(ui, repo, os.environ.get('DIRSTATEINCLUDES')) - > return ret > ds.__class__ = expandingdirstate > return ds > return wrapds To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36000: 43 new changesets
43 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/fd9f2a22ee83 changeset: 35958:fd9f2a22ee83 user:Augie Fackler date:Wed Feb 07 06:28:43 2018 -0500 summary: python3: whitelist an additional 11 tests https://www.mercurial-scm.org/repo/hg/rev/9724f54923ec changeset: 35959:9724f54923ec user:Augie Fackler date:Tue Feb 06 05:24:28 2018 -0500 summary: chg: enable clang-format on all .c and .h files https://www.mercurial-scm.org/repo/hg/rev/580f7b1b88c7 changeset: 35960:580f7b1b88c7 user:Augie Fackler date:Tue Feb 06 05:25:36 2018 -0500 summary: hgsh: enable clang-format https://www.mercurial-scm.org/repo/hg/rev/0ff41ced4c12 changeset: 35961:0ff41ced4c12 user:Joerg Sonnenberger date:Sun Feb 04 00:29:22 2018 +0100 summary: diff: improve ui.write performance when not coloring on Windows https://www.mercurial-scm.org/repo/hg/rev/fa15a70f88de changeset: 35962:fa15a70f88de user:Boris Feld date:Mon Feb 05 20:36:51 2018 +0100 summary: changelog: implement context manager method for 'appender' object https://www.mercurial-scm.org/repo/hg/rev/69aaad59dc02 changeset: 35963:69aaad59dc02 user:Boris Feld date:Tue Feb 06 11:08:41 2018 +0100 summary: changelog: add the missing 'closed' property on 'appender' object https://www.mercurial-scm.org/repo/hg/rev/a915465a731e changeset: 35964:a915465a731e user:Boris Feld date:Tue Feb 06 11:51:39 2018 +0100 summary: dumprevlog: handle being passed a mode parameter https://www.mercurial-scm.org/repo/hg/rev/c839bbee1e13 changeset: 35965:c839bbee1e13 user:Boris Feld date:Tue Feb 06 11:52:37 2018 +0100 summary: parseindex: also forward keyword argument in a debug wrapper https://www.mercurial-scm.org/repo/hg/rev/8140ce44dec4 changeset: 35966:8140ce44dec4 user:Boris Feld date:Tue Feb 06 12:25:11 2018 +0100 summary: parseindex: implement context manager method on the wrapper https://www.mercurial-scm.org/repo/hg/rev/61326dd7cb8d changeset: 35967:61326dd7cb8d user:Boris Feld date:Mon Feb 05 17:03:56 2018 +0100 summary: revlog: move datafile opening in a method https://www.mercurial-scm.org/repo/hg/rev/91b3b11565e5 changeset: 35968:91b3b11565e5 user:Boris Feld date:Mon Feb 05 17:22:13 2018 +0100 summary: revlog: move index file opening in a method https://www.mercurial-scm.org/repo/hg/rev/1f2b8a644dd4 changeset: 35969:1f2b8a644dd4 user:Boris Feld date:Mon Feb 05 17:34:19 2018 +0100 summary: revlog: use context manager for index file life time in __init__ https://www.mercurial-scm.org/repo/hg/rev/69cf2e422490 changeset: 35970:69cf2e422490 user:Boris Feld date:Mon Feb 05 17:34:47 2018 +0100 summary: revlog: use context manager for data file lifetime in checkinlinesize https://www.mercurial-scm.org/repo/hg/rev/0f2c51afafb2 changeset: 35971:0f2c51afafb2 user:Boris Feld date:Mon Feb 05 17:34:57 2018 +0100 summary: revlog: use context manager for index file lifetime in checkinlinesize https://www.mercurial-scm.org/repo/hg/rev/82afb1a5ed94 changeset: 35972:82afb1a5ed94 user:Boris Feld date:Mon Feb 05 17:35:14 2018 +0100 summary: revlog: use context manager for data file lifetime in checksize https://www.mercurial-scm.org/repo/hg/rev/4d66993bdcff changeset: 35973:4d66993bdcff user:Boris Feld date:Mon Feb 05 17:57:29 2018 +0100 summary: revlog: add a _datareadfp context manager for data access needs https://www.mercurial-scm.org/repo/hg/rev/9ba1d0c724e2 changeset: 35974:9ba1d0c724e2 user:Boris Feld date:Mon Feb 05 18:04:40 2018 +0100 summary: revlog: rename 'self.checkinlinesize' into '_enforceinlinesize' https://www.mercurial-scm.org/repo/hg/rev/40d94ea51402 changeset: 35975:40d94ea51402 user:Gregory Szorc date:Tue Feb 06 10:51:15 2018 -0800 summary: internals: refactor wire protocol documentation https://www.mercurial-scm.org/repo/hg/rev/48a3a9283f09 changeset: 35976:48a3a9283f09 user:Gregory Szorc date:Tue Feb 06 11:08:36 2018 -0800 summary: sshpeer: initial definition and implementation of new SSH protocol https://www.mercurial-scm.org/repo/hg/rev/625038cb4b1d changeset: 35977:625038cb4b1d user:Gregory Szorc date:Tue Feb 06 10:57:56 2018 -0800 summary: sshpeer: rename sshpeer class to sshv1peer (API) https://www.mercurial-scm.org/repo/hg/rev/59e4a7781a36 changeset: 35978:59e4a7781a36 user:Gregory Szorc date:Tue Feb 06 11:31:25 2018 -0800 summary: sshpeer: implement peer for version 2 of wire protocol https://www.mercurial-scm.org/repo/hg/rev/ae79cf6f9c82 changeset: 35979:ae79cf6f9c82 user:Gregory Szorc date:Wed Jan 31 10:06:39 2018 -0800 summary: wireprot
D2199: tests: glob over line number
indygreg 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/D2199 AFFECTED FILES tests/test-narrow-pull.t CHANGE DETAILS diff --git a/tests/test-narrow-pull.t b/tests/test-narrow-pull.t --- a/tests/test-narrow-pull.t +++ b/tests/test-narrow-pull.t @@ -166,7 +166,7 @@ We should also be able to unshare without breaking everything: $ hg unshare - devel-warn: write with no wlock: "narrowspec" at: */hgext/narrow/narrowrepo.py:43 (unsharenarrowspec) (glob) + devel-warn: write with no wlock: "narrowspec" at: */hgext/narrow/narrowrepo.py:* (unsharenarrowspec) (glob) $ hg verify checking changesets checking manifests To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2198: tests: remove references to bundle2-exp config option
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This option was deleted a while ago. We don't even alias it in core. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2198 AFFECTED FILES tests/narrow-library.sh tests/test-pushvars.t CHANGE DETAILS diff --git a/tests/test-pushvars.t b/tests/test-pushvars.t --- a/tests/test-pushvars.t +++ b/tests/test-pushvars.t @@ -11,8 +11,6 @@ $ cat >> $HGRCPATH << EOF > [hooks] > pretxnchangegroup = sh $TESTTMP/pretxnchangegroup.sh - > [experimental] - > bundle2-exp = true > EOF $ hg init repo diff --git a/tests/narrow-library.sh b/tests/narrow-library.sh --- a/tests/narrow-library.sh +++ b/tests/narrow-library.sh @@ -4,6 +4,5 @@ [ui] ssh=python "$TESTDIR/dummyssh" [experimental] -bundle2-exp = True changegroup3 = True EOF To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2195: tests: use `hello` not `capabilities` over ssh
This revision was automatically updated to reflect the committed changes. Closed by commit rHG54e2abc73686: tests: use `hello` not `capabilities` over ssh (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2195?vs=5511&id=5565 REVISION DETAIL https://phab.mercurial-scm.org/D2195 AFFECTED FILES tests/test-narrow-clone-non-narrow-server.t CHANGE DETAILS diff --git a/tests/test-narrow-clone-non-narrow-server.t b/tests/test-narrow-clone-non-narrow-server.t --- a/tests/test-narrow-clone-non-narrow-server.t +++ b/tests/test-narrow-clone-non-narrow-server.t @@ -18,7 +18,7 @@ $ cat hg.pid >> "$DAEMON_PIDS" Verify that narrow is advertised in the bundle2 capabilities: - $ echo capabilities | hg -R . serve --stdio | \ + $ echo hello | hg -R . serve --stdio | \ > python -c "import sys, urllib; print urllib.unquote_plus(list(sys.stdin)[1])" | grep narrow narrow=v0 To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2007: narrowrepo: make repo requirement include the string 'experimental'
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe14821b290eb: narrowrepo: make repo requirement include the string 'experimental' (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2007?vs=5157&id=5551 REVISION DETAIL https://phab.mercurial-scm.org/D2007 AFFECTED FILES hgext/narrow/narrowrepo.py tests/test-narrow-acl.t tests/test-narrow-clone-no-ellipsis.t tests/test-narrow-clone.t tests/test-narrow-debugcommands.t tests/test-narrow-pull.t CHANGE DETAILS diff --git a/tests/test-narrow-pull.t b/tests/test-narrow-pull.t --- a/tests/test-narrow-pull.t +++ b/tests/test-narrow-pull.t @@ -166,7 +166,7 @@ We should also be able to unshare without breaking everything: $ hg unshare - devel-warn: write with no wlock: "narrowspec" at: */hgext/narrow/narrowrepo.py:41 (unsharenarrowspec) (glob) + devel-warn: write with no wlock: "narrowspec" at: */hgext/narrow/narrowrepo.py:43 (unsharenarrowspec) (glob) $ hg verify checking changesets checking manifests diff --git a/tests/test-narrow-debugcommands.t b/tests/test-narrow-debugcommands.t --- a/tests/test-narrow-debugcommands.t +++ b/tests/test-narrow-debugcommands.t @@ -7,7 +7,7 @@ > [excludes] > EOF $ echo treemanifest >> .hg/requires - $ echo narrowhg >> .hg/requires + $ echo narrowhg-experimental >> .hg/requires $ mkdir -p foo/bar $ echo b > foo/f $ echo c > foo/bar/f diff --git a/tests/test-narrow-clone.t b/tests/test-narrow-clone.t --- a/tests/test-narrow-clone.t +++ b/tests/test-narrow-clone.t @@ -29,7 +29,7 @@ $ cat .hg/requires | grep -v generaldelta dotencode fncache - narrowhg + narrowhg-experimental revlogv1 store diff --git a/tests/test-narrow-clone-no-ellipsis.t b/tests/test-narrow-clone-no-ellipsis.t --- a/tests/test-narrow-clone-no-ellipsis.t +++ b/tests/test-narrow-clone-no-ellipsis.t @@ -25,7 +25,7 @@ $ cat .hg/requires | grep -v generaldelta dotencode fncache - narrowhg + narrowhg-experimental revlogv1 store diff --git a/tests/test-narrow-acl.t b/tests/test-narrow-acl.t --- a/tests/test-narrow-acl.t +++ b/tests/test-narrow-acl.t @@ -34,7 +34,7 @@ Requirements should contain narrowhg $ cat narrowclone1/.hg/requires | grep narrowhg - narrowhg + narrowhg-experimental NarrowHG should track f1 and f2 $ hg -R narrowclone1 tracked diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -23,7 +23,9 @@ narrowspec, ) -REQUIREMENT = 'narrowhg' +# When narrowing is finalized and no longer subject to format changes, +# we should move this to just "narrow" or similar. +REQUIREMENT = 'narrowhg-experimental' def wrappostshare(orig, sourcerepo, destrepo, **kwargs): orig(sourcerepo, destrepo, **kwargs) To: durin42, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2194: narrowwirepeer: add TODO about how we add wireproto args to unbundle :(
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb60c577b6e03: narrowwirepeer: add TODO about how we add wireproto args to unbundle :( (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2194?vs=5510&id=5564 REVISION DETAIL https://phab.mercurial-scm.org/D2194 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -43,6 +43,8 @@ def wirereposetup(ui, peer): def wrapped(orig, cmd, *args, **kwargs): if cmd == 'unbundle': +# TODO: don't blindly add include/exclude wireproto +# arguments to unbundle. include, exclude = repo.narrowpats kwargs["includepats"] = ','.join(include) kwargs["excludepats"] = ','.join(exclude) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2187: manifest: clean up dirlog() to take a d parameter to avoid shadowing dir()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG59adb3051718: manifest: clean up dirlog() to take a d parameter to avoid shadowing dir() (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2187?vs=5517&id=5557 REVISION DETAIL https://phab.mercurial-scm.org/D2187 AFFECTED FILES hgext/narrow/narrowrevlog.py mercurial/manifest.py CHANGE DETAILS diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -1245,15 +1245,15 @@ self._fulltextcache.clear() self._dirlogcache = {'': self} -def dirlog(self, dir): -if dir: +def dirlog(self, d): +if d: assert self._treeondisk -if dir not in self._dirlogcache: -mfrevlog = manifestrevlog(self.opener, dir, +if d not in self._dirlogcache: +mfrevlog = manifestrevlog(self.opener, d, self._dirlogcache, treemanifest=self._treeondisk) -self._dirlogcache[dir] = mfrevlog -return self._dirlogcache[dir] +self._dirlogcache[d] = mfrevlog +return self._dirlogcache[d] def add(self, m, transaction, link, p1, p2, added, removed, readtree=None): if (p1 in self.fulltextcache and util.safehasattr(m, 'fastdelta') diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -116,12 +116,12 @@ # This function is called via debug{revlog,index,data}, but also during # at least some push operations. This will be used to wrap/exclude the # child directories when using treemanifests. -def dirlog(self, dir): -if dir and not dir.endswith('/'): -dir = dir + '/' -if not repo.narrowmatch().visitdir(dir[:-1] or '.'): -return excludedmanifestrevlog(dir) -result = super(narrowmanifestrevlog, self).dirlog(dir) +def dirlog(self, d): +if d and not d.endswith('/'): +d = d + '/' +if not repo.narrowmatch().visitdir(d[:-1] or '.'): +return excludedmanifestrevlog(d) +result = super(narrowmanifestrevlog, self).dirlog(d) makenarrowmanifestrevlog(result, repo) return result To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2190: narrowspec: document constraints when validating patterns
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9c55bbc29dcf: narrowspec: document constraints when validating patterns (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2190?vs=5506&id=5560 REVISION DETAIL https://phab.mercurial-scm.org/D2190 AFFECTED FILES hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -83,7 +83,11 @@ return len((s + 'x').splitlines()) def _validatepattern(pat): -"""Validates the pattern and aborts if it is invalid.""" +"""Validates the pattern and aborts if it is invalid. + +Patterns are stored in the narrowspec as newline-separated +POSIX-style bytestring paths. There's no escaping. +""" # We use newlines as separators in the narrowspec file, so don't allow them # in patterns. To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2009: narrowtemplates: update to use registrar mechanism
This revision was automatically updated to reflect the committed changes. Closed by commit rHGea02be8665ef: narrowtemplates: update to use registrar mechanism (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2009?vs=5514&id=5553 REVISION DETAIL https://phab.mercurial-scm.org/D2009 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowtemplates.py CHANGE DETAILS diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,24 +8,29 @@ from __future__ import absolute_import from mercurial import ( +registrar, revlog, -revset, -templatekw, util, ) +keywords = {} +templatekeyword = registrar.templatekeyword(keywords) +revsetpredicate = registrar.revsetpredicate() + def _isellipsis(repo, rev): if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: return True return False +@templatekeyword('ellipsis') def ellipsis(repo, ctx, templ, **args): """:ellipsis: String. 'ellipsis' if the change is an ellipsis node, else ''.""" if _isellipsis(repo, ctx.rev()): return 'ellipsis' return '' +@templatekeyword('outsidenarrow') def outsidenarrow(repo, ctx, templ, **args): """:outsidenarrow: String. 'outsidenarrow' if the change affects no tracked files, else ''.""" @@ -35,15 +40,9 @@ return 'outsidenarrow' return '' +@revsetpredicate('ellipsis') def ellipsisrevset(repo, subset, x): """``ellipsis()`` Changesets that are ellipsis nodes. """ return subset.filter(lambda r: _isellipsis(repo, r)) - -def setup(): -templatekw.keywords['ellipsis'] = ellipsis -templatekw.keywords['outsidenarrow'] = outsidenarrow - -revset.symbols['ellipsis'] = ellipsisrevset -revset.safesymbols.add('ellipsis') diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -62,7 +62,6 @@ narrowrevlog.setup() narrowbundle2.setup() narrowmerge.setup() -narrowtemplates.setup() narrowcommands.setup() narrowchangegroup.setup() narrowwirepeer.uisetup() @@ -91,3 +90,6 @@ extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) + +templatekeyword = narrowtemplates.templatekeyword +revsetpredicate = narrowtemplates.revsetpredicate To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2006: narrow: mark requirement as a constant
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8c31187b6717: narrow: mark requirement as a constant (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2006?vs=5156&id=5550 REVISION DETAIL https://phab.mercurial-scm.org/D2006 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowbundle2.py hgext/narrow/narrowchangegroup.py hgext/narrow/narrowcommands.py hgext/narrow/narrowrepo.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -23,17 +23,17 @@ narrowspec, ) -requirement = 'narrowhg' +REQUIREMENT = 'narrowhg' def wrappostshare(orig, sourcerepo, destrepo, **kwargs): orig(sourcerepo, destrepo, **kwargs) -if requirement in sourcerepo.requirements: +if REQUIREMENT in sourcerepo.requirements: with destrepo.wlock(): with destrepo.vfs('shared', 'a') as fp: fp.write(narrowspec.FILENAME + '\n') def unsharenarrowspec(orig, ui, repo, repopath): -if (requirement in repo.requirements +if (REQUIREMENT in repo.requirements and repo.path == repopath and repo.shared()): srcrepo = share._getsrcrepo(repo) with srcrepo.vfs(narrowspec.FILENAME) as f: diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -103,7 +103,7 @@ repo.__class__.__bases__ = (repo.__class__.__bases__[0], repo.unfiltered().__class__) if opts_narrow: -repo.requirements.add(narrowrepo.requirement) +repo.requirements.add(narrowrepo.REQUIREMENT) repo._writerequirements() return orig(repo, *args, **kwargs) @@ -116,7 +116,7 @@ def pullnarrowcmd(orig, ui, repo, *args, **opts): """Wraps pull command to allow modifying narrow spec.""" wrappedextraprepare = util.nullcontextmanager() -if narrowrepo.requirement in repo.requirements: +if narrowrepo.REQUIREMENT in repo.requirements: def pullbundle2extraprepare_widen(orig, pullop, kwargs): orig(pullop, kwargs) @@ -130,7 +130,7 @@ def archivenarrowcmd(orig, ui, repo, *args, **opts): """Wraps archive command to narrow the default includes.""" -if narrowrepo.requirement in repo.requirements: +if narrowrepo.REQUIREMENT in repo.requirements: repo_includes, repo_excludes = repo.narrowpats includes = set(opts.get('include', [])) excludes = set(opts.get('exclude', [])) @@ -144,7 +144,7 @@ def pullbundle2extraprepare(orig, pullop, kwargs): repo = pullop.repo -if narrowrepo.requirement not in repo.requirements: +if narrowrepo.REQUIREMENT not in repo.requirements: return orig(pullop, kwargs) if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: @@ -330,7 +330,7 @@ If --clear is specified without any further options, the narrowspec will be empty and will not match any files. """ -if narrowrepo.requirement not in repo.requirements: +if narrowrepo.REQUIREMENT not in repo.requirements: ui.warn(_('The narrow command is only supported on respositories cloned' ' with --narrow.\n')) return 1 diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -27,7 +27,7 @@ def supportedoutgoingversions(orig, repo): versions = orig(repo) -if narrowrepo.requirement in repo.requirements: +if narrowrepo.REQUIREMENT in repo.requirements: versions.discard('01') versions.discard('02') return versions diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -368,8 +368,8 @@ includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) narrowspec.save(op.repo, includepats, excludepats) -if not narrowrepo.requirement in op.repo.requirements: -op.repo.requirements.add(narrowrepo.requirement) +if not narrowrepo.REQUIREMENT in op.repo.requirements: +op.repo.requirements.add(narrowrepo.REQUIREMENT) op.repo._writerequirements() op.repo.invalidate(clearfilecache=True) diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -55,7 +55,7 @@ # Export the commands table for Mercurial to see. cmdtable = narrowcommands.table -localrepo.localrepository._basesupported.add(narrowrepo.requirement) +localrepo.localrepository._basesupported.add(narrowrepo.REQUIREMENT)
D2196: narrow: add a TODO document
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9b5df6e19a4f: narrow: add a TODO document (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2196?vs=5512&id=5566 REVISION DETAIL https://phab.mercurial-scm.org/D2196 AFFECTED FILES hgext/narrow/TODO.rst CHANGE DETAILS diff --git a/hgext/narrow/TODO.rst b/hgext/narrow/TODO.rst new file mode 100644 --- /dev/null +++ b/hgext/narrow/TODO.rst @@ -0,0 +1,37 @@ +Integration with the share extension needs improvement. Right now +we've seen some odd bugs, and the way we modify the contents of the +.hg/shared file is unfortunate. See wrappostshare() and unsharenarrowspec(). + +Resolve commentary on narrowrepo.wraprepo.narrowrepository.status +about the filtering of status being done at an awkward layer. This +came up the import to hgext, but nobody's got concrete improvement +ideas as of then. + +Fold most (or preferably all) of narrowrevlog.py into core. + +Address commentary in narrowrevlog.excludedmanifestrevlog.add - +specifically we should improve the collaboration with core so that +add() never gets called on an excluded directory and we can improve +the stand-in to raise a ProgrammingError. + +Figure out how to correctly produce narrowmanifestrevlog and +narrowfilelog instances instead of monkeypatching regular revlogs at +runtime to our subclass. Even better, merge the narrowing logic +directly into core. + +Reason more completely about rename-filtering logic in +narrowfilelog. There could be some surprises lurking there. + +Formally document the narrowspec format. Unify with sparse, if at all +possible. For bonus points, unify with the server-specified narrowspec +format. + +narrowrepo.setnarrowpats() or narrowspec.save() need to make sure +they're holding the wlock. + +Implement a simple version of the expandnarrow wireproto command for +core. Having configurable shorthands for narrowspecs has been useful +at Google (and sparse has a similar feature from Facebook), so it +probably makes sense to implement the feature in core. (Google's +handler is entirely custom to Google, with a custom format related to +bazel's build language, so it's not in the narrowhg distribution.) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2186: narrowrevlog: replace AssertionError with ProgrammingError
This revision was automatically updated to reflect the committed changes. Closed by commit rHG142ce66a4118: narrowrevlog: replace AssertionError with ProgrammingError (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2186?vs=5516&id= REVISION DETAIL https://phab.mercurial-scm.org/D2186 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -8,6 +8,7 @@ from __future__ import absolute_import from mercurial import ( + error, manifest, revlog, util, @@ -67,8 +68,8 @@ return excludeddir(self._dir, self._node) def write(self, *args): -raise AssertionError('Attempt to write manifest from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to write manifest from excluded dir %s' % self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): """Stand-in for excluded treemanifest revlogs. @@ -84,20 +85,20 @@ self._dir = dir def __len__(self): -raise AssertionError('Attempt to get length of excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get length of excluded dir %s' % self._dir) def rev(self, node): -raise AssertionError('Attempt to get rev from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get rev from excluded dir %s' % self._dir) def linkrev(self, node): -raise AssertionError('Attempt to get linkrev from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get linkrev from excluded dir %s' % self._dir) def node(self, rev): -raise AssertionError('Attempt to get node from excluded dir %s' % - self._dir) +raise error.ProgrammingError( +'attempt to get node from excluded dir %s' % self._dir) def add(self, *args, **kwargs): # We should never write entries in dirlogs outside the narrow clone. To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2189: narrowrevlog: add a TODO around remotefilelog moving to core
This revision was automatically updated to reflect the committed changes. Closed by commit rHG66b4ffe90676: narrowrevlog: add a TODO around remotefilelog moving to core (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2189?vs=5519&id=5559 REVISION DETAIL https://phab.mercurial-scm.org/D2189 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -156,6 +156,10 @@ # rename-checking logic when on remotefilelog. This # might be incorrect on other non-revlog-based storage # engines, but for now this seems to be fine. +# +# TODO: when remotefilelog is in core, improve this to +# explicitly look for remotefilelog instead of cheating +# with a hasattr check. if util.safehasattr(self, 'node'): node = self.node(rev) # Because renamed() is overridden above to To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2191: narrowspec: consistently use set() to copy sets
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb8bbe589fd47: narrowspec: consistently use set() to copy sets (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2191?vs=5507&id=5561 REVISION DETAIL https://phab.mercurial-scm.org/D2191 AFFECTED FILES hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -180,7 +180,7 @@ >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], []) (set(['f1/$non_exitent_var']), {}) """ -res_excludes = req_excludes.copy() +res_excludes = set(req_excludes) res_excludes.update(repo_excludes) if not req_includes: res_includes = set(repo_includes) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2193: narrowwirepeer: rename expandnarrow capability to exp-expandnarrow
This revision was automatically updated to reflect the committed changes. Closed by commit rHG22ed16caa596: narrowwirepeer: rename expandnarrow capability to exp-expandnarrow (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2193?vs=5509&id=5563 REVISION DETAIL https://phab.mercurial-scm.org/D2193 AFFECTED FILES hgext/narrow/narrowwirepeer.py CHANGE DETAILS diff --git a/hgext/narrow/narrowwirepeer.py b/hgext/narrow/narrowwirepeer.py --- a/hgext/narrow/narrowwirepeer.py +++ b/hgext/narrow/narrowwirepeer.py @@ -24,7 +24,7 @@ class expandingpeer(peer.__class__): def expandnarrow(self, narrow_include, narrow_exclude, nodes): ui.status(_("expanding narrowspec\n")) -if not self.capable('expandnarrow'): +if not self.capable('exp-expandnarrow'): raise error.Abort( 'peer does not support expanding narrowspecs') To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1979: tests: fold narrow treemanifest tests into main test file using testcases
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdc01484606da: tests: fold narrow treemanifest tests into main test file using testcases (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1979?vs=5100&id=5546 REVISION DETAIL https://phab.mercurial-scm.org/D1979 AFFECTED FILES tests/test-narrow-commit-tree.t tests/test-narrow-commit.t tests/test-narrow-merge-tree.t tests/test-narrow-merge.t tests/test-narrow-patch-tree.t tests/test-narrow-patch.t tests/test-narrow-strip-tree.t tests/test-narrow-strip.t tests/test-narrow-tree.t tests/test-narrow-widen-tree.t tests/test-narrow-widen.t tests/test-narrow.t CHANGE DETAILS diff --git a/tests/test-narrow.t b/tests/test-narrow.t --- a/tests/test-narrow.t +++ b/tests/test-narrow.t @@ -1,5 +1,14 @@ +#testcases flat tree + $ . "$TESTDIR/narrow-library.sh" +#if tree + $ cat << EOF >> $HGRCPATH + > [experimental] + > treemanifest = 1 + > EOF +#endif + $ hg init master $ cd master $ cat >> .hg/hgrc <> d6/f @@ -159,6 +170,7 @@ 2 files updated, 0 files merged, 0 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d3/f.i + deleting meta/d3/00manifest.i (tree !) $ hg log -T '{desc}\n' -r . add d10/f Updates to nullid if necessary @@ -178,6 +190,7 @@ 0 files updated, 0 files merged, 1 files removed, 0 files unresolved saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) deleting data/d3/f.i + deleting meta/d3/00manifest.i (tree !) $ hg id $ cd .. @@ -197,6 +210,7 @@ searching for changes looking for local changes to affected paths deleting data/d0/f.i + deleting meta/d0/00manifest.i (tree !) $ hg tracked $ hg files [1] @@ -252,6 +266,7 @@ searching for changes looking for local changes to affected paths deleting data/d6/f.i + deleting meta/d6/00manifest.i (tree !) $ hg tracked I path:d0 I path:d3 @@ -289,6 +304,7 @@ searching for changes looking for local changes to affected paths deleting data/d0/f.i + deleting meta/d0/00manifest.i (tree !) $ hg tracked I path:d3 I path:d9 diff --git a/tests/test-narrow-widen.t b/tests/test-narrow-widen.t --- a/tests/test-narrow-widen.t +++ b/tests/test-narrow-widen.t @@ -1,5 +1,13 @@ +#testcases flat tree $ . "$TESTDIR/narrow-library.sh" +#if tree + $ cat << EOF >> $HGRCPATH + > [experimental] + > treemanifest = 1 + > EOF +#endif + $ hg init master $ cd master $ cat >> .hg/hgrc < --extra-config-opt experimental.treemanifest=1 test-narrow-widen.t 2>&1 | \ - > grep -v 'unexpected mercurial lib' | egrep -v '\(expected' - - --- */test-narrow-widen.t (glob) - +++ */test-narrow-widen.t.err (glob) - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - $ hg verify - checking changesets - checking manifests - + checking directory manifests - crosschecking files in changesets and manifests - checking files - 4 files, 8 changesets, 4 total revisions - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - $ hg verify - checking changesets - checking manifests - + checking directory manifests - crosschecking files in changesets and manifests - checking files - 5 files, 9 changesets, 5 total revisions - - ERROR: test-narrow-widen.t output changed - ! - Failed test-narrow-widen.t: output changed - # Ran 1 tests, 0 skipped, 1 failed. - python hash seed: * (glob) diff --git a/tests/test-narrow-tree.t b/tests/test-narrow-tree.t deleted file mode 100644 --- a/tests/test-narrow-tree.t +++ /dev/null @@ -1,68 +0,0 @@ - $ cd $TESTDIR && python $RUNTESTDIR/run-tests.py \ - > --extra-config-opt experimental.treemanifest=1 test-narrow-narrow.t 2>&1 | \ - > grep -v 'unexpected mercurial lib' | egrep -v '\(expected' - - --- /*/tests/test-narrow-narrow.t (glob) - +++ /*/tests/test-narrow-narrow.t.err (glob) - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - * (glob) - * (glob) - deleting data/d0/f.i - + deleting meta/d0/00manifest.i - $ hg log -T "{node|short}: {desc} {outsidenarrow}\n" - *: local change to d3 (glob) - *: add d10/f outsidenarrow (glob) - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - looking for local changes to affected paths - saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d0/f.i - + deleting meta/d0/00manifest.i - Updates off of stripped commit if necessary - $ hg co -r 'desc("local change to d3")' -q - $ echo local change >> d6/f - @@ -\d+,\d+ \+\d+,\d+ @@ (re) - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob) - deleting data/d3/f.i - + deleting meta/d3/00manifest.i - $ hg log -T '{desc}\n' -r .
D2185: narrowrevlog: document excludeddir class and friends
This revision was automatically updated to reflect the committed changes. Closed by commit rHGed4e68efebfe: narrowrevlog: document excludeddir class and friends (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2185?vs=5515&id=5556 REVISION DETAIL https://phab.mercurial-scm.org/D2185 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -31,6 +31,16 @@ pass class excludeddir(manifest.treemanifest): +"""Stand-in for a directory that is excluded from the repository. + +With narrowing active on a repository that uses treemanifests, +some of the directory revlogs will be excluded from the resulting +clone. This is a huge storage win for clients, but means we need +some sort of pseudo-manifest to surface to internals so we can +detect a merge conflict outside the narrowspec. That's what this +class is: it stands in for a directory whose node is known, but +whose contents are unknown. +""" def __init__(self, dir, node): super(excludeddir, self).__init__(dir) self._node = node @@ -48,6 +58,7 @@ return self class excludeddirmanifestctx(manifest.treemanifestctx): +"""context wrapper for excludeddir - see that docstring for rationale""" def __init__(self, dir, node): self._dir = dir self._node = node @@ -60,6 +71,15 @@ self._dir) class excludedmanifestrevlog(manifest.manifestrevlog): +"""Stand-in for excluded treemanifest revlogs. + +When narrowing is active on a treemanifest repository, we'll have +references to directories we can't see due to the revlog being +skipped. This class exists to conform to the manifestrevlog +interface for those directories and proactively prevent writes to +outside the narrowspec. +""" + def __init__(self, dir): self._dir = dir To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2192: narrow: make restrictpatterns a little more idiomatic
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8fd0a9e2d7e9: narrow: make restrictpatterns a little more idiomatic (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2192?vs=5508&id=5562 REVISION DETAIL https://phab.mercurial-scm.org/D2192 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py hgext/narrow/narrowspec.py CHANGE DETAILS diff --git a/hgext/narrow/narrowspec.py b/hgext/narrow/narrowspec.py --- a/hgext/narrow/narrowspec.py +++ b/hgext/narrow/narrowspec.py @@ -153,35 +153,34 @@ repo = share._getsrcrepo(repo) repo.vfs.write(FILENAME, spec) -def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes, - invalid_includes=None): +def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes): r""" Restricts the patterns according to repo settings, results in a logical AND operation :param req_includes: requested includes :param req_excludes: requested excludes :param repo_includes: repo includes :param repo_excludes: repo excludes -:param invalid_includes: an array to collect invalid includes -:return: include and exclude patterns +:return: include patterns, exclude patterns, and invalid include patterns. >>> restrictpatterns({'f1','f2'}, {}, ['f1'], []) -(set(['f1']), {}) +(set(['f1']), {}, []) >>> restrictpatterns({'f1'}, {}, ['f1','f2'], []) -(set(['f1']), {}) +(set(['f1']), {}, []) >>> restrictpatterns({'f1/fc1', 'f3/fc3'}, {}, ['f1','f2'], []) -(set(['f1/fc1']), {}) +(set(['f1/fc1']), {}, []) >>> restrictpatterns({'f1_fc1'}, {}, ['f1','f2'], []) -([], set(['path:.'])) +([], set(['path:.']), []) >>> restrictpatterns({'f1/../f2/fc2'}, {}, ['f1','f2'], []) -(set(['f2/fc2']), {}) +(set(['f2/fc2']), {}, []) >>> restrictpatterns({'f1/../f3/fc3'}, {}, ['f1','f2'], []) -([], set(['path:.'])) +([], set(['path:.']), []) >>> restrictpatterns({'f1/$non_exitent_var'}, {}, ['f1','f2'], []) -(set(['f1/$non_exitent_var']), {}) +(set(['f1/$non_exitent_var']), {}, []) """ res_excludes = set(req_excludes) res_excludes.update(repo_excludes) +invalid_includes = [] if not req_includes: res_includes = set(repo_includes) elif 'path:.' not in repo_includes: @@ -197,12 +196,12 @@ valid = True res_includes.append(req_include) break -if not valid and invalid_includes is not None: +if not valid: invalid_includes.append(req_include) if len(res_includes) == 0: res_excludes = {'path:.'} else: res_includes = set(res_includes) else: res_includes = set(req_includes) -return res_includes, res_excludes +return res_includes, res_excludes, invalid_includes diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -134,7 +134,7 @@ repo_includes, repo_excludes = repo.narrowpats includes = set(opts.get('include', [])) excludes = set(opts.get('exclude', [])) -includes, excludes = narrowspec.restrictpatterns( +includes, excludes, unused_invalid = narrowspec.restrictpatterns( includes, excludes, repo_includes, repo_excludes) if includes: opts['include'] = includes diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -346,10 +346,8 @@ req_includes = set(kwargs.get('includepats', [])) req_excludes = set(kwargs.get('excludepats', [])) -invalid_includes = [] -req_includes, req_excludes = narrowspec.restrictpatterns( -req_includes, req_excludes, -user_includes, user_excludes, invalid_includes) +req_includes, req_excludes, invalid_includes = narrowspec.restrictpatterns( +req_includes, req_excludes, user_includes, user_excludes) if invalid_includes: raise error.Abort( To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2184: narrowrepo: add docstring for narrowpats
This revision was automatically updated to reflect the committed changes. Closed by commit rHG879da36e7644: narrowrepo: add docstring for narrowpats (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2184?vs=5500&id=5554 REVISION DETAIL https://phab.mercurial-scm.org/D2184 AFFECTED FILES hgext/narrow/narrowrepo.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py --- a/hgext/narrow/narrowrepo.py +++ b/hgext/narrow/narrowrepo.py @@ -75,6 +75,10 @@ @localrepo.repofilecache(narrowspec.FILENAME) def narrowpats(self): +"""matcher patterns for this repository's narrowspec + +A tuple of (includes, excludes). +""" return narrowspec.load(self) @localrepo.repofilecache(narrowspec.FILENAME) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2188: narrowrevlog: add what little I can remember about rename filtering
This revision was automatically updated to reflect the committed changes. Closed by commit rHG48b592d986e7: narrowrevlog: add what little I can remember about rename filtering (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2188?vs=5518&id=5558 REVISION DETAIL https://phab.mercurial-scm.org/D2188 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -139,6 +139,12 @@ def makenarrowfilelog(fl, narrowmatch): class narrowfilelog(fl.__class__): def renamed(self, node): +# Renames that come from outside the narrowspec are +# problematic at least for git-diffs, because we lack the +# base text for the rename. This logic was introduced in +# 3cd72b1 of narrowhg (authored by martinvonz, reviewed by +# adgar), but that revision doesn't have any additional +# commentary on what problems we can encounter. m = super(narrowfilelog, self).renamed(node) if m and not narrowmatch(m[0]): return None To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2004: narrowbundle2: make constants ALLCAPS to be a bit more readable
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbc01f48c18cc: narrowbundle2: make constants ALLCAPS to be a bit more readable (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2004?vs=5154&id=5548 REVISION DETAIL https://phab.mercurial-scm.org/D2004 AFFECTED FILES hgext/narrow/narrowbundle2.py hgext/narrow/narrowcommands.py CHANGE DETAILS diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -147,7 +147,7 @@ if narrowrepo.requirement not in repo.requirements: return orig(pullop, kwargs) -if narrowbundle2.narrowcap not in pullop.remotebundle2caps: +if narrowbundle2.NARROWCAP not in pullop.remotebundle2caps: raise error.Abort(_("server doesn't support narrow clones")) orig(pullop, kwargs) kwargs['narrow'] = True diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -34,23 +34,23 @@ narrowspec, ) -narrowcap = 'narrow' -narrowacl_section = 'narrowhgacl' -changespecpart = narrowcap + ':changespec' -specpart = narrowcap + ':spec' -specpart_include = 'include' -specpart_exclude = 'exclude' -killnodesignal = 'KILL' -donesignal = 'DONE' -elidedcsheader = '>20s20s20sl' # cset id, p1, p2, len(text) -elidedmfheader = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) -csheadersize = struct.calcsize(elidedcsheader) -mfheadersize = struct.calcsize(elidedmfheader) +NARROWCAP = 'narrow' +NARROWACL_SECTION = 'narrowhgacl' +CHANGESPECPART = NARROWCAP + ':changespec' +SPECPART = NARROWCAP + ':spec' +SPECPART_INCLUDE = 'include' +SPECPART_EXCLUDE = 'exclude' +KILLNODESIGNAL = 'KILL' +DONESIGNAL = 'DONE' +ELIDEDCSHEADER = '>20s20s20sl' # cset id, p1, p2, len(text) +ELIDEDMFHEADER = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) +CSHEADERSIZE = struct.calcsize(ELIDEDCSHEADER) +MFHEADERSIZE = struct.calcsize(ELIDEDMFHEADER) # When advertising capabilities, always include narrow clone support. def getrepocaps_narrow(orig, repo, **kwargs): caps = orig(repo, **kwargs) -caps[narrowcap] = ['v0'] +caps[NARROWCAP] = ['v0'] return caps def _computeellipsis(repo, common, heads, known, match, depth=None): @@ -250,13 +250,13 @@ part.addparam('treemanifest', '1') if include or exclude: -narrowspecpart = bundler.newpart(specpart) +narrowspecpart = bundler.newpart(SPECPART) if include: narrowspecpart.addparam( -specpart_include, '\n'.join(include), mandatory=True) +SPECPART_INCLUDE, '\n'.join(include), mandatory=True) if exclude: narrowspecpart.addparam( -specpart_exclude, '\n'.join(exclude), mandatory=True) +SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) return @@ -298,10 +298,10 @@ deadrevs = known def genkills(): for r in deadrevs: -yield killnodesignal +yield KILLNODESIGNAL yield repo.changelog.node(r) -yield donesignal -bundler.newpart(changespecpart, data=genkills()) +yield DONESIGNAL +bundler.newpart(CHANGESPECPART, data=genkills()) newvisit, newfull, newellipsis = _computeellipsis( repo, set(), common, known, newmatch) if newvisit: @@ -329,14 +329,14 @@ def applyacl_narrow(repo, kwargs): username = repo.ui.shortuser(repo.ui.username()) user_includes = repo.ui.configlist( -narrowacl_section, username + '.includes', -repo.ui.configlist(narrowacl_section, 'default.includes')) +NARROWACL_SECTION, username + '.includes', +repo.ui.configlist(NARROWACL_SECTION, 'default.includes')) user_excludes = repo.ui.configlist( -narrowacl_section, username + '.excludes', -repo.ui.configlist(narrowacl_section, 'default.excludes')) +NARROWACL_SECTION, username + '.excludes', +repo.ui.configlist(NARROWACL_SECTION, 'default.excludes')) if not user_includes: raise error.Abort(_("{} configuration for user {} is empty") - .format(narrowacl_section, username)) + .format(NARROWACL_SECTION, username)) user_includes = [ 'path:.' if p == '*' else 'path:' + p for p in user_includes] @@ -363,17 +363,17 @@ new_args['excludepats'] = req_excludes return new_args -@bundle2.parthandler(specpart, (specpart_include, specpart_exclude)) +@bundle2.parthandler(SPECPART, (SPECPART_INCLUDE, SPECPART_EXCLUDE)) def _handlechangespec_2(op, inpart): -includepats = set(inpart.params.get(specpart_include, '').splitlines()) -excludepa
D2008: narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9445a3141501: narrow: move from ELLIPSIS_NODE_FLAG to revlog.REVIDX_ELLIPSIS (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2008?vs=5513&id=5552 REVISION DETAIL https://phab.mercurial-scm.org/D2008 AFFECTED FILES hgext/narrow/narrowchangegroup.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowtemplates.py CHANGE DETAILS diff --git a/hgext/narrow/narrowtemplates.py b/hgext/narrow/narrowtemplates.py --- a/hgext/narrow/narrowtemplates.py +++ b/hgext/narrow/narrowtemplates.py @@ -8,15 +8,14 @@ from __future__ import absolute_import from mercurial import ( +revlog, revset, templatekw, util, ) -from . import narrowrevlog - def _isellipsis(repo, rev): -if repo.changelog.flags(rev) & narrowrevlog.ELLIPSIS_NODE_FLAG: +if repo.changelog.flags(rev) & revlog.REVIDX_ELLIPSIS: return True return False diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -13,11 +13,6 @@ util, ) -ELLIPSIS_NODE_FLAG = 1 << 14 -revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG -if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER: -revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) - def readtransform(self, text): return text, False @@ -27,7 +22,7 @@ def rawtransform(self, text): return False -revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, +revlog.addflagprocessor(revlog.REVIDX_ELLIPSIS, (readtransform, writetransform, rawtransform)) def setup(): diff --git a/hgext/narrow/narrowchangegroup.py b/hgext/narrow/narrowchangegroup.py --- a/hgext/narrow/narrowchangegroup.py +++ b/hgext/narrow/narrowchangegroup.py @@ -15,12 +15,12 @@ manifest, mdiff, node, +revlog, util, ) from . import ( narrowrepo, -narrowrevlog, ) def setup(): @@ -83,11 +83,11 @@ extensions.wrapfunction( changegroup.cg1packer, 'generatefiles', generatefiles) -def ellipsisdata(packer, rev, revlog, p1, p2, data, linknode): -n = revlog.node(rev) -p1n, p2n = revlog.node(p1), revlog.node(p2) -flags = revlog.flags(rev) -flags |= narrowrevlog.ELLIPSIS_NODE_FLAG +def ellipsisdata(packer, rev, revlog_, p1, p2, data, linknode): +n = revlog_.node(rev) +p1n, p2n = revlog_.node(p1), revlog_.node(p2) +flags = revlog_.flags(rev) +flags |= revlog.REVIDX_ELLIPSIS meta = packer.builddeltaheader( n, p1n, p2n, node.nullid, linknode, flags) # TODO: try and actually send deltas for ellipsis data blocks To: durin42, indygreg, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2005: narrowbundle2: mark most constants as module-private
This revision was automatically updated to reflect the committed changes. Closed by commit rHG844f253dad5e: narrowbundle2: mark most constants as module-private (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2005?vs=5155&id=5549 REVISION DETAIL https://phab.mercurial-scm.org/D2005 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -35,17 +35,17 @@ ) NARROWCAP = 'narrow' -NARROWACL_SECTION = 'narrowhgacl' -CHANGESPECPART = NARROWCAP + ':changespec' -SPECPART = NARROWCAP + ':spec' -SPECPART_INCLUDE = 'include' -SPECPART_EXCLUDE = 'exclude' -KILLNODESIGNAL = 'KILL' -DONESIGNAL = 'DONE' -ELIDEDCSHEADER = '>20s20s20sl' # cset id, p1, p2, len(text) -ELIDEDMFHEADER = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) -CSHEADERSIZE = struct.calcsize(ELIDEDCSHEADER) -MFHEADERSIZE = struct.calcsize(ELIDEDMFHEADER) +_NARROWACL_SECTION = 'narrowhgacl' +_CHANGESPECPART = NARROWCAP + ':changespec' +_SPECPART = NARROWCAP + ':spec' +_SPECPART_INCLUDE = 'include' +_SPECPART_EXCLUDE = 'exclude' +_KILLNODESIGNAL = 'KILL' +_DONESIGNAL = 'DONE' +_ELIDEDCSHEADER = '>20s20s20sl' # cset id, p1, p2, len(text) +_ELIDEDMFHEADER = '>20s20s20s20sl' # manifest id, p1, p2, link id, len(text) +_CSHEADERSIZE = struct.calcsize(_ELIDEDCSHEADER) +_MFHEADERSIZE = struct.calcsize(_ELIDEDMFHEADER) # When advertising capabilities, always include narrow clone support. def getrepocaps_narrow(orig, repo, **kwargs): @@ -250,13 +250,13 @@ part.addparam('treemanifest', '1') if include or exclude: -narrowspecpart = bundler.newpart(SPECPART) +narrowspecpart = bundler.newpart(_SPECPART) if include: narrowspecpart.addparam( -SPECPART_INCLUDE, '\n'.join(include), mandatory=True) +_SPECPART_INCLUDE, '\n'.join(include), mandatory=True) if exclude: narrowspecpart.addparam( -SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) +_SPECPART_EXCLUDE, '\n'.join(exclude), mandatory=True) return @@ -298,10 +298,10 @@ deadrevs = known def genkills(): for r in deadrevs: -yield KILLNODESIGNAL +yield _KILLNODESIGNAL yield repo.changelog.node(r) -yield DONESIGNAL -bundler.newpart(CHANGESPECPART, data=genkills()) +yield _DONESIGNAL +bundler.newpart(_CHANGESPECPART, data=genkills()) newvisit, newfull, newellipsis = _computeellipsis( repo, set(), common, known, newmatch) if newvisit: @@ -329,14 +329,14 @@ def applyacl_narrow(repo, kwargs): username = repo.ui.shortuser(repo.ui.username()) user_includes = repo.ui.configlist( -NARROWACL_SECTION, username + '.includes', -repo.ui.configlist(NARROWACL_SECTION, 'default.includes')) +_NARROWACL_SECTION, username + '.includes', +repo.ui.configlist(_NARROWACL_SECTION, 'default.includes')) user_excludes = repo.ui.configlist( -NARROWACL_SECTION, username + '.excludes', -repo.ui.configlist(NARROWACL_SECTION, 'default.excludes')) +_NARROWACL_SECTION, username + '.excludes', +repo.ui.configlist(_NARROWACL_SECTION, 'default.excludes')) if not user_includes: raise error.Abort(_("{} configuration for user {} is empty") - .format(NARROWACL_SECTION, username)) + .format(_NARROWACL_SECTION, username)) user_includes = [ 'path:.' if p == '*' else 'path:' + p for p in user_includes] @@ -363,17 +363,17 @@ new_args['excludepats'] = req_excludes return new_args -@bundle2.parthandler(SPECPART, (SPECPART_INCLUDE, SPECPART_EXCLUDE)) +@bundle2.parthandler(_SPECPART, (_SPECPART_INCLUDE, _SPECPART_EXCLUDE)) def _handlechangespec_2(op, inpart): -includepats = set(inpart.params.get(SPECPART_INCLUDE, '').splitlines()) -excludepats = set(inpart.params.get(SPECPART_EXCLUDE, '').splitlines()) +includepats = set(inpart.params.get(_SPECPART_INCLUDE, '').splitlines()) +excludepats = set(inpart.params.get(_SPECPART_EXCLUDE, '').splitlines()) narrowspec.save(op.repo, includepats, excludepats) if not narrowrepo.requirement in op.repo.requirements: op.repo.requirements.add(narrowrepo.requirement) op.repo._writerequirements() op.repo.invalidate(clearfilecache=True) -@bundle2.parthandler(CHANGESPECPART) +@bundle2.parthandler(_CHANGESPECPART) def _handlechangespec(op, inpart): repo = op.repo cl = repo.changelog @@ -388,8 +388,8 @@ # repo. All the changes that this block encounters are ellipsis # nodes or flags to kill an ex
D1980: narrow: remove old version-checking logic and declare internal
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4b843cb6eb8c: narrow: remove old version-checking logic and declare internal (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1980?vs=5101&id=5547 REVISION DETAIL https://phab.mercurial-scm.org/D1980 AFFECTED FILES hgext/narrow/__init__.py CHANGE DETAILS diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -8,16 +8,11 @@ from __future__ import absolute_import -from mercurial import __version__ -if __version__.version < '3.7': -raise ImportError( -'narrowhg requires mercurial 3.7 or newer') - -try: -from .__versionnum__ import version -__version__ = version -except ImportError: -pass +# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for +# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should +# be specifying the version(s) of Mercurial they are tested with, or +# leave the attribute unspecified. +testedwith = 'ships-with-hg-core' from mercurial import ( extensions, To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1977: narrow: this code should assume REVIDX_FLAGS_ORDER exists
This revision was automatically updated to reflect the committed changes. Closed by commit rHGadc8e1fe2f46: narrow: this code should assume REVIDX_FLAGS_ORDER exists (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1977?vs=5098&id=5544 REVISION DETAIL https://phab.mercurial-scm.org/D1977 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -15,9 +15,8 @@ ELLIPSIS_NODE_FLAG = 1 << 14 revlog.REVIDX_KNOWN_FLAGS |= ELLIPSIS_NODE_FLAG -if (util.safehasattr(revlog, 'REVIDX_FLAGS_ORDER') and -ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER): -revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) +if ELLIPSIS_NODE_FLAG not in revlog.REVIDX_FLAGS_ORDER: +revlog.REVIDX_FLAGS_ORDER.append(ELLIPSIS_NODE_FLAG) def readtransform(self, text): return text, False To: durin42, #hg-reviewers, martinvonz, indygreg Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1976: narrow: drop legacy support for getsubsetraw
This revision was automatically updated to reflect the committed changes. Closed by commit rHG48c12b440b4a: narrow: drop legacy support for getsubsetraw (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1976?vs=5097&id=5543 REVISION DETAIL https://phab.mercurial-scm.org/D1976 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -237,20 +237,13 @@ outgoing = exchange._computeoutgoing(repo, heads, common) if not outgoing.missing: return -if util.safehasattr(changegroup, 'getsubsetraw'): -# getsubsetraw was replaced with makestream in hg in 92f1e2be8ab6 -# (2017/09/10). -packer = changegroup.getbundler(version, repo) -packer._narrow_matcher = lambda : newmatch -cg = changegroup.getsubsetraw(repo, outgoing, packer, source) -else: -def wrappedgetbundler(orig, *args, **kwargs): -bundler = orig(*args, **kwargs) -bundler._narrow_matcher = lambda : newmatch -return bundler -with extensions.wrappedfunction(changegroup, 'getbundler', -wrappedgetbundler): -cg = changegroup.makestream(repo, outgoing, version, source) +def wrappedgetbundler(orig, *args, **kwargs): +bundler = orig(*args, **kwargs) +bundler._narrow_matcher = lambda : newmatch +return bundler +with extensions.wrappedfunction(changegroup, 'getbundler', +wrappedgetbundler): +cg = changegroup.makestream(repo, outgoing, version, source) part = bundler.newpart('changegroup', data=cg) part.addparam('version', version) if 'treemanifest' in repo.requirements: To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1978: narrow: assume addflagprocessor will always exist on revlog module
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9772ef9f6c04: narrow: assume addflagprocessor will always exist on revlog module (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1978?vs=5099&id=5545 REVISION DETAIL https://phab.mercurial-scm.org/D1978 AFFECTED FILES hgext/narrow/narrowrevlog.py CHANGE DETAILS diff --git a/hgext/narrow/narrowrevlog.py b/hgext/narrow/narrowrevlog.py --- a/hgext/narrow/narrowrevlog.py +++ b/hgext/narrow/narrowrevlog.py @@ -27,9 +27,8 @@ def rawtransform(self, text): return False -if util.safehasattr(revlog, 'addflagprocessor'): -revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, -(readtransform, writetransform, rawtransform)) +revlog.addflagprocessor(ELLIPSIS_NODE_FLAG, +(readtransform, writetransform, rawtransform)) def setup(): # We just wanted to add the flag processor, which is done at module To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1975: narrow: remove support for old match modules
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9dc28d8ea61e: narrow: remove support for old match modules (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1975?vs=5096&id=5542 REVISION DETAIL https://phab.mercurial-scm.org/D1975 AFFECTED FILES hgext/narrow/__init__.py CHANGE DETAILS diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py --- a/hgext/narrow/__init__.py +++ b/hgext/narrow/__init__.py @@ -24,7 +24,6 @@ hg, localrepo, registrar, -util, verify as verifymod, ) @@ -85,15 +84,6 @@ narrowpatch.setup(repo) narrowwirepeer.reposetup(repo) -def _narrowvalidpath(orig, repo, path): -matcher = getattr(repo, 'narrowmatch', None) -if matcher is None: -return orig(repo, path) -matcher = matcher() -if matcher.visitdir(path) or matcher(path): -return orig(repo, path) -return False - def _verifierinit(orig, self, repo, matcher=None): # The verifier's matcher argument was desgined for narrowhg, so it should # be None from core. If another extension passes a matcher (unlikely), @@ -103,9 +93,6 @@ orig(self, repo, matcher) def extsetup(ui): -if util.safehasattr(verifymod, '_validpath'): -extensions.wrapfunction(verifymod, '_validpath', _narrowvalidpath) -else: -extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) +extensions.wrapfunction(verifymod.verifier, '__init__', _verifierinit) extensions.wrapfunction(hg, 'postshare', narrowrepo.wrappostshare) extensions.wrapfunction(hg, 'copystore', narrowrepo.unsharenarrowspec) To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1974: narrow: import experimental extension from narrowhg revision cb51d673e9c5
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa2a6e724d61a: narrow: import experimental extension from narrowhg revision cb51d673e9c5 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1974?vs=5498&id=5541 REVISION DETAIL https://phab.mercurial-scm.org/D1974 AFFECTED FILES hgext/narrow/__init__.py hgext/narrow/narrowbundle2.py hgext/narrow/narrowchangegroup.py hgext/narrow/narrowcommands.py hgext/narrow/narrowcopies.py hgext/narrow/narrowdirstate.py hgext/narrow/narrowmerge.py hgext/narrow/narrowpatch.py hgext/narrow/narrowrepo.py hgext/narrow/narrowrevlog.py hgext/narrow/narrowspec.py hgext/narrow/narrowtemplates.py hgext/narrow/narrowwirepeer.py setup.py tests/narrow-library.sh tests/test-help.t tests/test-narrow-acl.t tests/test-narrow-archive.t tests/test-narrow-clone-no-ellipsis.t tests/test-narrow-clone-non-narrow-server.t tests/test-narrow-clone-nonlinear.t tests/test-narrow-clone.t tests/test-narrow-commit-tree.t tests/test-narrow-commit.t tests/test-narrow-copies.t tests/test-narrow-debugcommands.t tests/test-narrow-debugrebuilddirstate.t tests/test-narrow-exchange-merges.t tests/test-narrow-exchange.t tests/test-narrow-expanddirstate.t tests/test-narrow-merge-tree.t tests/test-narrow-merge.t tests/test-narrow-patch-tree.t tests/test-narrow-patch.t tests/test-narrow-patterns.t tests/test-narrow-pull.t tests/test-narrow-rebase.t tests/test-narrow-shallow-merges.t tests/test-narrow-shallow.t tests/test-narrow-strip-tree.t tests/test-narrow-strip.t tests/test-narrow-tree.t tests/test-narrow-update.t tests/test-narrow-widen-tree.t tests/test-narrow-widen.t tests/test-narrow.t To: durin42, #hg-reviewers, indygreg Cc: idlsoft, martinvonz, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] buildrpm: bump bundled python version to 2.7.14 when building for centos{5, 6}
# HG changeset patch # User Antonio Muci # Date 1518476376 -3600 # Mon Feb 12 23:59:36 2018 +0100 # Node ID ae4209858d434d88428c03d3b1be3ec662907ec2 # Parent b62c4154bb287fe0f4c15cdb0d2ef290069288df buildrpm: bump bundled python version to 2.7.14 when building for centos{5,6} when building rpm packages for centos 5 and 6, we bundle a mercurial-specific version of python 2.7 in /opt/python-hg Let's bump the embedded python version from 2.7.10 (released in 2015) to 2.7.14 (latest as of today) diff --git a/contrib/Makefile.python b/contrib/Makefile.python --- a/contrib/Makefile.python +++ b/contrib/Makefile.python @@ -1,4 +1,4 @@ -PYTHONVER=2.7.10 +PYTHONVER=2.7.14 PYTHONNAME=python- PREFIX=$(HOME)/bin/prefix-$(PYTHONNAME)$(PYTHONVER) SYMLINKDIR=$(HOME)/bin diff --git a/contrib/buildrpm b/contrib/buildrpm --- a/contrib/buildrpm +++ b/contrib/buildrpm @@ -20,8 +20,8 @@ while [ "$1" ]; do ;; --withpython | --with-python) shift -PYTHONVER=2.7.10 -PYTHONMD5=d7547558fd673bd9d38e2108c6b42521 +PYTHONVER=2.7.14 +PYTHONMD5=cee2e4b33ad3750da77b2e85f2f8b724 ;; --rpmbuilddir ) shift ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] buildrpm: bump bundled docutils version to 0.14 when building for centos{5, 6}
# HG changeset patch # User Antonio Muci # Date 1518476745 -3600 # Tue Feb 13 00:05:45 2018 +0100 # Node ID ca93ec462371f185bd737f27fbae73fcca5ad5fa # Parent ae4209858d434d88428c03d3b1be3ec662907ec2 buildrpm: bump bundled docutils version to 0.14 when building for centos{5,6} when building rpm packages for centos 5 and 6, we bundle a mercurial-specific version of docutils in /opt/python-hg/lib/python2.7/site-packages/docutils Let's bump the embedded docutils version from 0.12 (released in 2014) to 0.14 (latest as of today) diff --git a/contrib/mercurial.spec b/contrib/mercurial.spec --- a/contrib/mercurial.spec +++ b/contrib/mercurial.spec @@ -6,8 +6,8 @@ %global pythonver %{withpython} %global pythonname Python-%{withpython} -%global docutilsname docutils-0.12 -%global docutilsmd5 4622263b62c5c771c03502afa3157768 +%global docutilsname docutils-0.14 +%global docutilsmd5 c53768d63db3873b7d452833553469de %global pythonhg python-hg %global hgpyprefix /opt/%{pythonhg} # byte compilation will fail on some some Python /test/ files ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1974: narrow: import experimental extension from narrowhg revision cb51d673e9c5
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. I think I've seen enough follow-ups to feel comfortable taking this in core. There's still a ton of work that needs to get done. But it will be easier to iterate and for others to get involved when the code is committed than when it is sitting around in review. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1974 To: durin42, #hg-reviewers, indygreg Cc: idlsoft, martinvonz, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel