D5922: largefiles: get cwd and relative paths from repo instead of matcher
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As far as I can tell, the matcher returned from matchandpats() got its cwd from the context object, which in turn got it from the repo, so this should be equivalent. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5922 AFFECTED FILES hgext/largefiles/overrides.py CHANGE DETAILS diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -301,9 +301,10 @@ return kindpat[0] + ':' + tostandin(kindpat[1]) return tostandin(kindpat[1]) -if m._cwd: +cwd = repo.getcwd() +if cwd: hglf = lfutil.shortname -back = util.pconvert(m.rel(hglf)[:-len(hglf)]) +back = util.pconvert(repo.pathto(hglf)[:-len(hglf)]) def tostandin(f): # The file may already be a standin, so truncate the back @@ -316,10 +317,10 @@ # path to the root before building the standin. Otherwise cwd # is somewhere in the repo, relative to root, and needs to be # prepended before building the standin. -if os.path.isabs(m._cwd): +if os.path.isabs(cwd): f = f[len(back):] else: -f = m._cwd + '/' + f +f = cwd + '/' + f return back + lfutil.standin(f) else: def tostandin(f): To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5921: scmutil: remove special handling of pats==("", ) in matchandpats() (API)
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I don't know under what circumstances we used to pass that value, but we don't seem to do it now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5921 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -795,8 +795,6 @@ '''Return a matcher and the patterns that were used. The matcher will warn about bad matches, unless an alternate badfn callback is provided.''' -if pats == ("",): -pats = [] if opts is None: opts = {} if not globbed and default == 'relpath': To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5896: diff: make --stat respect ui.relative-paths
martinvonz updated this revision to Diff 14001. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5896?vs=13910=14001 REVISION DETAIL https://phab.mercurial-scm.org/D5896 AFFECTED FILES mercurial/logcmdutil.py tests/test-diffstat.t CHANGE DETAILS diff --git a/tests/test-diffstat.t b/tests/test-diffstat.t --- a/tests/test-diffstat.t +++ b/tests/test-diffstat.t @@ -146,10 +146,21 @@ $ hg diff --stat . dir1/new | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) + $ hg diff --stat . --config ui.relative-paths=yes + new | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) $ hg diff --stat --root . new | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) + $ hg diff --stat --root . --config ui.relative-paths=yes + new | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) +--root trumps ui.relative-paths + $ hg diff --stat --root .. --config ui.relative-paths=yes + new | 1 + + ../dir2/new | 1 + + 2 files changed, 2 insertions(+), 0 deletions(-) $ hg diff --stat --root ../dir1 ../dir2 warning: ../dir2 not inside relative root . diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -99,6 +99,9 @@ width = 80 if not ui.plain(): width = ui.termwidth() - graphwidth +# If an explicit --root was given, don't respect ui.relative-paths +if not relroot: +pathfn = compose(scmutil.getuipathfn(repo), pathfn) chunks = ctx2.diff(ctx1, match, changes, opts=diffopts, pathfn=pathfn, copysourcematch=copysourcematch, To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5896: diff: make --stat respect ui.relative-paths
martinvonz added a comment. In https://phab.mercurial-scm.org/D5896#86559, @yuja wrote: > > It would have been easy to make all diffs respect ui.relative-paths, > > but we don't want that since it makes the diff invalid. Perhaps it > > makes sense to do that with --noprefix since the point of that is to > > make paths that are easy to copy, and the diff is already > > invalid anyway. But this patch just makes the --stat version respect > > the config option. The --stat view is not even close to a valid diff, > > so I think it makes sense to show the paths in more human-friendly > > form. > > Seems fine, but I'm not sure about the Windows behavior: > > - Do we want to see backslash paths on Windows? I would assume that we want that. > - Backslash paths are parsed correctly? Good question! Some simple testing I just did suggests that it does work. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5896 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5907: copy: respect ui.relative-paths in copy/rename
martinvonz added a comment. In https://phab.mercurial-scm.org/D5907#86561, @yuja wrote: > > - a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -51,8 +51,10 @@ ) > > > > if pycompat.iswindows: +from . import windows as platform from . import scmwindows as scmplatform else: +from . import posix as platform from . import scmposix as scmplatform > > It's `util.localpath()`. > > > @@ -757,7 +759,7 @@ > > > > pathto = repo.pathto > > return lambda f: pathto(f, cwd) > > else: > > > > - return lambda f: f +return platform.localpath > > I've removed this since it seemed unrelated to this specific patch. That was just something I was experimenting with and must have accidentally amended in. Thanks for fixing! > It might > break some Windows tests, but it should already be broken since https://phab.mercurial-scm.org/rHGa997163e7fae2fe933f8d0c6d1013205befd1ee4. > Some (or all?) `uipathfn()`s have to respect `ui.slash` config on Windows. Did that commit change any behavior on Windows? I was trying to figure out where the conversion to Windows paths was done and thought it seemed like it was mostly just done in `util.pathto()`, so e.g. `m.rel()` would use backslashes and `m.abs()` would use slashes. (I just learned that there is a deprecated ui.slash config too, but that doesn't seem to change much.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5907 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
navaneeth.suresh updated this revision to Diff 14000. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5813?vs=13899=14000 REVISION DETAIL https://phab.mercurial-scm.org/D5813 AFFECTED FILES mercurial/revset.py tests/test-revset.t CHANGE DETAILS diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -2950,3 +2950,45 @@ * set: 0 + +abort if the revset doesn't expect given size + $ log 'expectsize()' + hg: parse error: invalid set of arguments + [255] + $ log 'expectsize(0:2, a)' + hg: parse error: expectsize requires a size range or a positive integer + [255] + $ log 'expectsize(0:2, 3)' + 0 + 1 + 2 + + $ log 'expectsize(2:0, 3)' + 2 + 1 + 0 + $ log 'expectsize(0:1, 1)' + abort: revset size mismatch. expected 1, got 2! + [255] + $ log 'expectsize(0:4, -1)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, 2:4)' + 0 + 1 + 2 + $ log 'expectsize(0:1, 3:5)' + abort: revset size mismatch. expected between 3 and 5, got 2! + [255] + $ log 'expectsize(0:1, -1:2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:1, 1:-2)' + hg: parse error: negative size + [255] + $ log 'expectsize(0:2, a:4)' + hg: parse error: size range bounds must be integers + [255] + $ log 'expectsize(0:2, 2:b)' + hg: parse error: size range bounds must be integers + [255] diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -815,6 +815,38 @@ contentdivergent = obsmod.getrevs(repo, 'contentdivergent') return subset & contentdivergent +@predicate('expectsize(set[, size])', safe=True, takeorder=True) +def expectrevsetsize(repo, subset, x, order): +"""Abort if the revset doesn't expect given size""" +args = getargsdict(x, 'expect', 'set size') +size = args.get('size') +minsize = None +maxsize = None +err = '' +if size is not None: +minsize, maxsize = getintrange(size, + _('expectsize requires a size range' + ' or a positive integer'), + _('size range bounds must be integers')) +if minsize < 0 or maxsize < 0: +raise error.ParseError(_('negative size')) +if size is None or 'set' not in args: +raise error.ParseError(_('invalid set of arguments')) +rev = getset(repo, fullreposet(repo), args['set'], order=order) +if minsize != maxsize and (len(rev) < minsize or len(rev) > maxsize): +err = _('revset size mismatch.' +' expected between %d and %d, got %d') % (minsize, maxsize, + len(rev)) +elif minsize == maxsize and len(rev) != minsize: +err = _('revset size mismatch.' +' expected %d, got %d') % (minsize, len(rev)) +if err: +raise error.RepoLookupError(err) +if order == followorder: +return subset & rev +else: +return rev & subset + @predicate('extdata(source)', safe=False, weight=100) def extdata(repo, subset, x): """Changesets in the specified extdata source. (EXPERIMENTAL)""" To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5514: test: change test's diff generation to use mdiff for nicer output
sangeet259 updated this revision to Diff 13998. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5514?vs=13123=13998 REVISION DETAIL https://phab.mercurial-scm.org/D5514 AFFECTED FILES mercurial/mdiff.py tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -47,6 +47,7 @@ import argparse import collections +import datetime import difflib import distutils.version as version import errno @@ -68,6 +69,18 @@ import uuid import xml.dom.minidom as minidom +_unified_diff = difflib.unified_diff +if PYTHON3: +import functools +_unified_diff = functools.partial(difflib.diff_bytes, difflib.unified_diff) + +try: +from mercurial import mdiff, patch +_diff = mdiff.new_diff +except except (ImportError, AttributeError): +print("Falling back to unified_diff") +_diff = _unified_diff + try: import Queue as queue except ImportError: @@ -598,15 +611,10 @@ except OSError: pass -_unified_diff = difflib.unified_diff -if PYTHON3: -import functools -_unified_diff = functools.partial(difflib.diff_bytes, difflib.unified_diff) - def getdiff(expected, output, ref, err): servefail = False lines = [] -for line in _unified_diff(expected, output, ref, err): +for line in _diff(expected, output, ref, err): if line.startswith(b'+++') or line.startswith(b'---'): line = line.replace(b'\\', b'/') if line.endswith(b' \n'): diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -7,6 +7,8 @@ from __future__ import absolute_import +import datetime +import itertools import re import struct import zlib @@ -525,3 +527,37 @@ def replacediffheader(oldlen, newlen): return struct.pack(">lll", 0, oldlen, newlen) + +def prepare_mdiff(expected, output): +"""Prepare the inputs for the mdiff.unidiff function""" +date1 = datetime.datetime.now().strftime("%a %b %d %y %H:%M:%S %Y %z") +date2 = date1 +# join all the different elements into a single string +# to regenerate that file +exp = "".join(expected) +out = "".join(output) +opts = diffopts(noprefix=True) +return exp, date1, out, date2, opts + +def process_mdiff(uheaders, hunks): +"""Process the output of mdiff into a list of lines, +to be used by getdiff""" +# the hunklines are in the hunks generator +# get the hunklines from the (hunkrange,hunklines) tuple +hunklines = [x[1] for x in hunks] +# extract and insert the headers at the beginnng of the hunklines list +headers = [uheaders[0].split("\t")[0]+"\n", uheaders[1].split("\t")[0]+"\n"] +hunklines.insert(0, headers) +difflines = itertools.chain.from_iterable(hunklines) +return difflines + +def new_diff(expected, output, ref, err): +""" +The API of new_diff is designed to be same as difflib.unified_diff. +This is done for backwards compatibility and resuing existing code. +""" +exp, date1, out, date2, opts = prepare_mdiff(expected, output) +uheaders, hunks = unidiff(exp, date1, out, date2, +ref, err, binary=False, opts=opts) +difflines = process_mdiff(uheaders, hunks) +return difflines To: sangeet259, #hg-reviewers, durin42 Cc: pulkit, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5907: copy: respect ui.relative-paths in copy/rename
yuja added a comment. > - a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -51,8 +51,10 @@ ) > > if pycompat.iswindows: +from . import windows as platform from . import scmwindows as scmplatform else: +from . import posix as platform from . import scmposix as scmplatform It's `util.localpath()`. > @@ -757,7 +759,7 @@ > > pathto = repo.pathto > return lambda f: pathto(f, cwd) > else: > > - return lambda f: f +return platform.localpath I've removed this since it seemed unrelated to this specific patch. It might break some Windows tests, but it should already be broken since https://phab.mercurial-scm.org/rHGa997163e7fae2fe933f8d0c6d1013205befd1ee4. Some (or all?) `uipathfn()`s have to respect `ui.slash` config on Windows. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5907 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5907: copy: respect ui.relative-paths in copy/rename
> --- a/mercurial/scmutil.py > +++ b/mercurial/scmutil.py > @@ -51,8 +51,10 @@ > ) > > if pycompat.iswindows: > +from . import windows as platform > from . import scmwindows as scmplatform > else: > +from . import posix as platform > from . import scmposix as scmplatform It's `util.localpath()`. > @@ -757,7 +759,7 @@ > pathto = repo.pathto > return lambda f: pathto(f, cwd) > else: > -return lambda f: f > +return platform.localpath I've removed this since it seemed unrelated to this specific patch. It might break some Windows tests, but it should already be broken since a997163e7fae. Some (or all?) `uipathfn()`s have to respect `ui.slash` config on Windows. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5896: diff: make --stat respect ui.relative-paths
yuja added a comment. > It would have been easy to make all diffs respect ui.relative-paths, > but we don't want that since it makes the diff invalid. Perhaps it > makes sense to do that with --noprefix since the point of that is to > make paths that are easy to copy, and the diff is already > invalid anyway. But this patch just makes the --stat version respect > the config option. The --stat view is not even close to a valid diff, > so I think it makes sense to show the paths in more human-friendly > form. Seems fine, but I'm not sure about the Windows behavior: - Do we want to see backslash paths on Windows? - Backslash paths are parsed correctly? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5896 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5896: diff: make --stat respect ui.relative-paths
> It would have been easy to make all diffs respect ui.relative-paths, > but we don't want that since it makes the diff invalid. Perhaps it > makes sense to do that with --noprefix since the point of that is to > make paths that are easy to copy, and the diff is already > invalid anyway. But this patch just makes the --stat version respect > the config option. The --stat view is not even close to a valid diff, > so I think it makes sense to show the paths in more human-friendly > form. Seems fine, but I'm not sure about the Windows behavior: - Do we want to see backslash paths on Windows? - Backslash paths are parsed correctly? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5915: cmdutil: migrate previously missed instances to uipathfn
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0cbf491db7ee: cmdutil: migrate previously missed instances to uipathfn (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5915?vs=13942=13996 REVISION DETAIL https://phab.mercurial-scm.org/D5915 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2193,7 +2193,7 @@ ret = 0 except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % m.rel(subpath)) + % uipathfn(subpath)) return ret @@ -2825,7 +2825,7 @@ for f in names: if f.startswith(path_): return -ui.warn("%s: %s\n" % (m.rel(path), msg)) +ui.warn("%s: %s\n" % (uipathfn(path), msg)) for abs in ctx.walk(matchmod.badmatch(m, badfn)): if abs not in names: To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5914: cat: respect ui.relative-paths for "skipping missing subrepository"
This revision was automatically updated to reflect the committed changes. Closed by commit rHG28ce9184d495: cat: respect ui.relative-paths for skipping missing subrepository (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5914?vs=13941=13995 REVISION DETAIL https://phab.mercurial-scm.org/D5914 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2367,6 +2367,7 @@ write(abs) err = 0 +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) for subpath in sorted(ctx.substate): sub = ctx.sub(subpath) try: @@ -2377,7 +2378,7 @@ err = 0 except error.RepoLookupError: ui.status(_("skipping missing subrepository: %s\n") % - matcher.rel(subpath)) + uipathfn(subpath)) return err To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5916: scmutil: respect ui.relative-paths in default match.badfn
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0ed7a8ac5711: scmutil: respect ui.relative-paths in default match.badfn (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5916?vs=13943=13997 REVISION DETAIL https://phab.mercurial-scm.org/D5916 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -802,8 +802,9 @@ if not globbed and default == 'relpath': pats = expandpats(pats or []) +uipathfn = getuipathfn(ctx.repo(), legacyrelativevalue=True) def bad(f, msg): -ctx.repo().ui.warn("%s: %s\n" % (m.rel(f), msg)) +ctx.repo().ui.warn("%s: %s\n" % (uipathfn(f), msg)) if badfn is None: badfn = bad To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5912: forget: use relative paths for --interactive
This revision was automatically updated to reflect the committed changes. Closed by commit rHG05433ad59c52: forget: use relative paths for --interactive (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5912?vs=13939=13993 REVISION DETAIL https://phab.mercurial-scm.org/D5912 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2138,13 +2138,14 @@ '$$ Include remaining files' '$$ &? (display help)') for filename in forget[:]: -r = ui.promptchoice(_('forget %s %s') % (filename, responses)) +r = ui.promptchoice(_('forget %s %s') % +(uipathfn(filename), responses)) if r == 4: # ? while r == 4: for c, t in ui.extractchoices(responses)[1]: ui.write('%s - %s\n' % (c, encoding.lower(t))) -r = ui.promptchoice(_('forget %s %s') % (filename, - responses)) +r = ui.promptchoice(_('forget %s %s') % +(uipathfn(filename), responses)) if r == 0: # yes continue elif r == 1: # no To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5913: addremove: use uipathfn instead of m.rel() for recorded similatity message
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0a5a6675c86c: addremove: use uipathfn instead of m.rel() for recorded similatity message (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5913?vs=13940=13994 REVISION DETAIL https://phab.mercurial-scm.org/D5913 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1092,7 +1092,7 @@ repo.ui.status(status, label=label) renames = _findrenames(repo, m, added + unknown, removed + deleted, - similarity) + similarity, uipathfn) if not dry_run: _markchanges(repo, unknown + forgotten, deleted, renames) @@ -1121,8 +1121,12 @@ status = _('removing %s\n') % abs repo.ui.status(status) +# TODO: We should probably have the caller pass in uipathfn and apply it to +# the messages above too. forcerelativevalue=True is consistent with how +# it used to work. +uipathfn = getuipathfn(repo, forcerelativevalue=True) renames = _findrenames(repo, m, added + unknown, removed + deleted, - similarity) + similarity, uipathfn) _markchanges(repo, unknown + forgotten, deleted, renames) @@ -1161,7 +1165,7 @@ return added, unknown, deleted, removed, forgotten -def _findrenames(repo, matcher, added, removed, similarity): +def _findrenames(repo, matcher, added, removed, similarity, uipathfn): '''Find renames from removed files to added ones.''' renames = {} if similarity > 0: @@ -1171,7 +1175,7 @@ or not matcher.exact(new)): repo.ui.status(_('recording removal of %s as rename to %s ' '(%d%% similar)\n') % - (matcher.rel(old), matcher.rel(new), + (uipathfn(old), uipathfn(new), score * 100)) renames[new] = old return renames To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5903: addremove: pass around uipathfn and use instead of m.uipath() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG6a447a3d1bd0: addremove: pass around uipathfn and use instead of m.uipath() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5903?vs=13970=13984 REVISION DETAIL https://phab.mercurial-scm.org/D5903 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -290,7 +290,7 @@ def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts): +def addremove(self, matcher, prefix, uipathfn, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -521,13 +521,13 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts): +def addremove(self, m, prefix, uipathfn, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True -return scmutil.addremove(self._repo, m, prefix, opts) +return scmutil.addremove(self._repo, m, prefix, uipathfn, opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -763,6 +763,14 @@ '''Create a new uipathfn that treats the file as relative to subpath.''' return lambda f: uipathfn(posixpath.join(subpath, f)) +def anypats(pats, opts): +'''Checks if any patterns, including --include and --exclude were given. + +Some commands (e.g. addremove) use this condition for deciding whether to +print absolute or relative paths. +''' +return bool(pats or opts.get('include') or opts.get('exclude')) + def expandpats(pats): '''Expand bare globs when running on windows. On posix we assume it already has already been done by sh.''' @@ -1031,7 +1039,7 @@ repair.delayedstrip(repo.ui, repo, tostrip, operation, backup=backup) -def addremove(repo, matcher, prefix, opts=None): +def addremove(repo, matcher, prefix, uipathfn, opts=None): if opts is None: opts = {} m = matcher @@ -1052,12 +1060,13 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = subdiruipathfn(subpath, uipathfn) try: -if sub.addremove(submatch, subprefix, opts): +if sub.addremove(submatch, subprefix, subuipathfn, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") - % m.uipath(subpath)) + % uipathfn(subpath)) rejected = [] def badfn(f, msg): @@ -1075,10 +1084,10 @@ for abs in sorted(toprint): if repo.ui.verbose or not m.exact(abs): if abs in unknownset: -status = _('adding %s\n') % m.uipath(abs) +status = _('adding %s\n') % uipathfn(abs) label = 'ui.addremove.added' else: -status = _('removing %s\n') % m.uipath(abs) +status = _('removing %s\n') % uipathfn(abs) label = 'ui.addremove.removed' repo.ui.status(status, label=label) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -255,7 +255,9 @@ if not opts.get('similarity'): opts['similarity'] = '100' matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts) +relative = scmutil.anypats(pats, opts) +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=relative) +return scmutil.addremove(repo, matcher, "", uipathfn, opts) @command('annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2391,7 +2391,9 @@ dsguard = dirstateguard.dirstateguard(repo, 'commit') with dsguard or util.nullcontextmanager(): if dsguard: -if scmutil.addremove(repo, matcher, "", opts) != 0: +relative = scmutil.anypats(pats, opts) +uipathfn =
D5907: copy: respect ui.relative-paths in copy/rename
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe41449818bee: copy: respect ui.relative-paths in copy/rename (authored by martinvonz, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5907?vs=13977=13989#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5907?vs=13977=13989 REVISION DETAIL https://phab.mercurial-scm.org/D5907 AFFECTED FILES mercurial/cmdutil.py tests/test-copy.t CHANGE DETAILS diff --git a/tests/test-copy.t b/tests/test-copy.t --- a/tests/test-copy.t +++ b/tests/test-copy.t @@ -118,6 +118,23 @@ [255] $ hg st -A ? foo +respects ui.relative-paths + $ mkdir dir + $ cd dir + $ hg mv ../foo ../bar + ../foo: not copying - file is not managed + abort: no files to copy + [255] + $ hg mv ../foo ../bar --config ui.relative-paths=yes + ../foo: not copying - file is not managed + abort: no files to copy + [255] + $ hg mv ../foo ../bar --config ui.relative-paths=no + foo: not copying - file is not managed + abort: no files to copy + [255] + $ cd .. + $ rmdir dir $ hg add foo dry-run; print a warning that this is not a real copy; foo is added $ hg mv --dry-run foo bar diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1135,6 +1135,7 @@ dryrun = opts.get("dry_run") wctx = repo[None] +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) def walkpat(pat): srcs = [] if after: @@ -1144,7 +1145,7 @@ m = scmutil.match(wctx, [pat], opts, globbed=True) for abs in wctx.walk(m): state = repo.dirstate[abs] -rel = m.rel(abs) +rel = uipathfn(abs) exact = m.exact(abs) if state in badstates: if exact and state == '?': To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5910: automv: respect ui.relative-paths
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf89aad980025: automv: respect ui.relative-paths (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5910?vs=13937=13992 REVISION DETAIL https://phab.mercurial-scm.org/D5910 AFFECTED FILES hgext/automv.py CHANGE DETAILS diff --git a/hgext/automv.py b/hgext/automv.py --- a/hgext/automv.py +++ b/hgext/automv.py @@ -64,7 +64,8 @@ if threshold > 0: match = scmutil.match(repo[None], pats, opts) added, removed = _interestingfiles(repo, match) -renames = _findrenames(repo, match, added, removed, +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) +renames = _findrenames(repo, uipathfn, added, removed, threshold / 100.0) with repo.wlock(): @@ -89,7 +90,7 @@ return added, removed -def _findrenames(repo, matcher, added, removed, similarity): +def _findrenames(repo, uipathfn, added, removed, similarity): """Find what files in added are really moved files. Any file named in removed that is at least similarity% similar to a file @@ -103,7 +104,7 @@ if repo.ui.verbose: repo.ui.status( _('detected move of %s as %s (%d%% similar)\n') % ( -matcher.rel(src), matcher.rel(dst), score * 100)) +uipathfn(src), uipathfn(dst), score * 100)) renames[dst] = src if renames: repo.ui.status(_('detected move of %d files\n') % len(renames)) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5908: match: delete unused abs() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG727f0be3539a: match: delete unused abs() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5908?vs=13973=13990 REVISION DETAIL https://phab.mercurial-scm.org/D5908 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -277,11 +277,6 @@ # by recursive traversal is visited. traversedir = None -def abs(self, f): -'''Convert a repo path back to path that is relative to the root of the -matcher.''' -return f - def rel(self, f): '''Convert repo path back to path that is relative to cwd of matcher.''' return util.pathto(self._root, self._cwd, f) @@ -715,7 +710,6 @@ m.bad = m1.bad m.explicitdir = m1.explicitdir m.traversedir = m1.traversedir -m.abs = m1.abs m.rel = m1.rel return m if m2.always(): @@ -811,8 +805,6 @@ >>> m1.bad = bad >>> m2.bad(b'x.txt', b'No such file') sub/x.txt: No such file ->>> m2.abs(b'c.txt') -'sub/c.txt' """ def __init__(self, path, matcher): @@ -832,9 +824,6 @@ def bad(self, f, msg): self._matcher.bad(self._path + "/" + f, msg) -def abs(self, f): -return self._matcher.abs(self._path + "/" + f) - def rel(self, f): return self._matcher.rel(self._path + "/" + f) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5906: match: delete unused uipath() and _uipathrelative (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdadbfcc63b3e: match: delete unused uipath() and _uipathrelative (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5906?vs=13972=13988 REVISION DETAIL https://phab.mercurial-scm.org/D5906 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -170,7 +170,7 @@ if patterns: kindpats = normalize(patterns, default, root, cwd, auditor, warn) if _kindpatsalwaysmatch(kindpats): -m = alwaysmatcher(root, cwd, badfn, relativeuipath=True) +m = alwaysmatcher(root, cwd, badfn) else: m = _buildkindpatsmatcher(patternmatcher, root, cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, @@ -252,12 +252,11 @@ class basematcher(object): -def __init__(self, root, cwd, badfn=None, relativeuipath=True): +def __init__(self, root, cwd, badfn=None): self._root = root self._cwd = cwd if badfn is not None: self.bad = badfn -self._relativeuipath = relativeuipath def __call__(self, fn): return self.matchfn(fn) @@ -287,12 +286,6 @@ '''Convert repo path back to path that is relative to cwd of matcher.''' return util.pathto(self._root, self._cwd, f) -def uipath(self, f): -'''Convert repo path to a display path. If patterns or -I/-X were used -to create this matcher, the display path will be relative to cwd. -Otherwise it is relative to the root of the repo.''' -return (self._relativeuipath and self.rel(f)) or self.abs(f) - @propertycache def _files(self): return [] @@ -393,9 +386,8 @@ class alwaysmatcher(basematcher): '''Matches everything.''' -def __init__(self, root, cwd, badfn=None, relativeuipath=False): -super(alwaysmatcher, self).__init__(root, cwd, badfn, -relativeuipath=relativeuipath) +def __init__(self, root, cwd, badfn=None): +super(alwaysmatcher, self).__init__(root, cwd, badfn) def always(self): return True @@ -725,11 +717,9 @@ m.traversedir = m1.traversedir m.abs = m1.abs m.rel = m1.rel -m._relativeuipath |= m1._relativeuipath return m if m2.always(): m = copy.copy(m1) -m._relativeuipath |= m2._relativeuipath return m return intersectionmatcher(m1, m2) @@ -848,9 +838,6 @@ def rel(self, f): return self._matcher.rel(self._path + "/" + f) -def uipath(self, f): -return self._matcher.uipath(self._path + "/" + f) - def matchfn(self, f): # Some information is lost in the superclass's constructor, so we # can not accurately create the matching function for the subdirectory To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5911: forget: pass around uipathfn and use instead of m.rel() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG16a49c778bde: forget: pass around uipathfn and use instead of m.rel() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5911?vs=13975=13985 REVISION DETAIL https://phab.mercurial-scm.org/D5911 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -355,7 +355,7 @@ matched by the match function ''' -def forget(self, match, prefix, dryrun, interactive): +def forget(self, match, prefix, uipathfn, dryrun, interactive): return ([], []) def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, @@ -836,8 +836,8 @@ return ctx.walk(match) @annotatesubrepoerror -def forget(self, match, prefix, dryrun, interactive): -return cmdutil.forget(self.ui, self._repo, match, prefix, +def forget(self, match, prefix, uipathfn, dryrun, interactive): +return cmdutil.forget(self.ui, self._repo, match, prefix, uipathfn, True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2258,7 +2258,8 @@ m = scmutil.match(repo[None], pats, opts) dryrun, interactive = opts.get('dry_run'), opts.get('interactive') -rejected = cmdutil.forget(ui, repo, m, prefix="", +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +rejected = cmdutil.forget(ui, repo, m, prefix="", uipathfn=uipathfn, explicitonly=False, dryrun=dryrun, interactive=interactive)[0] return rejected and 1 or 0 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2084,7 +2084,8 @@ for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): +def forget(ui, repo, match, prefix, uipathfn, explicitonly, dryrun, + interactive): if dryrun and interactive: raise error.Abort(_("cannot specify both --dry-run and --interactive")) bad = [] @@ -2101,14 +2102,16 @@ sub = wctx.sub(subpath) submatch = matchmod.subdirmatcher(subpath, match) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) try: -subbad, subforgot = sub.forget(submatch, subprefix, dryrun=dryrun, +subbad, subforgot = sub.forget(submatch, subprefix, subuipathfn, + dryrun=dryrun, interactive=interactive) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % match.rel(subpath)) + % uipathfn(subpath)) if not explicitonly: for f in match.files(): @@ -2123,7 +2126,7 @@ continue ui.warn(_('not removing %s: ' 'file is already untracked\n') -% match.rel(f)) +% uipathfn(f)) bad.append(f) if interactive: @@ -2154,7 +2157,7 @@ for f in forget: if ui.verbose or not match.exact(f) or interactive: -ui.status(_('removing %s\n') % match.rel(f), +ui.status(_('removing %s\n') % uipathfn(f), label='ui.addremove.removed') if not dryrun: diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1078,11 +1078,11 @@ repo.lfstatus = False @eh.wrapfunction(cmdutil, 'forget') -def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, +def cmdutilforget(orig, ui, repo, match, prefix, uipathfn, explicitonly, dryrun, interactive): normalmatcher = composenormalfilematcher(match, repo[None].manifest()) -bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, - interactive) +bad, forgot = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly, + dryrun, interactive) m = composelargefilematcher(match, repo[None].manifest()) try: @@ -1098,12 +1098,12 @@ fstandin = lfutil.standin(f) if fstandin
D5904: largefiles: use uipathfn instead of match.{rel, uipath}() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf164076427b2: largefiles: use uipathfn instead of match.{rel,uipath}() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5904?vs=13976=13986 REVISION DETAIL https://phab.mercurial-scm.org/D5904 AFFECTED FILES hgext/largefiles/overrides.py CHANGE DETAILS diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -78,7 +78,7 @@ m.matchfn = lambda f: notlfile(f) and origmatchfn(f) return m -def addlargefiles(ui, repo, isaddremove, matcher, **opts): +def addlargefiles(ui, repo, isaddremove, matcher, uipathfn, **opts): large = opts.get(r'large') lfsize = lfutil.getminsize( ui, lfutil.islfilesrepo(repo), opts.get(r'lfsize')) @@ -99,17 +99,11 @@ nfile = f in wctx exists = lfile or nfile -# addremove in core gets fancy with the name, add doesn't -if isaddremove: -name = m.uipath(f) -else: -name = m.rel(f) - # Don't warn the user when they attempt to add a normal tracked file. # The normal add code will do that for us. if exact and exists: if lfile: -ui.warn(_('%s already a largefile\n') % name) +ui.warn(_('%s already a largefile\n') % uipathfn(f)) continue if (exact or not exists) and not lfutil.isstandin(f): @@ -123,7 +117,7 @@ if large or abovemin or (lfmatcher and lfmatcher(f)): lfnames.append(f) if ui.verbose or not exact: -ui.status(_('adding %s as a largefile\n') % name) +ui.status(_('adding %s as a largefile\n') % uipathfn(f)) bad = [] @@ -150,7 +144,7 @@ added = [f for f in lfnames if f not in bad] return added, bad -def removelargefiles(ui, repo, isaddremove, matcher, dryrun, **opts): +def removelargefiles(ui, repo, isaddremove, matcher, uipathfn, dryrun, **opts): after = opts.get(r'after') m = composelargefilematcher(matcher, repo[None].manifest()) try: @@ -166,7 +160,7 @@ def warn(files, msg): for f in files: -ui.warn(msg % m.rel(f)) +ui.warn(msg % uipathfn(f)) return int(len(files) > 0) if after: @@ -186,12 +180,7 @@ lfdirstate = lfutil.openlfdirstate(ui, repo) for f in sorted(remove): if ui.verbose or not m.exact(f): -# addremove in core gets fancy with the name, remove doesn't -if isaddremove: -name = m.uipath(f) -else: -name = m.rel(f) -ui.status(_('removing %s\n') % name) +ui.status(_('removing %s\n') % uipathfn(f)) if not dryrun: if not after: @@ -240,7 +229,7 @@ if opts.get(r'normal'): return orig(ui, repo, matcher, prefix, uipathfn, explicitonly, **opts) -ladded, lbad = addlargefiles(ui, repo, False, matcher, **opts) +ladded, lbad = addlargefiles(ui, repo, False, matcher, uipathfn, **opts) normalmatcher = composenormalfilematcher(matcher, repo[None].manifest(), ladded) bad = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly, **opts) @@ -254,8 +243,8 @@ normalmatcher = composenormalfilematcher(matcher, repo[None].manifest()) result = orig(ui, repo, normalmatcher, prefix, uipathfn, after, force, subrepos, dryrun) -return removelargefiles(ui, repo, False, matcher, dryrun, after=after, -force=force) or result +return removelargefiles(ui, repo, False, matcher, uipathfn, dryrun, +after=after, force=force) or result @eh.wrapfunction(subrepo.hgsubrepo, 'status') def overridestatusfn(orig, repo, rev2, **opts): @@ -1250,11 +1239,11 @@ matchfn = m.matchfn m.matchfn = lambda f: f in s.deleted and matchfn(f) -removelargefiles(repo.ui, repo, True, m, opts.get('dry_run'), +removelargefiles(repo.ui, repo, True, m, uipathfn, opts.get('dry_run'), **pycompat.strkwargs(opts)) # Call into the normal add code, and any files that *should* be added as # largefiles will be -added, bad = addlargefiles(repo.ui, repo, True, matcher, +added, bad = addlargefiles(repo.ui, repo, True, matcher, uipathfn, **pycompat.strkwargs(opts)) # Now that we've handled largefiles, hand off to the original addremove # function to take care of the rest. Make sure it doesn't do anything with To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel
D5905: diff: respect ui.relative-paths for warning about path outside --root
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdf59b1078983: diff: respect ui.relative-paths for warning about path outside --root (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5905?vs=13930=13987 REVISION DETAIL https://phab.mercurial-scm.org/D5905 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 @@ -73,12 +73,13 @@ if relroot != '': # XXX relative roots currently don't work if the root is within a # subrepo -uirelroot = match.uipath(relroot) +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) +uirelroot = uipathfn(pathfn(relroot)) relroot += '/' for matchroot in match.files(): if not matchroot.startswith(relroot): -ui.warn(_('warning: %s not inside relative root %s\n') % ( -match.uipath(matchroot), uirelroot)) +ui.warn(_('warning: %s not inside relative root %s\n') % +(uipathfn(pathfn(matchroot)), uirelroot)) relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') match = matchmod.intersectmatchers(match, relrootmatch) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5901: add: pass around uipathfn and use instead of m.rel() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf8b18583049f: add: pass around uipathfn and use instead of m.rel() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5901?vs=13968=13982 REVISION DETAIL https://phab.mercurial-scm.org/D5901 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ """ raise NotImplementedError -def add(self, ui, match, prefix, explicitonly, **opts): +def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): return [] def addremove(self, matcher, prefix, opts): @@ -516,8 +516,9 @@ self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines))) @annotatesubrepoerror -def add(self, ui, match, prefix, explicitonly, **opts): -return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts) +def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): +return cmdutil.add(ui, self._repo, match, prefix, uipathfn, + explicitonly, **opts) @annotatesubrepoerror def addremove(self, m, prefix, opts): @@ -1590,7 +1591,7 @@ return False @annotatesubrepoerror -def add(self, ui, match, prefix, explicitonly, **opts): +def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): if self._gitmissing(): return [] @@ -1614,7 +1615,7 @@ if exact: command.append("-f") #should be added, even if ignored if ui.verbose or not exact: -ui.status(_('adding %s\n') % match.rel(f)) +ui.status(_('adding %s\n') % uipathfn(f)) if f in tracked: # hg prints 'adding' even if already tracked if exact: @@ -1624,7 +1625,7 @@ self._gitcommand(command + [f]) for f in rejected: -ui.warn(_("%s already tracked!\n") % match.rel(f)) +ui.warn(_("%s already tracked!\n") % uipathfn(f)) return rejected diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -11,6 +11,7 @@ import glob import hashlib import os +import posixpath import re import subprocess import weakref @@ -758,6 +759,10 @@ else: return lambda f: f +def subdiruipathfn(subpath, uipathfn): +'''Create a new uipathfn that treats the file as relative to subpath.''' +return lambda f: uipathfn(posixpath.join(subpath, f)) + def expandpats(pats): '''Expand bare globs when running on windows. On posix we assume it already has already been done by sh.''' diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -180,7 +180,8 @@ """ m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts)) -rejected = cmdutil.add(ui, repo, m, "", False, **opts) +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +rejected = cmdutil.add(ui, repo, m, "", uipathfn, False, **opts) return rejected and 1 or 0 @command('addremove', diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2027,7 +2027,7 @@ return iterate() -def add(ui, repo, match, prefix, explicitonly, **opts): +def add(ui, repo, match, prefix, uipathfn, explicitonly, **opts): bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2051,21 +2051,24 @@ cca(f) names.append(f) if ui.verbose or not exact: -ui.status(_('adding %s\n') % match.rel(f), +ui.status(_('adding %s\n') % uipathfn(f), label='ui.addremove.added') for subpath in sorted(wctx.substate): sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) if opts.get(r'subrepos'): -bad.extend(sub.add(ui, submatch, subprefix, False, **opts)) +bad.extend(sub.add(ui, submatch, subprefix, subuipathfn, False, + **opts)) else: -bad.extend(sub.add(ui, submatch, subprefix, True, **opts)) +bad.extend(sub.add(ui, submatch, subprefix, subuipathfn, True, + **opts)) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % match.rel(subpath)) +
D5902: remove: pass around uipathfn and use instead of m.rel() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb2df5dc3ebfb: remove: pass around uipathfn and use instead of m.rel() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5902?vs=13969=13983 REVISION DETAIL https://phab.mercurial-scm.org/D5902 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -358,7 +358,7 @@ def forget(self, match, prefix, dryrun, interactive): return ([], []) -def removefiles(self, matcher, prefix, after, force, subrepos, +def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, dryrun, warnings): """remove the matched files from the subrepository and the filesystem, possibly by force and/or after the file has been removed from the @@ -841,9 +841,9 @@ True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror -def removefiles(self, matcher, prefix, after, force, subrepos, +def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, dryrun, warnings): -return cmdutil.remove(self.ui, self._repo, matcher, prefix, +return cmdutil.remove(self.ui, self._repo, matcher, prefix, uipathfn, after, force, subrepos, dryrun) @annotatesubrepoerror diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4717,7 +4717,8 @@ m = scmutil.match(repo[None], pats, opts) subrepos = opts.get('subrepos') -return cmdutil.remove(ui, repo, m, "", after, force, subrepos, +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +return cmdutil.remove(ui, repo, m, "", uipathfn, after, force, subrepos, dryrun=dryrun) @command('rename|move|mv', diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2192,7 +2192,8 @@ return ret -def remove(ui, repo, m, prefix, after, force, subrepos, dryrun, warnings=None): +def remove(ui, repo, m, prefix, uipathfn, after, force, subrepos, dryrun, + warnings=None): ret = 0 s = repo.status(match=m, clean=True) modified, added, deleted, clean = s[0], s[1], s[3], s[6] @@ -2211,16 +2212,17 @@ for subpath in subs: submatch = matchmod.subdirmatcher(subpath, m) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) if subrepos or m.exact(subpath) or any(submatch.files()): progress.increment() sub = wctx.sub(subpath) try: -if sub.removefiles(submatch, subprefix, after, force, subrepos, - dryrun, warnings): +if sub.removefiles(submatch, subprefix, subuipathfn, after, + force, subrepos, dryrun, warnings): ret = 1 except error.LookupError: warnings.append(_("skipping missing subrepository: %s\n") - % m.rel(subpath)) + % uipathfn(subpath)) progress.complete() # warn about failure to delete explicit files/dirs @@ -2244,10 +2246,10 @@ if repo.wvfs.exists(f): if repo.wvfs.isdir(f): warnings.append(_('not removing %s: no tracked files\n') -% m.rel(f)) +% uipathfn(f)) else: warnings.append(_('not removing %s: file is untracked\n') -% m.rel(f)) +% uipathfn(f)) # missing files will generate a warning elsewhere ret = 1 progress.complete() @@ -2263,7 +2265,7 @@ progress.increment() if ui.verbose or (f in files): warnings.append(_('not removing %s: file still exists\n') -% m.rel(f)) +% uipathfn(f)) ret = 1 progress.complete() else: @@ -2274,12 +2276,12 @@ for f in modified: progress.increment() warnings.append(_('not removing %s: file is modified (use -f' - ' to force removal)\n') % m.rel(f)) + ' to force removal)\n') % uipathfn(f)) ret = 1 for f in added: progress.increment() warnings.append(_("not removing %s: file has been marked for add" - " (use 'hg forget' to undo add)\n") % m.rel(f)) + " (use 'hg forget' to undo add)\n") %
D5900: subrepo: (mostly) use relative path in "skipping missing subrepository"
This revision was automatically updated to reflect the committed changes. Closed by commit rHG799e156785f7: subrepo: (mostly) use relative path in skipping missing subrepository (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5900?vs=13920=13981 REVISION DETAIL https://phab.mercurial-scm.org/D5900 AFFECTED FILES mercurial/cmdutil.py mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1040,7 +1040,6 @@ similarity /= 100.0 ret = 0 -join = lambda f: os.path.join(prefix, f) wctx = repo[None] for subpath in sorted(wctx.substate): @@ -1053,7 +1052,7 @@ ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") - % join(subpath)) + % m.uipath(subpath)) rejected = [] def badfn(f, msg): diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2028,7 +2028,6 @@ return iterate() def add(ui, repo, match, prefix, explicitonly, **opts): -join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2066,7 +2065,7 @@ bad.extend(sub.add(ui, submatch, subprefix, True, **opts)) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % join(subpath)) + % match.rel(subpath)) if not opts.get(r'dry_run'): rejected = wctx.add(names, prefix) @@ -2085,7 +2084,6 @@ def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): if dryrun and interactive: raise error.Abort(_("cannot specify both --dry-run and --interactive")) -join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) wctx = repo[None] @@ -2107,7 +2105,7 @@ forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % join(subpath)) + % match.rel(subpath)) if not explicitonly: for f in match.files(): @@ -2187,12 +2185,11 @@ ret = 0 except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % m.abs(subpath)) + % m.rel(subpath)) return ret def remove(ui, repo, m, prefix, after, force, subrepos, dryrun, warnings=None): -join = lambda f: os.path.join(prefix, f) ret = 0 s = repo.status(match=m, clean=True) modified, added, deleted, clean = s[0], s[1], s[3], s[6] @@ -2220,7 +2217,7 @@ ret = 1 except error.LookupError: warnings.append(_("skipping missing subrepository: %s\n") - % join(subpath)) + % m.rel(subpath)) progress.complete() # warn about failure to delete explicit files/dirs @@ -2364,12 +2361,13 @@ sub = ctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, matcher) -subprefix = os.path.join(prefix, sub._path) +subprefix = os.path.join(prefix, subpath) if not sub.cat(submatch, basefm, fntemplate, subprefix, **pycompat.strkwargs(opts)): err = 0 except error.RepoLookupError: -ui.status(_("skipping missing subrepository: %s\n") % subprefix) +ui.status(_("skipping missing subrepository: %s\n") % + matcher.rel(subpath)) return err To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5894: patch: replace "prefix" and "relroot" arguments by "pathfn" (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd4c9eebdd72d: patch: replace prefix and relroot arguments by pathfn (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5894?vs=13967=13978 REVISION DETAIL https://phab.mercurial-scm.org/D5894 AFFECTED FILES mercurial/context.py mercurial/logcmdutil.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -15,7 +15,6 @@ import errno import hashlib import os -import posixpath import re import shutil import zlib @@ -2239,7 +2238,7 @@ difffeatureopts = diffutil.difffeatureopts def diff(repo, node1=None, node2=None, match=None, changes=None, - opts=None, losedatafn=None, prefix='', relroot='', copy=None, + opts=None, losedatafn=None, pathfn=None, copy=None, copysourcematch=None, hunksfilterfn=None): '''yields diff of changes to files between two nodes, or node and working directory. @@ -2277,9 +2276,8 @@ ctx2 = repo[node2] for fctx1, fctx2, hdr, hunks in diffhunks( -repo, ctx1=ctx1, ctx2=ctx2, -match=match, changes=changes, opts=opts, -losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, +repo, ctx1=ctx1, ctx2=ctx2, match=match, changes=changes, opts=opts, +losedatafn=losedatafn, pathfn=pathfn, copy=copy, copysourcematch=copysourcematch): if hunksfilterfn is not None: # If the file has been removed, fctx2 is None; but this should @@ -2294,9 +2292,8 @@ if text: yield text -def diffhunks(repo, ctx1, ctx2, match=None, changes=None, - opts=None, losedatafn=None, prefix='', relroot='', copy=None, - copysourcematch=None): +def diffhunks(repo, ctx1, ctx2, match=None, changes=None, opts=None, + losedatafn=None, pathfn=None, copy=None, copysourcematch=None): """Yield diff of changes to files in the form of (`header`, `hunks`) tuples where `header` is a list of diff headers and `hunks` is an iterable of (`hunkrange`, `hunklines`) tuples. @@ -2376,7 +2373,7 @@ def difffn(opts, losedata): return trydiff(repo, revs, ctx1, ctx2, modified, added, removed, - copy, getfilectx, opts, losedata, prefix, relroot) + copy, getfilectx, opts, losedata, pathfn) if opts.upgrade and not opts.git: try: def losedata(fn): @@ -2591,16 +2588,14 @@ yield f1, f2, copyop def trydiff(repo, revs, ctx1, ctx2, modified, added, removed, -copy, getfilectx, opts, losedatafn, prefix, relroot): +copy, getfilectx, opts, losedatafn, pathfn): '''given input data, generate a diff and yield it in blocks If generating a diff would lose data like flags or binary data and losedatafn is not None, it will be called. -relroot is removed and prefix is added to every path in the diff output. - -If relroot is not empty, this function expects every path in modified, -added, removed and copy to start with it.''' +pathfn is applied to every path in the diff output. +''' def gitindex(text): if not text: @@ -2628,12 +2623,8 @@ gitmode = {'l': '12', 'x': '100755', '': '100644'} -if relroot != '' and (repo.ui.configbool('devel', 'all-warnings') - or repo.ui.configbool('devel', 'check-relroot')): -for f in modified + added + removed + list(copy) + list(copy.values()): -if f is not None and not f.startswith(relroot): -raise AssertionError( -"file %s doesn't start with relroot %s" % (f, relroot)) +if not pathfn: +pathfn = lambda f: f for f1, f2, copyop in _filepairs(modified, added, removed, copy, opts): content1 = None @@ -2670,10 +2661,8 @@ (f1 and f2 and flag1 != flag2)): losedatafn(f2 or f1) -path1 = f1 or f2 -path2 = f2 or f1 -path1 = posixpath.join(prefix, path1[len(relroot):]) -path2 = posixpath.join(prefix, path2[len(relroot):]) +path1 = pathfn(f1 or f2) +path2 = pathfn(f2 or f1) header = [] if opts.git: header.append('diff --git %s%s %s%s' % diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -9,6 +9,7 @@ import itertools import os +import posixpath from .i18n import _ from .node import ( @@ -65,6 +66,8 @@ else: relroot = '' copysourcematch = None +def pathfn(f): +return posixpath.join(prefix, f) if relroot != '': # XXX relative roots currently don't work if the root is within a # subrepo @@ -79,14 +82,22 @@
D5899: subrepo: use relative path for "already tracked" message
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd8cdd5320f75: subrepo: use relative path for already tracked message (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5899?vs=13919=13980 REVISION DETAIL https://phab.mercurial-scm.org/D5899 AFFECTED FILES mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1624,7 +1624,7 @@ self._gitcommand(command + [f]) for f in rejected: -ui.warn(_("%s already tracked!\n") % match.abs(f)) +ui.warn(_("%s already tracked!\n") % match.rel(f)) return rejected To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5895: diff: make `hg diff --root=subrepo` work
This revision was automatically updated to reflect the committed changes. Closed by commit rHGec37db02fc72: diff: make `hg diff --root=subrepo` work (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5895?vs=13909=13979 REVISION DETAIL https://phab.mercurial-scm.org/D5895 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 @@ -66,6 +66,8 @@ else: relroot = '' copysourcematch = None +def compose(f, g): +return lambda x: f(g(x)) def pathfn(f): return posixpath.join(prefix, f) if relroot != '': @@ -84,11 +86,12 @@ checkroot = (repo.ui.configbool('devel', 'all-warnings') or repo.ui.configbool('devel', 'check-relroot')) -def pathfn(f): +def relrootpathfn(f): if checkroot and not f.startswith(relroot): raise AssertionError( "file %s doesn't start with relroot %s" % (f, relroot)) -return posixpath.join(prefix, f[len(relroot):]) +return f[len(relroot):] +pathfn = compose(relrootpathfn, pathfn) if stat: diffopts = diffopts.copy(context=0, noprefix=False) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@41645: 27 new changesets
27 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/035cae1d197f changeset: 41619:035cae1d197f user:Martin von Zweigbergk date:Wed Feb 06 17:46:20 2019 -0800 summary: patch: let caller pass in root-filtering matcher (API) https://www.mercurial-scm.org/repo/hg/rev/74f53d3bd685 changeset: 41620:74f53d3bd685 user:Martin von Zweigbergk date:Wed Feb 06 22:52:49 2019 -0800 summary: patch: accept second matcher that applies only to copy sources (API) https://www.mercurial-scm.org/repo/hg/rev/0dc3ed4e712c changeset: 41621:0dc3ed4e712c user:Martin von Zweigbergk date:Fri Feb 08 23:03:42 2019 -0800 summary: tests: replace match.match(exact=True) by match.exact() https://www.mercurial-scm.org/repo/hg/rev/635a12c53ea6 changeset: 41622:635a12c53ea6 user:Martin von Zweigbergk date:Fri Feb 08 22:57:26 2019 -0800 summary: match: remove unused "exact" argument (API) https://www.mercurial-scm.org/repo/hg/rev/7c4e205f71ca changeset: 41623:7c4e205f71ca user:Pulkit Goyal date:Thu Feb 07 16:44:43 2019 +0300 summary: py3: use bytes.startswith() instead of comparing with bytes[0] https://www.mercurial-scm.org/repo/hg/rev/3751595ec45e changeset: 41624:3751595ec45e user:Pulkit Goyal date:Thu Feb 07 16:43:42 2019 +0300 summary: py3: make sure __repr__ returns str https://www.mercurial-scm.org/repo/hg/rev/93620a4ba88d changeset: 41625:93620a4ba88d user:Martin von Zweigbergk date:Thu Feb 07 09:46:36 2019 -0800 summary: subrepo: avoid calculating subrepo prefix twice for cat() (API) https://www.mercurial-scm.org/repo/hg/rev/2c549abc6b85 changeset: 41626:2c549abc6b85 user:Martin von Zweigbergk date:Thu Feb 07 09:40:37 2019 -0800 summary: subrepo: adjust subrepo prefix before calling subrepo.removefiles() (API) https://www.mercurial-scm.org/repo/hg/rev/f92844cb942c changeset: 41627:f92844cb942c user:Martin von Zweigbergk date:Thu Feb 07 09:52:22 2019 -0800 summary: subrepo: adjust subrepo prefix before calling subrepo.forget() (API) https://www.mercurial-scm.org/repo/hg/rev/ed046348675c changeset: 41628:ed046348675c user:Martin von Zweigbergk date:Thu Feb 07 09:59:27 2019 -0800 summary: subrepo: adjust subrepo prefix before calling subrepo.add() (API) https://www.mercurial-scm.org/repo/hg/rev/5ee3c49fc9cd changeset: 41629:5ee3c49fc9cd user:Martin von Zweigbergk date:Thu Feb 07 10:01:55 2019 -0800 summary: subrepo: adjust subrepo prefix before calling subrepo.addremove() (API) https://www.mercurial-scm.org/repo/hg/rev/3d094bfaf885 changeset: 41630:3d094bfaf885 user:Martin von Zweigbergk date:Thu Feb 07 09:52:36 2019 -0800 summary: subrepo: adjust subrepo prefix before calling subrepo.diff() (API) https://www.mercurial-scm.org/repo/hg/rev/3d9d5e612e67 changeset: 41631:3d9d5e612e67 user:Martin von Zweigbergk date:Thu Feb 07 10:20:57 2019 -0800 summary: subrepo: adjust subrepo prefix before calling subrepo.archive() (API) https://www.mercurial-scm.org/repo/hg/rev/31dfe7026f8d changeset: 41632:31dfe7026f8d user:Kyle Lippincott date:Thu Jan 31 11:55:02 2019 -0800 summary: blackbox: test that unsetting track disables blackbox logging https://www.mercurial-scm.org/repo/hg/rev/7b1b0415f8e5 changeset: 41633:7b1b0415f8e5 user:Kyle Lippincott date:Thu Jan 31 12:49:22 2019 -0800 summary: blackbox: test that track=* works to log everything https://www.mercurial-scm.org/repo/hg/rev/62bf34f70fe8 changeset: 41634:62bf34f70fe8 user:Martin von Zweigbergk date:Fri Feb 08 23:29:07 2019 -0800 summary: remotefilelog: replace matchandpats() by match() https://www.mercurial-scm.org/repo/hg/rev/446e1dcc3b5c changeset: 41635:446e1dcc3b5c user:Martin von Zweigbergk date:Fri Feb 08 13:31:26 2019 -0800 summary: annotate: respect ui.relative-paths for "binary file" message https://www.mercurial-scm.org/repo/hg/rev/be8741d42836 changeset: 41636:be8741d42836 user:Martin von Zweigbergk date:Thu Feb 07 23:41:44 2019 -0800 summary: debugignore: respect ui.relative-paths https://www.mercurial-scm.org/repo/hg/rev/252cc56c9ff6 changeset: 41637:252cc56c9ff6 user:Boris Feld date:Sat Feb 09 01:19:15 2019 +0100 summary: test: use `printenv.py --line` in `test-bundle.t` https://www.mercurial-scm.org/repo/hg/rev/e8a71ed9c373 changeset: 41638:e8a71ed9c373 user:Boris Feld date:Sat Feb 09 01:19:43 2019 +0100 summary: test: use `printenv.py --line` in `test-bundle2-multiple-changegroups.t` https://www.mercurial-scm.org/repo/hg/rev/f8443db3032e changeset: 41639:f8443db3032e user:Boris Feld date:Sat Feb 09 01:20:03 2019 +0100 summary: test: use `printenv.py --line`
mercurial@41618: 6 new changesets (2 on stable)
6 new changesets (2 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/8f0e8b179842 changeset: 41613:8f0e8b179842 branch: stable parent: 41583:87a6e3c953e0 user:Mathias De Mare date:Thu Feb 07 09:12:01 2019 +0100 summary: packaging: modify rc detection to work with X.Yrc instead of X.Y-rc https://www.mercurial-scm.org/repo/hg/rev/f2f538725d07 changeset: 41614:f2f538725d07 branch: stable user:Mathias De Mare date:Thu Feb 07 11:08:54 2019 +0100 summary: tests: fix regression tests failing on CentOS 7 https://www.mercurial-scm.org/repo/hg/rev/328ca3b9e545 changeset: 41615:328ca3b9e545 parent: 41612:fbd4ce55bcbd user:Martijn Pieters date:Mon Jan 21 17:37:33 2019 + summary: branchmap: encapsulate cache updating in the map itself https://www.mercurial-scm.org/repo/hg/rev/2c13e91ede6e changeset: 41616:2c13e91ede6e user:Nikita Slyusarev date:Thu Feb 07 18:57:54 2019 +0300 summary: convert: handle empty intial commits while converting to svn https://www.mercurial-scm.org/repo/hg/rev/36ee0d6d64c5 changeset: 41617:36ee0d6d64c5 user:Nikita Slyusarev date:Thu Feb 07 21:48:50 2019 +0300 summary: convert: handle exec bit removal while converting to svn https://www.mercurial-scm.org/repo/hg/rev/e834f6f6f221 changeset: 41618:e834f6f6f221 bookmark:@ tag: tip user:Martin von Zweigbergk date:Wed Feb 06 17:27:43 2019 -0800 summary: patch: pass in context objects into diffhunks() (API) -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5813: revset: add expect to check the size of a set
yuja added a comment. > +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expect', 'set size') > +size = args.get('size') > +if size is not None: > +minsize, maxsize = getintrange(size, > + _('expectsize requires a size range' > + ' or a positive integer'), > + _('size range bounds must be integers')) Maybe needs to specify the default min/max values to e.g. possible min/max values or `None`. > +if minsize != maxsize: > +size = (minsize, maxsize) > +else: > +size = minsize > +if size is None or 'set' not in args: > +raise error.ParseError(_('invalid set of arguments')) > +rev = getset(repo, fullreposet(repo), args['set'], order=order) > +if isinstance(size, tuple): > +if len(rev) < minsize or len(rev) > maxsize: > +raise error.RepoLookupError( > +_('revset size mismatch.' > +' expected between %d and %d, got %d') % (minsize, > + maxsize, > + len(rev))) > +if isinstance(size, int): > +if len(rev) != size: > +raise error.RepoLookupError( > +_('revset size mismatch.' > +' expected %d, got %d') % (size, len(rev))) There's no point to duplicate these "if"s because both minsize/maxsize should be set. We could switch the error messages by `minsize == maxsize`, but which doesn't mean we need different `size` types depending on minsize/maxsize values. > +# filter rev by subset. since we'll probably want to get an ordered > +# result from expectsize(), we'll have to conditionalize the > +# filtering direction Nit: this comment seems unnecessary since it just rephrase the code. > +if order == followorder: > +return subset & rev > +else: > +return rev & subset REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5813 To: navaneeth.suresh, #hg-reviewers Cc: yuja, pulkit, durin42, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D5813: revset: add expect to check the size of a set
> +@predicate('expectsize(set[, size])', safe=True, takeorder=True) > +def expectrevsetsize(repo, subset, x, order): > +"""Abort if the revset doesn't expect given size""" > +args = getargsdict(x, 'expect', 'set size') > +size = args.get('size') > +if size is not None: > +minsize, maxsize = getintrange(size, > + _('expectsize requires a size range' > + ' or a positive integer'), > + _('size range bounds must be > integers')) Maybe needs to specify the default min/max values to e.g. possible min/max values or `None`. > +if minsize != maxsize: > +size = (minsize, maxsize) > +else: > +size = minsize > +if size is None or 'set' not in args: > +raise error.ParseError(_('invalid set of arguments')) > +rev = getset(repo, fullreposet(repo), args['set'], order=order) > +if isinstance(size, tuple): > +if len(rev) < minsize or len(rev) > maxsize: > +raise error.RepoLookupError( > +_('revset size mismatch.' > +' expected between %d and %d, got %d') % (minsize, > + maxsize, > + len(rev))) > +if isinstance(size, int): > +if len(rev) != size: > +raise error.RepoLookupError( > +_('revset size mismatch.' > +' expected %d, got %d') % (size, len(rev))) There's no point to duplicate these "if"s because both minsize/maxsize should be set. We could switch the error messages by `minsize == maxsize`, but which doesn't mean we need different `size` types depending on minsize/maxsize values. > +# filter rev by subset. since we'll probably want to get an ordered > +# result from expectsize(), we'll have to conditionalize the > +# filtering direction Nit: this comment seems unnecessary since it just rephrase the code. > +if order == followorder: > +return subset & rev > +else: > +return rev & subset ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 01 of 10] test: use `printenv.py --line` in `test-bundle.t`
On Sun, Feb 10, 2019 at 3:39 AM Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1549671555 -3600 > # Sat Feb 09 01:19:15 2019 +0100 > # Node ID 1736fe7d07d8a96349dc678f7a7bcba29886d1a7 > # Parent e89e78a725eebab0282b4dd669d07797511252f8 > # EXP-Topic hook.txname > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 1736fe7d07d8 > test: use `printenv.py --line` in `test-bundle.t` > > This makes the output easier to update and read. > Queued 1-9, many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 10 of 10] transaction: include txnname in the hookargs dictionary
On Sun, Feb 10, 2019 at 3:54 AM Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1549749690 -3600 > # Sat Feb 09 23:01:30 2019 +0100 > # Node ID f4936120d74a81199068bed14a04ac65f24f6109 > # Parent 62d13ee8373ad4a7c97192680a4781fe5818a1df > # EXP-Topic hook.txname > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > f4936120d74a > transaction: include txnname in the hookargs dictionary > > There is no reason to not include the txnname alongside the txnid in all > case. > So let's do that. If the transaction name is useful to internal code, it > can > be useful for hooks. > What are the cases when we have transaction name and source different? > > diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py > --- a/mercurial/localrepo.py > +++ b/mercurial/localrepo.py > @@ -1811,7 +1811,6 @@ class localrepository(object): > args = tr.hookargs.copy() > args.update(bookmarks.preparehookargs(name, old, new)) > repo.hook('pretxnclose-bookmark', throw=True, > - txnname=desc, >**pycompat.strkwargs(args)) > if hook.hashook(repo.ui, 'pretxnclose-phase'): > cl = repo.unfiltered().changelog > @@ -1819,11 +1818,11 @@ class localrepository(object): > args = tr.hookargs.copy() > node = hex(cl.node(rev)) > args.update(phases.preparehookargs(node, old, new)) > -repo.hook('pretxnclose-phase', throw=True, > txnname=desc, > +repo.hook('pretxnclose-phase', throw=True, >**pycompat.strkwargs(args)) > > repo.hook('pretxnclose', throw=True, > - txnname=desc, **pycompat.strkwargs(tr.hookargs)) > + **pycompat.strkwargs(tr.hookargs)) > def releasefn(tr, success): > repo = reporef() > if success: > @@ -1857,6 +1856,7 @@ class localrepository(object): > tr.changes['bookmarks'] = {} > > tr.hookargs['txnid'] = txnid > +tr.hookargs['txnname'] = desc > # note: writing the fncache only during finalize mean that the > file is > # outdated when running hooks. As fncache is used for streaming > clone, > # this is not expected to break anything that happen during the > hooks. > @@ -1878,7 +1878,7 @@ class localrepository(object): > args = tr.hookargs.copy() > args.update(bookmarks.preparehookargs(name, old, > new)) > repo.hook('txnclose-bookmark', throw=False, > - txnname=desc, > **pycompat.strkwargs(args)) > + **pycompat.strkwargs(args)) > > if hook.hashook(repo.ui, 'txnclose-phase'): > cl = repo.unfiltered().changelog > @@ -1887,10 +1887,10 @@ class localrepository(object): > args = tr.hookargs.copy() > node = hex(cl.node(rev)) > args.update(phases.preparehookargs(node, old, > new)) > -repo.hook('txnclose-phase', throw=False, > txnname=desc, > +repo.hook('txnclose-phase', throw=False, >**pycompat.strkwargs(args)) > > -repo.hook('txnclose', throw=False, txnname=desc, > +repo.hook('txnclose', throw=False, >**pycompat.strkwargs(hookargs)) > reporef()._afterlock(hookfunc) > tr.addfinalize('txnclose-hook', txnclosehook) > @@ -1902,7 +1902,7 @@ class localrepository(object): > def txnaborthook(tr2): > """To be run if transaction is aborted > """ > -reporef().hook('txnabort', throw=False, txnname=desc, > +reporef().hook('txnabort', throw=False, > **pycompat.strkwargs(tr2.hookargs)) > tr.addabort('txnabort-hook', txnaborthook) > # avoid eager cache invalidation. in-memory data should be > identical > diff --git a/tests/test-bundle.t b/tests/test-bundle.t > --- a/tests/test-bundle.t > +++ b/tests/test-bundle.t > @@ -239,6 +239,8 @@ hg -R bundle://../full.hg verify >HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf >HG_SOURCE=pull >HG_TXNID=TXN:$ID$ > + HG_TXNNAME=pull > + bundle:../full.hg >HG_URL=bundle:../full.hg > >(run 'hg heads' to see heads, 'hg merge' to merge) > @@ -270,6 +272,8 @@ Pull full.hg into empty again (using -R; >HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf >HG_SOURCE=pull >HG_TXNID=TXN:$ID$ > + HG_TXNNAME=pull > + bundle:empty+full.hg >HG_URL=bundle:empty+full.hg > >(run 'hg heads' to see heads, 'hg merge' to merge) >
D5911: forget: pass around uipathfn and use instead of m.rel() (API)
martinvonz updated this revision to Diff 13975. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5911?vs=13974=13975 REVISION DETAIL https://phab.mercurial-scm.org/D5911 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -355,7 +355,7 @@ matched by the match function ''' -def forget(self, match, prefix, dryrun, interactive): +def forget(self, match, prefix, uipathfn, dryrun, interactive): return ([], []) def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, @@ -836,8 +836,8 @@ return ctx.walk(match) @annotatesubrepoerror -def forget(self, match, prefix, dryrun, interactive): -return cmdutil.forget(self.ui, self._repo, match, prefix, +def forget(self, match, prefix, uipathfn, dryrun, interactive): +return cmdutil.forget(self.ui, self._repo, match, prefix, uipathfn, True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2258,7 +2258,8 @@ m = scmutil.match(repo[None], pats, opts) dryrun, interactive = opts.get('dry_run'), opts.get('interactive') -rejected = cmdutil.forget(ui, repo, m, prefix="", +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +rejected = cmdutil.forget(ui, repo, m, prefix="", uipathfn=uipathfn, explicitonly=False, dryrun=dryrun, interactive=interactive)[0] return rejected and 1 or 0 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2084,7 +2084,8 @@ for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): +def forget(ui, repo, match, prefix, uipathfn, explicitonly, dryrun, + interactive): if dryrun and interactive: raise error.Abort(_("cannot specify both --dry-run and --interactive")) bad = [] @@ -2101,14 +2102,16 @@ sub = wctx.sub(subpath) submatch = matchmod.subdirmatcher(subpath, match) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) try: -subbad, subforgot = sub.forget(submatch, subprefix, dryrun=dryrun, +subbad, subforgot = sub.forget(submatch, subprefix, subuipathfn, + dryrun=dryrun, interactive=interactive) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % match.rel(subpath)) + % uipathfn(subpath)) if not explicitonly: for f in match.files(): @@ -2123,7 +2126,7 @@ continue ui.warn(_('not removing %s: ' 'file is already untracked\n') -% match.rel(f)) +% uipathfn(f)) bad.append(f) if interactive: @@ -2154,7 +2157,7 @@ for f in forget: if ui.verbose or not match.exact(f) or interactive: -ui.status(_('removing %s\n') % match.rel(f), +ui.status(_('removing %s\n') % uipathfn(f), label='ui.addremove.removed') if not dryrun: diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1078,11 +1078,11 @@ repo.lfstatus = False @eh.wrapfunction(cmdutil, 'forget') -def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, +def cmdutilforget(orig, ui, repo, match, prefix, uipathfn, explicitonly, dryrun, interactive): normalmatcher = composenormalfilematcher(match, repo[None].manifest()) -bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, - interactive) +bad, forgot = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly, + dryrun, interactive) m = composelargefilematcher(match, repo[None].manifest()) try: @@ -1098,12 +1098,12 @@ fstandin = lfutil.standin(f) if fstandin not in repo.dirstate and not repo.wvfs.isdir(fstandin): ui.warn(_('not removing %s: file is already untracked\n') -% m.rel(f)) +
D5907: copy: respect ui.relative-paths in copy/rename
martinvonz updated this revision to Diff 13977. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5907?vs=13934=13977 REVISION DETAIL https://phab.mercurial-scm.org/D5907 AFFECTED FILES mercurial/cmdutil.py mercurial/scmutil.py tests/test-copy.t CHANGE DETAILS diff --git a/tests/test-copy.t b/tests/test-copy.t --- a/tests/test-copy.t +++ b/tests/test-copy.t @@ -118,6 +118,23 @@ [255] $ hg st -A ? foo +respects ui.relative-paths + $ mkdir dir + $ cd dir + $ hg mv ../foo ../bar + ../foo: not copying - file is not managed + abort: no files to copy + [255] + $ hg mv ../foo ../bar --config ui.relative-paths=yes + ../foo: not copying - file is not managed + abort: no files to copy + [255] + $ hg mv ../foo ../bar --config ui.relative-paths=no + foo: not copying - file is not managed + abort: no files to copy + [255] + $ cd .. + $ rmdir dir $ hg add foo dry-run; print a warning that this is not a real copy; foo is added $ hg mv --dry-run foo bar diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -51,8 +51,10 @@ ) if pycompat.iswindows: +from . import windows as platform from . import scmwindows as scmplatform else: +from . import posix as platform from . import scmposix as scmplatform parsers = policy.importmod(r'parsers') @@ -757,7 +759,7 @@ pathto = repo.pathto return lambda f: pathto(f, cwd) else: -return lambda f: f +return platform.localpath def subdiruipathfn(subpath, uipathfn): '''Create a new uipathfn that treats the file as relative to subpath.''' diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1135,6 +1135,7 @@ dryrun = opts.get("dry_run") wctx = repo[None] +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) def walkpat(pat): srcs = [] if after: @@ -1144,7 +1145,7 @@ m = scmutil.match(wctx, [pat], opts, globbed=True) for abs in wctx.walk(m): state = repo.dirstate[abs] -rel = m.rel(abs) +rel = uipathfn(abs) exact = m.exact(abs) if state in badstates: if exact and state == '?': To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5904: largefiles: use uipathfn instead of match.{rel, uipath}() (API)
martinvonz updated this revision to Diff 13976. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5904?vs=13971=13976 REVISION DETAIL https://phab.mercurial-scm.org/D5904 AFFECTED FILES hgext/largefiles/overrides.py CHANGE DETAILS diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -78,7 +78,7 @@ m.matchfn = lambda f: notlfile(f) and origmatchfn(f) return m -def addlargefiles(ui, repo, isaddremove, matcher, **opts): +def addlargefiles(ui, repo, isaddremove, matcher, uipathfn, **opts): large = opts.get(r'large') lfsize = lfutil.getminsize( ui, lfutil.islfilesrepo(repo), opts.get(r'lfsize')) @@ -99,17 +99,11 @@ nfile = f in wctx exists = lfile or nfile -# addremove in core gets fancy with the name, add doesn't -if isaddremove: -name = m.uipath(f) -else: -name = m.rel(f) - # Don't warn the user when they attempt to add a normal tracked file. # The normal add code will do that for us. if exact and exists: if lfile: -ui.warn(_('%s already a largefile\n') % name) +ui.warn(_('%s already a largefile\n') % uipathfn(f)) continue if (exact or not exists) and not lfutil.isstandin(f): @@ -123,7 +117,7 @@ if large or abovemin or (lfmatcher and lfmatcher(f)): lfnames.append(f) if ui.verbose or not exact: -ui.status(_('adding %s as a largefile\n') % name) +ui.status(_('adding %s as a largefile\n') % uipathfn(f)) bad = [] @@ -150,7 +144,7 @@ added = [f for f in lfnames if f not in bad] return added, bad -def removelargefiles(ui, repo, isaddremove, matcher, dryrun, **opts): +def removelargefiles(ui, repo, isaddremove, matcher, uipathfn, dryrun, **opts): after = opts.get(r'after') m = composelargefilematcher(matcher, repo[None].manifest()) try: @@ -166,7 +160,7 @@ def warn(files, msg): for f in files: -ui.warn(msg % m.rel(f)) +ui.warn(msg % uipathfn(f)) return int(len(files) > 0) if after: @@ -186,12 +180,7 @@ lfdirstate = lfutil.openlfdirstate(ui, repo) for f in sorted(remove): if ui.verbose or not m.exact(f): -# addremove in core gets fancy with the name, remove doesn't -if isaddremove: -name = m.uipath(f) -else: -name = m.rel(f) -ui.status(_('removing %s\n') % name) +ui.status(_('removing %s\n') % uipathfn(f)) if not dryrun: if not after: @@ -240,7 +229,7 @@ if opts.get(r'normal'): return orig(ui, repo, matcher, prefix, uipathfn, explicitonly, **opts) -ladded, lbad = addlargefiles(ui, repo, False, matcher, **opts) +ladded, lbad = addlargefiles(ui, repo, False, matcher, uipathfn, **opts) normalmatcher = composenormalfilematcher(matcher, repo[None].manifest(), ladded) bad = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly, **opts) @@ -254,8 +243,8 @@ normalmatcher = composenormalfilematcher(matcher, repo[None].manifest()) result = orig(ui, repo, normalmatcher, prefix, uipathfn, after, force, subrepos, dryrun) -return removelargefiles(ui, repo, False, matcher, dryrun, after=after, -force=force) or result +return removelargefiles(ui, repo, False, matcher, uipathfn, dryrun, +after=after, force=force) or result @eh.wrapfunction(subrepo.hgsubrepo, 'status') def overridestatusfn(orig, repo, rev2, **opts): @@ -1250,11 +1239,11 @@ matchfn = m.matchfn m.matchfn = lambda f: f in s.deleted and matchfn(f) -removelargefiles(repo.ui, repo, True, m, opts.get('dry_run'), +removelargefiles(repo.ui, repo, True, m, uipathfn, opts.get('dry_run'), **pycompat.strkwargs(opts)) # Call into the normal add code, and any files that *should* be added as # largefiles will be -added, bad = addlargefiles(repo.ui, repo, True, matcher, +added, bad = addlargefiles(repo.ui, repo, True, matcher, uipathfn, **pycompat.strkwargs(opts)) # Now that we've handled largefiles, hand off to the original addremove # function to take care of the rest. Make sure it doesn't do anything with To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5911: forget: pass around uipathfn and use instead of m.rel() (API)
martinvonz updated this revision to Diff 13974. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5911?vs=13938=13974 REVISION DETAIL https://phab.mercurial-scm.org/D5911 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -355,7 +355,7 @@ matched by the match function ''' -def forget(self, match, prefix, dryrun, interactive): +def forget(self, match, prefix, uipathfn, dryrun, interactive): return ([], []) def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, @@ -836,8 +836,8 @@ return ctx.walk(match) @annotatesubrepoerror -def forget(self, match, prefix, dryrun, interactive): -return cmdutil.forget(self.ui, self._repo, match, prefix, +def forget(self, match, prefix, uipathfn, dryrun, interactive): +return cmdutil.forget(self.ui, self._repo, match, prefix, uipathfn, True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2258,7 +2258,8 @@ m = scmutil.match(repo[None], pats, opts) dryrun, interactive = opts.get('dry_run'), opts.get('interactive') -rejected = cmdutil.forget(ui, repo, m, prefix="", +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +rejected = cmdutil.forget(ui, repo, m, prefix="", uipathfn=uipathfn, explicitonly=False, dryrun=dryrun, interactive=interactive)[0] return rejected and 1 or 0 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2085,7 +2085,8 @@ for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): +def forget(ui, repo, match, prefix, uipathfn, explicitonly, dryrun, + interactive): if dryrun and interactive: raise error.Abort(_("cannot specify both --dry-run and --interactive")) bad = [] @@ -2102,14 +2103,16 @@ sub = wctx.sub(subpath) submatch = matchmod.subdirmatcher(subpath, match) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) try: -subbad, subforgot = sub.forget(submatch, subprefix, dryrun=dryrun, +subbad, subforgot = sub.forget(submatch, subprefix, subuipathfn, + dryrun=dryrun, interactive=interactive) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % match.rel(subpath)) + % uipathfn(subpath)) if not explicitonly: for f in match.files(): @@ -2124,7 +2127,7 @@ continue ui.warn(_('not removing %s: ' 'file is already untracked\n') -% match.rel(f)) +% uipathfn(f)) bad.append(f) if interactive: @@ -2155,7 +2158,7 @@ for f in forget: if ui.verbose or not match.exact(f) or interactive: -ui.status(_('removing %s\n') % match.rel(f), +ui.status(_('removing %s\n') % uipathfn(f), label='ui.addremove.removed') if not dryrun: diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1067,11 +1067,11 @@ repo.lfstatus = False @eh.wrapfunction(cmdutil, 'forget') -def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, +def cmdutilforget(orig, ui, repo, match, prefix, uipathfn, explicitonly, dryrun, interactive): normalmatcher = composenormalfilematcher(match, repo[None].manifest()) -bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, - interactive) +bad, forgot = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly, + dryrun, interactive) m = composelargefilematcher(match, repo[None].manifest()) try: @@ -1087,12 +1087,12 @@ fstandin = lfutil.standin(f) if fstandin not in repo.dirstate and not repo.wvfs.isdir(fstandin): ui.warn(_('not removing %s: file is already untracked\n') -% m.rel(f)) +
D5903: addremove: pass around uipathfn and use instead of m.uipath() (API)
martinvonz updated this revision to Diff 13970. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5903?vs=13929=13970 REVISION DETAIL https://phab.mercurial-scm.org/D5903 AFFECTED FILES contrib/perf.py hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -290,7 +290,7 @@ def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): return [] -def addremove(self, matcher, prefix, opts): +def addremove(self, matcher, prefix, uipathfn, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -521,13 +521,13 @@ explicitonly, **opts) @annotatesubrepoerror -def addremove(self, m, prefix, opts): +def addremove(self, m, prefix, uipathfn, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True -return scmutil.addremove(self._repo, m, prefix, opts) +return scmutil.addremove(self._repo, m, prefix, uipathfn, opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -763,6 +763,14 @@ '''Create a new uipathfn that treats the file as relative to subpath.''' return lambda f: uipathfn(posixpath.join(subpath, f)) +def anypats(pats, opts): +'''Checks if any patterns, including --include and --exclude were given. + +Some commands (e.g. addremove) use this condition for deciding whether to +print absolute or relative paths. +''' +return bool(pats or opts.get('include') or opts.get('exclude')) + def expandpats(pats): '''Expand bare globs when running on windows. On posix we assume it already has already been done by sh.''' @@ -1031,7 +1039,7 @@ repair.delayedstrip(repo.ui, repo, tostrip, operation, backup=backup) -def addremove(repo, matcher, prefix, opts=None): +def addremove(repo, matcher, prefix, uipathfn, opts=None): if opts is None: opts = {} m = matcher @@ -1052,12 +1060,13 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = subdiruipathfn(subpath, uipathfn) try: -if sub.addremove(submatch, subprefix, opts): +if sub.addremove(submatch, subprefix, subuipathfn, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") - % m.uipath(subpath)) + % uipathfn(subpath)) rejected = [] def badfn(f, msg): @@ -1075,10 +1084,10 @@ for abs in sorted(toprint): if repo.ui.verbose or not m.exact(abs): if abs in unknownset: -status = _('adding %s\n') % m.uipath(abs) +status = _('adding %s\n') % uipathfn(abs) label = 'ui.addremove.added' else: -status = _('removing %s\n') % m.uipath(abs) +status = _('removing %s\n') % uipathfn(abs) label = 'ui.addremove.removed' repo.ui.status(status, label=label) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -255,7 +255,9 @@ if not opts.get('similarity'): opts['similarity'] = '100' matcher = scmutil.match(repo[None], pats, opts) -return scmutil.addremove(repo, matcher, "", opts) +relative = scmutil.anypats(pats, opts) +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=relative) +return scmutil.addremove(repo, matcher, "", uipathfn, opts) @command('annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')), diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2391,7 +2391,9 @@ dsguard = dirstateguard.dirstateguard(repo, 'commit') with dsguard or util.nullcontextmanager(): if dsguard: -if scmutil.addremove(repo, matcher, "", opts) != 0: +relative = scmutil.anypats(pats, opts) +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=relative) +if scmutil.addremove(repo, matcher, "", uipathfn, opts) != 0: raise error.Abort(
D5901: add: pass around uipathfn and use instead of m.rel() (API)
martinvonz updated this revision to Diff 13968. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5901?vs=13921=13968 REVISION DETAIL https://phab.mercurial-scm.org/D5901 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -287,7 +287,7 @@ """ raise NotImplementedError -def add(self, ui, match, prefix, explicitonly, **opts): +def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): return [] def addremove(self, matcher, prefix, opts): @@ -516,8 +516,9 @@ self._repo.vfs.write('hgrc', util.tonativeeol(''.join(lines))) @annotatesubrepoerror -def add(self, ui, match, prefix, explicitonly, **opts): -return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts) +def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): +return cmdutil.add(ui, self._repo, match, prefix, uipathfn, + explicitonly, **opts) @annotatesubrepoerror def addremove(self, m, prefix, opts): @@ -1590,7 +1591,7 @@ return False @annotatesubrepoerror -def add(self, ui, match, prefix, explicitonly, **opts): +def add(self, ui, match, prefix, uipathfn, explicitonly, **opts): if self._gitmissing(): return [] @@ -1614,7 +1615,7 @@ if exact: command.append("-f") #should be added, even if ignored if ui.verbose or not exact: -ui.status(_('adding %s\n') % match.rel(f)) +ui.status(_('adding %s\n') % uipathfn(f)) if f in tracked: # hg prints 'adding' even if already tracked if exact: @@ -1624,7 +1625,7 @@ self._gitcommand(command + [f]) for f in rejected: -ui.warn(_("%s already tracked!\n") % match.rel(f)) +ui.warn(_("%s already tracked!\n") % uipathfn(f)) return rejected diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -11,6 +11,7 @@ import glob import hashlib import os +import posixpath import re import subprocess import weakref @@ -758,6 +759,10 @@ else: return lambda f: f +def subdiruipathfn(subpath, uipathfn): +'''Create a new uipathfn that treats the file as relative to subpath.''' +return lambda f: uipathfn(posixpath.join(subpath, f)) + def expandpats(pats): '''Expand bare globs when running on windows. On posix we assume it already has already been done by sh.''' diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -180,7 +180,8 @@ """ m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts)) -rejected = cmdutil.add(ui, repo, m, "", False, **opts) +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +rejected = cmdutil.add(ui, repo, m, "", uipathfn, False, **opts) return rejected and 1 or 0 @command('addremove', diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2027,7 +2027,7 @@ return iterate() -def add(ui, repo, match, prefix, explicitonly, **opts): +def add(ui, repo, match, prefix, uipathfn, explicitonly, **opts): bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2051,21 +2051,24 @@ cca(f) names.append(f) if ui.verbose or not exact: -ui.status(_('adding %s\n') % match.rel(f), +ui.status(_('adding %s\n') % uipathfn(f), label='ui.addremove.added') for subpath in sorted(wctx.substate): sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) if opts.get(r'subrepos'): -bad.extend(sub.add(ui, submatch, subprefix, False, **opts)) +bad.extend(sub.add(ui, submatch, subprefix, subuipathfn, False, + **opts)) else: -bad.extend(sub.add(ui, submatch, subprefix, True, **opts)) +bad.extend(sub.add(ui, submatch, subprefix, subuipathfn, True, + **opts)) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") - % match.rel(subpath)) + % uipathfn(subpath)) if not opts.get(r'dry_run'): rejected = wctx.add(names, prefix) diff --git a/hgext/largefiles/overrides.py
D5902: remove: pass around uipathfn and use instead of m.rel() (API)
martinvonz updated this revision to Diff 13969. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5902?vs=13928=13969 REVISION DETAIL https://phab.mercurial-scm.org/D5902 AFFECTED FILES hgext/largefiles/overrides.py mercurial/cmdutil.py mercurial/commands.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -358,7 +358,7 @@ def forget(self, match, prefix, dryrun, interactive): return ([], []) -def removefiles(self, matcher, prefix, after, force, subrepos, +def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, dryrun, warnings): """remove the matched files from the subrepository and the filesystem, possibly by force and/or after the file has been removed from the @@ -841,9 +841,9 @@ True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror -def removefiles(self, matcher, prefix, after, force, subrepos, +def removefiles(self, matcher, prefix, uipathfn, after, force, subrepos, dryrun, warnings): -return cmdutil.remove(self.ui, self._repo, matcher, prefix, +return cmdutil.remove(self.ui, self._repo, matcher, prefix, uipathfn, after, force, subrepos, dryrun) @annotatesubrepoerror diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4717,7 +4717,8 @@ m = scmutil.match(repo[None], pats, opts) subrepos = opts.get('subrepos') -return cmdutil.remove(ui, repo, m, "", after, force, subrepos, +uipathfn = scmutil.getuipathfn(repo, forcerelativevalue=True) +return cmdutil.remove(ui, repo, m, "", uipathfn, after, force, subrepos, dryrun=dryrun) @command('rename|move|mv', diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2192,7 +2192,8 @@ return ret -def remove(ui, repo, m, prefix, after, force, subrepos, dryrun, warnings=None): +def remove(ui, repo, m, prefix, uipathfn, after, force, subrepos, dryrun, + warnings=None): ret = 0 s = repo.status(match=m, clean=True) modified, added, deleted, clean = s[0], s[1], s[3], s[6] @@ -2211,16 +2212,17 @@ for subpath in subs: submatch = matchmod.subdirmatcher(subpath, m) subprefix = repo.wvfs.reljoin(prefix, subpath) +subuipathfn = scmutil.subdiruipathfn(subpath, uipathfn) if subrepos or m.exact(subpath) or any(submatch.files()): progress.increment() sub = wctx.sub(subpath) try: -if sub.removefiles(submatch, subprefix, after, force, subrepos, - dryrun, warnings): +if sub.removefiles(submatch, subprefix, subuipathfn, after, + force, subrepos, dryrun, warnings): ret = 1 except error.LookupError: warnings.append(_("skipping missing subrepository: %s\n") - % m.rel(subpath)) + % uipathfn(subpath)) progress.complete() # warn about failure to delete explicit files/dirs @@ -2244,10 +2246,10 @@ if repo.wvfs.exists(f): if repo.wvfs.isdir(f): warnings.append(_('not removing %s: no tracked files\n') -% m.rel(f)) +% uipathfn(f)) else: warnings.append(_('not removing %s: file is untracked\n') -% m.rel(f)) +% uipathfn(f)) # missing files will generate a warning elsewhere ret = 1 progress.complete() @@ -2263,7 +2265,7 @@ progress.increment() if ui.verbose or (f in files): warnings.append(_('not removing %s: file still exists\n') -% m.rel(f)) +% uipathfn(f)) ret = 1 progress.complete() else: @@ -2274,12 +2276,12 @@ for f in modified: progress.increment() warnings.append(_('not removing %s: file is modified (use -f' - ' to force removal)\n') % m.rel(f)) + ' to force removal)\n') % uipathfn(f)) ret = 1 for f in added: progress.increment() warnings.append(_("not removing %s: file has been marked for add" - " (use 'hg forget' to undo add)\n") % m.rel(f)) + " (use 'hg forget' to undo add)\n") % uipathfn(f)) ret = 1 progress.complete() @@ -2289,7 +2291,7 @@ for f in list: if ui.verbose or not m.exact(f):
D5906: match: delete unused uipath() and _uipathrelative (API)
martinvonz updated this revision to Diff 13972. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5906?vs=13931=13972 REVISION DETAIL https://phab.mercurial-scm.org/D5906 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -170,7 +170,7 @@ if patterns: kindpats = normalize(patterns, default, root, cwd, auditor, warn) if _kindpatsalwaysmatch(kindpats): -m = alwaysmatcher(root, cwd, badfn, relativeuipath=True) +m = alwaysmatcher(root, cwd, badfn) else: m = _buildkindpatsmatcher(patternmatcher, root, cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, @@ -252,12 +252,11 @@ class basematcher(object): -def __init__(self, root, cwd, badfn=None, relativeuipath=True): +def __init__(self, root, cwd, badfn=None): self._root = root self._cwd = cwd if badfn is not None: self.bad = badfn -self._relativeuipath = relativeuipath def __call__(self, fn): return self.matchfn(fn) @@ -287,12 +286,6 @@ '''Convert repo path back to path that is relative to cwd of matcher.''' return util.pathto(self._root, self._cwd, f) -def uipath(self, f): -'''Convert repo path to a display path. If patterns or -I/-X were used -to create this matcher, the display path will be relative to cwd. -Otherwise it is relative to the root of the repo.''' -return (self._relativeuipath and self.rel(f)) or self.abs(f) - @propertycache def _files(self): return [] @@ -393,9 +386,8 @@ class alwaysmatcher(basematcher): '''Matches everything.''' -def __init__(self, root, cwd, badfn=None, relativeuipath=False): -super(alwaysmatcher, self).__init__(root, cwd, badfn, -relativeuipath=relativeuipath) +def __init__(self, root, cwd, badfn=None): +super(alwaysmatcher, self).__init__(root, cwd, badfn) def always(self): return True @@ -725,11 +717,9 @@ m.traversedir = m1.traversedir m.abs = m1.abs m.rel = m1.rel -m._relativeuipath |= m1._relativeuipath return m if m2.always(): m = copy.copy(m1) -m._relativeuipath |= m2._relativeuipath return m return intersectionmatcher(m1, m2) @@ -848,9 +838,6 @@ def rel(self, f): return self._matcher.rel(self._path + "/" + f) -def uipath(self, f): -return self._matcher.uipath(self._path + "/" + f) - def matchfn(self, f): # Some information is lost in the superclass's constructor, so we # can not accurately create the matching function for the subdirectory To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5904: largefiles: use uipathfn instead of match.{rel, uipath}() (API)
martinvonz updated this revision to Diff 13971. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5904?vs=13924=13971 REVISION DETAIL https://phab.mercurial-scm.org/D5904 AFFECTED FILES hgext/largefiles/overrides.py CHANGE DETAILS diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -78,7 +78,7 @@ m.matchfn = lambda f: notlfile(f) and origmatchfn(f) return m -def addlargefiles(ui, repo, isaddremove, matcher, **opts): +def addlargefiles(ui, repo, isaddremove, matcher, uipathfn, **opts): large = opts.get(r'large') lfsize = lfutil.getminsize( ui, lfutil.islfilesrepo(repo), opts.get(r'lfsize')) @@ -99,17 +99,11 @@ nfile = f in wctx exists = lfile or nfile -# addremove in core gets fancy with the name, add doesn't -if isaddremove: -name = m.uipath(f) -else: -name = m.rel(f) - # Don't warn the user when they attempt to add a normal tracked file. # The normal add code will do that for us. if exact and exists: if lfile: -ui.warn(_('%s already a largefile\n') % name) +ui.warn(_('%s already a largefile\n') % uipathfn(f)) continue if (exact or not exists) and not lfutil.isstandin(f): @@ -123,7 +117,7 @@ if large or abovemin or (lfmatcher and lfmatcher(f)): lfnames.append(f) if ui.verbose or not exact: -ui.status(_('adding %s as a largefile\n') % name) +ui.status(_('adding %s as a largefile\n') % uipathfn(f)) bad = [] @@ -150,7 +144,7 @@ added = [f for f in lfnames if f not in bad] return added, bad -def removelargefiles(ui, repo, isaddremove, matcher, dryrun, **opts): +def removelargefiles(ui, repo, isaddremove, matcher, uipathfn, dryrun, **opts): after = opts.get(r'after') m = composelargefilematcher(matcher, repo[None].manifest()) try: @@ -166,7 +160,7 @@ def warn(files, msg): for f in files: -ui.warn(msg % m.rel(f)) +ui.warn(msg % uipathfn(f)) return int(len(files) > 0) if after: @@ -186,12 +180,7 @@ lfdirstate = lfutil.openlfdirstate(ui, repo) for f in sorted(remove): if ui.verbose or not m.exact(f): -# addremove in core gets fancy with the name, remove doesn't -if isaddremove: -name = m.uipath(f) -else: -name = m.rel(f) -ui.status(_('removing %s\n') % name) +ui.status(_('removing %s\n') % uipathfn(f)) if not dryrun: if not after: @@ -240,7 +229,7 @@ if opts.get(r'normal'): return orig(ui, repo, matcher, prefix, uipathfn, explicitonly, **opts) -ladded, lbad = addlargefiles(ui, repo, False, matcher, **opts) +ladded, lbad = addlargefiles(ui, repo, False, matcher, uipathfn, **opts) normalmatcher = composenormalfilematcher(matcher, repo[None].manifest(), ladded) bad = orig(ui, repo, normalmatcher, prefix, uipathfn, explicitonly, **opts) @@ -254,8 +243,8 @@ normalmatcher = composenormalfilematcher(matcher, repo[None].manifest()) result = orig(ui, repo, normalmatcher, prefix, uipathfn, after, force, subrepos, dryrun) -return removelargefiles(ui, repo, False, matcher, dryrun, after=after, -force=force) or result +return removelargefiles(ui, repo, False, matcher, uipathfn, dryrun, +after=after, force=force) or result @eh.wrapfunction(subrepo.hgsubrepo, 'status') def overridestatusfn(orig, repo, rev2, **opts): @@ -1250,11 +1239,11 @@ matchfn = m.matchfn m.matchfn = lambda f: f in s.deleted and matchfn(f) -removelargefiles(repo.ui, repo, True, m, opts.get('dry_run'), +removelargefiles(repo.ui, repo, True, m, uipathfn, opts.get('dry_run'), **pycompat.strkwargs(opts)) # Call into the normal add code, and any files that *should* be added as # largefiles will be -added, bad = addlargefiles(repo.ui, repo, True, matcher, +added, bad = addlargefiles(repo.ui, repo, True, matcher, uipathfn, **pycompat.strkwargs(opts)) # Now that we've handled largefiles, hand off to the original addremove # function to take care of the rest. Make sure it doesn't do anything with To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5894: patch: replace "prefix" and "relroot" arguments by "pathfn" (API)
martinvonz updated this revision to Diff 13967. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5894?vs=13927=13967 REVISION DETAIL https://phab.mercurial-scm.org/D5894 AFFECTED FILES mercurial/context.py mercurial/logcmdutil.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -15,7 +15,6 @@ import errno import hashlib import os -import posixpath import re import shutil import zlib @@ -2239,7 +2238,7 @@ difffeatureopts = diffutil.difffeatureopts def diff(repo, node1=None, node2=None, match=None, changes=None, - opts=None, losedatafn=None, prefix='', relroot='', copy=None, + opts=None, losedatafn=None, pathfn=None, copy=None, copysourcematch=None, hunksfilterfn=None): '''yields diff of changes to files between two nodes, or node and working directory. @@ -2277,9 +2276,8 @@ ctx2 = repo[node2] for fctx1, fctx2, hdr, hunks in diffhunks( -repo, ctx1=ctx1, ctx2=ctx2, -match=match, changes=changes, opts=opts, -losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, +repo, ctx1=ctx1, ctx2=ctx2, match=match, changes=changes, opts=opts, +losedatafn=losedatafn, pathfn=pathfn, copy=copy, copysourcematch=copysourcematch): if hunksfilterfn is not None: # If the file has been removed, fctx2 is None; but this should @@ -2294,9 +2292,8 @@ if text: yield text -def diffhunks(repo, ctx1, ctx2, match=None, changes=None, - opts=None, losedatafn=None, prefix='', relroot='', copy=None, - copysourcematch=None): +def diffhunks(repo, ctx1, ctx2, match=None, changes=None, opts=None, + losedatafn=None, pathfn=None, copy=None, copysourcematch=None): """Yield diff of changes to files in the form of (`header`, `hunks`) tuples where `header` is a list of diff headers and `hunks` is an iterable of (`hunkrange`, `hunklines`) tuples. @@ -2376,7 +2373,7 @@ def difffn(opts, losedata): return trydiff(repo, revs, ctx1, ctx2, modified, added, removed, - copy, getfilectx, opts, losedata, prefix, relroot) + copy, getfilectx, opts, losedata, pathfn) if opts.upgrade and not opts.git: try: def losedata(fn): @@ -2591,16 +2588,14 @@ yield f1, f2, copyop def trydiff(repo, revs, ctx1, ctx2, modified, added, removed, -copy, getfilectx, opts, losedatafn, prefix, relroot): +copy, getfilectx, opts, losedatafn, pathfn): '''given input data, generate a diff and yield it in blocks If generating a diff would lose data like flags or binary data and losedatafn is not None, it will be called. -relroot is removed and prefix is added to every path in the diff output. - -If relroot is not empty, this function expects every path in modified, -added, removed and copy to start with it.''' +pathfn is applied to every path in the diff output. +''' def gitindex(text): if not text: @@ -2628,12 +2623,8 @@ gitmode = {'l': '12', 'x': '100755', '': '100644'} -if relroot != '' and (repo.ui.configbool('devel', 'all-warnings') - or repo.ui.configbool('devel', 'check-relroot')): -for f in modified + added + removed + list(copy) + list(copy.values()): -if f is not None and not f.startswith(relroot): -raise AssertionError( -"file %s doesn't start with relroot %s" % (f, relroot)) +if not pathfn: +pathfn = lambda f: f for f1, f2, copyop in _filepairs(modified, added, removed, copy, opts): content1 = None @@ -2670,10 +2661,8 @@ (f1 and f2 and flag1 != flag2)): losedatafn(f2 or f1) -path1 = f1 or f2 -path2 = f2 or f1 -path1 = posixpath.join(prefix, path1[len(relroot):]) -path2 = posixpath.join(prefix, path2[len(relroot):]) +path1 = pathfn(f1 or f2) +path2 = pathfn(f2 or f1) header = [] if opts.git: header.append('diff --git %s%s %s%s' % diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -9,6 +9,7 @@ import itertools import os +import posixpath from .i18n import _ from .node import ( @@ -65,6 +66,8 @@ else: relroot = '' copysourcematch = None +def pathfn(f): +return posixpath.join(prefix, f) if relroot != '': # XXX relative roots currently don't work if the root is within a # subrepo @@ -79,14 +82,22 @@ match = matchmod.intersectmatchers(match, relrootmatch) copysourcematch = relrootmatch +checkroot = (repo.ui.configbool('devel',
D5917: annotate: respect ui.relative-paths for "binary file" message
This revision was automatically updated to reflect the committed changes. Closed by commit rHG446e1dcc3b5c: annotate: respect ui.relative-paths for binary file message (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5917?vs=13944=13965 REVISION DETAIL https://phab.mercurial-scm.org/D5917 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 @@ -407,12 +407,13 @@ if skiprevs: skiprevs = scmutil.revrange(repo, skiprevs) +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) for abs in ctx.walk(m): fctx = ctx[abs] rootfm.startitem() rootfm.data(path=abs) if not opts.get('text') and fctx.isbinary(): -rootfm.plain(_("%s: binary file\n") % m.rel(abs)) +rootfm.plain(_("%s: binary file\n") % uipathfn(abs)) continue fm = rootfm.nested('lines', tmpl='{rev}: {line}') To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5898: debugignore: respect ui.relative-paths
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbe8741d42836: debugignore: respect ui.relative-paths (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5898?vs=13918=13966 REVISION DETAIL https://phab.mercurial-scm.org/D5898 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 @@ -1086,6 +1086,7 @@ ui.write("%s\n" % pycompat.byterepr(ignore)) else: m = scmutil.match(repo[None], pats=files) +uipathfn = scmutil.getuipathfn(repo, legacyrelativevalue=True) for f in m.files(): nf = util.normpath(f) ignored = None @@ -1102,16 +1103,16 @@ break if ignored: if ignored == nf: -ui.write(_("%s is ignored\n") % m.uipath(f)) +ui.write(_("%s is ignored\n") % uipathfn(f)) else: ui.write(_("%s is ignored because of " "containing folder %s\n") - % (m.uipath(f), ignored)) + % (uipathfn(f), ignored)) ignorefile, lineno, line = ignoredata ui.write(_("(ignore rule in %s, line %d: '%s')\n") % (ignorefile, lineno, line)) else: -ui.write(_("%s is not ignored\n") % m.uipath(f)) +ui.write(_("%s is not ignored\n") % uipathfn(f)) @command('debugindex', cmdutil.debugrevlogopts + cmdutil.formatteropts, _('-c|-m|FILE')) To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 10 of 10] transaction: include txnname in the hookargs dictionary
# HG changeset patch # User Boris Feld # Date 1549749690 -3600 # Sat Feb 09 23:01:30 2019 +0100 # Node ID f4936120d74a81199068bed14a04ac65f24f6109 # Parent 62d13ee8373ad4a7c97192680a4781fe5818a1df # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r f4936120d74a transaction: include txnname in the hookargs dictionary There is no reason to not include the txnname alongside the txnid in all case. So let's do that. If the transaction name is useful to internal code, it can be useful for hooks. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1811,7 +1811,6 @@ class localrepository(object): args = tr.hookargs.copy() args.update(bookmarks.preparehookargs(name, old, new)) repo.hook('pretxnclose-bookmark', throw=True, - txnname=desc, **pycompat.strkwargs(args)) if hook.hashook(repo.ui, 'pretxnclose-phase'): cl = repo.unfiltered().changelog @@ -1819,11 +1818,11 @@ class localrepository(object): args = tr.hookargs.copy() node = hex(cl.node(rev)) args.update(phases.preparehookargs(node, old, new)) -repo.hook('pretxnclose-phase', throw=True, txnname=desc, +repo.hook('pretxnclose-phase', throw=True, **pycompat.strkwargs(args)) repo.hook('pretxnclose', throw=True, - txnname=desc, **pycompat.strkwargs(tr.hookargs)) + **pycompat.strkwargs(tr.hookargs)) def releasefn(tr, success): repo = reporef() if success: @@ -1857,6 +1856,7 @@ class localrepository(object): tr.changes['bookmarks'] = {} tr.hookargs['txnid'] = txnid +tr.hookargs['txnname'] = desc # note: writing the fncache only during finalize mean that the file is # outdated when running hooks. As fncache is used for streaming clone, # this is not expected to break anything that happen during the hooks. @@ -1878,7 +1878,7 @@ class localrepository(object): args = tr.hookargs.copy() args.update(bookmarks.preparehookargs(name, old, new)) repo.hook('txnclose-bookmark', throw=False, - txnname=desc, **pycompat.strkwargs(args)) + **pycompat.strkwargs(args)) if hook.hashook(repo.ui, 'txnclose-phase'): cl = repo.unfiltered().changelog @@ -1887,10 +1887,10 @@ class localrepository(object): args = tr.hookargs.copy() node = hex(cl.node(rev)) args.update(phases.preparehookargs(node, old, new)) -repo.hook('txnclose-phase', throw=False, txnname=desc, +repo.hook('txnclose-phase', throw=False, **pycompat.strkwargs(args)) -repo.hook('txnclose', throw=False, txnname=desc, +repo.hook('txnclose', throw=False, **pycompat.strkwargs(hookargs)) reporef()._afterlock(hookfunc) tr.addfinalize('txnclose-hook', txnclosehook) @@ -1902,7 +1902,7 @@ class localrepository(object): def txnaborthook(tr2): """To be run if transaction is aborted """ -reporef().hook('txnabort', throw=False, txnname=desc, +reporef().hook('txnabort', throw=False, **pycompat.strkwargs(tr2.hookargs)) tr.addabort('txnabort-hook', txnaborthook) # avoid eager cache invalidation. in-memory data should be identical diff --git a/tests/test-bundle.t b/tests/test-bundle.t --- a/tests/test-bundle.t +++ b/tests/test-bundle.t @@ -239,6 +239,8 @@ hg -R bundle://../full.hg verify HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf HG_SOURCE=pull HG_TXNID=TXN:$ID$ + HG_TXNNAME=pull + bundle:../full.hg HG_URL=bundle:../full.hg (run 'hg heads' to see heads, 'hg merge' to merge) @@ -270,6 +272,8 @@ Pull full.hg into empty again (using -R; HG_NODE_LAST=aa35859c02ea8bd48da5da68cd2740ac71afcbaf HG_SOURCE=pull HG_TXNID=TXN:$ID$ + HG_TXNNAME=pull + bundle:empty+full.hg HG_URL=bundle:empty+full.hg (run 'hg heads' to see heads, 'hg merge' to merge) diff --git a/tests/test-bundle2-multiple-changegroups.t b/tests/test-bundle2-multiple-changegroups.t --- a/tests/test-bundle2-multiple-changegroups.t +++ b/tests/test-bundle2-multiple-changegroups.t @@ -88,6 +88,8 @@ Pull the new commits in the clone HG_PENDING=$TESTTMP/clone HG_SOURCE=pull HG_TXNID=TXN:$ID$ +
[PATCH 08 of 10] test: use `printenv.py --line` in `test-ssh.t`
# HG changeset patch # User Boris Feld # Date 1549671859 -3600 # Sat Feb 09 01:24:19 2019 +0100 # Node ID a625670bc72dc8ad2b950d77fb5a72e004b911c7 # Parent c9b41ca8817953610befc9a8e89eed6e98b5a8f0 # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a625670bc72d test: use `printenv.py --line` in `test-ssh.t` This makes the output easier to update and read. diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -36,7 +36,7 @@ configure for serving > uncompressed = True > > [hooks] - > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog" + > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog" > EOF $ cd $TESTTMP @@ -563,7 +563,15 @@ debug output Got arguments 1:user@dummy 2:hg -R local serve --stdio Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP + changegroup-in-remote hook: HG_BUNDLE2=1 + HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 + HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 + HG_SOURCE=serve + HG_TXNID=TXN:$ID$ + HG_URL=remote:ssh:$LOCALIP + Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio @@ -573,9 +581,25 @@ debug output Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP + changegroup-in-remote hook: HG_BUNDLE2=1 + HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 + HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 + HG_SOURCE=serve + HG_TXNID=TXN:$ID$ + HG_URL=remote:ssh:$LOCALIP + Got arguments 1:user@dummy 2:chg -R remote serve --stdio (chg !) - changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP (chg !) + changegroup-in-remote hook: HG_BUNDLE2=1 (chg !) + HG_HOOKNAME=changegroup (chg !) + HG_HOOKTYPE=changegroup (chg !) + HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !) + HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 (chg !) + HG_SOURCE=serve (chg !) + HG_TXNID=TXN:$ID$ (chg !) + HG_URL=remote:ssh:$LOCALIP (chg !) + (chg !) Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg init 'a repo' Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio @@ -583,9 +607,18 @@ debug output Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP + changegroup-in-remote hook: HG_BUNDLE2=1 + HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 + HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 + HG_SOURCE=serve + HG_TXNID=TXN:$ID$ + HG_URL=remote:ssh:$LOCALIP + Got arguments 1:user@dummy 2:hg -R remote serve --stdio + remote hook failure is attributed to remote $ cat > $TESTTMP/failhook << EOF ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 09 of 10] test: use `printenv.py --line` in `test-static-http.t`
# HG changeset patch # User Boris Feld # Date 1549671872 -3600 # Sat Feb 09 01:24:32 2019 +0100 # Node ID 62d13ee8373ad4a7c97192680a4781fe5818a1df # Parent a625670bc72dc8ad2b950d77fb5a72e004b911c7 # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 62d13ee8373a test: use `printenv.py --line` in `test-static-http.t` This makes the output easier to update and read. diff --git a/tests/test-static-http.t b/tests/test-static-http.t --- a/tests/test-static-http.t +++ b/tests/test-static-http.t @@ -57,7 +57,7 @@ check for HTTP opener failures when cach $ cd ../local $ cat >> .hg/hgrc < [hooks] - > changegroup = sh -c "printenv.py changegroup" + > changegroup = sh -c "printenv.py --line changegroup" > EOF $ hg pull pulling from static-http://localhost:$HGPORT/remote @@ -67,7 +67,14 @@ check for HTTP opener failures when cach adding file changes added 1 changesets with 1 changes to 1 files new changesets 4ac2e3648604 - changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_NODE_LAST=4ac2e3648604439c580c69b09ec9d93a88d93432 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT/remote + changegroup hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=4ac2e3648604439c580c69b09ec9d93a88d93432 + HG_NODE_LAST=4ac2e3648604439c580c69b09ec9d93a88d93432 + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=http://localhost:$HGPORT/remote + (run 'hg update' to get a working copy) trying to push ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 07 of 10] test: use `printenv.py --line` in `test-ssh-bundle1.t`
# HG changeset patch # User Boris Feld # Date 1549671829 -3600 # Sat Feb 09 01:23:49 2019 +0100 # Node ID c9b41ca8817953610befc9a8e89eed6e98b5a8f0 # Parent 57b13716b11564118f9ade8808c4ccff2e0eeaab # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c9b41ca88179 test: use `printenv.py --line` in `test-ssh-bundle1.t` This makes the output easier to update and read. 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 @@ -46,7 +46,7 @@ configure for serving > uncompressed = True > > [hooks] - > changegroup = sh -c "printenv.py changegroup-in-remote 0 ../dummylog" + > changegroup = sh -c "printenv.py --line changegroup-in-remote 0 ../dummylog" > EOF $ cd $TESTTMP @@ -131,7 +131,7 @@ verify checked 3 changesets with 2 changes to 2 files $ cat >> .hg/hgrc < [hooks] - > changegroup = sh -c "printenv.py changegroup-in-local 0 ../dummylog" + > changegroup = sh -c "printenv.py --line changegroup-in-local 0 ../dummylog" > EOF empty default pull @@ -514,7 +514,14 @@ debug output Got arguments 1:user@dummy 2:hg -R local serve --stdio Got arguments 1:user@dummy 2:hg -R $TESTTMP/local serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP + changegroup-in-remote hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 + HG_NODE_LAST=a28a9d1a809cab7d4e2fde4bee738a9ede948b60 + HG_SOURCE=serve + HG_TXNID=TXN:$ID$ + HG_URL=remote:ssh:$LOCALIP + Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio @@ -524,7 +531,14 @@ debug output Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP + changegroup-in-remote hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=1383141674ec756a6056f6a9097618482fe0f4a6 + HG_NODE_LAST=1383141674ec756a6056f6a9097618482fe0f4a6 + HG_SOURCE=serve + HG_TXNID=TXN:$ID$ + HG_URL=remote:ssh:$LOCALIP + Got arguments 1:user@dummy 2:hg -R remote serve --stdio Got arguments 1:user@dummy 2:hg init 'a repo' Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio @@ -532,7 +546,14 @@ debug output Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio Got arguments 1:user@dummy 2:hg -R 'a repo' serve --stdio Got arguments 1:user@dummy 2:hg -R remote serve --stdio - changegroup-in-remote hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:ssh:$LOCALIP + changegroup-in-remote hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=65c38f4125f9602c8db4af56530cc221d93b8ef8 + HG_NODE_LAST=65c38f4125f9602c8db4af56530cc221d93b8ef8 + HG_SOURCE=serve + HG_TXNID=TXN:$ID$ + HG_URL=remote:ssh:$LOCALIP + Got arguments 1:user@dummy 2:hg -R remote serve --stdio remote hook failure is attributed to remote ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 06 of 10] test: use `printenv.py --line` in `test-push-http.t`
# HG changeset patch # User Boris Feld # Date 1549671809 -3600 # Sat Feb 09 01:23:29 2019 +0100 # Node ID 57b13716b11564118f9ade8808c4ccff2e0eeaab # Parent a49388cc4f239e28d47a9f61992a58957e8e2bca # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 57b13716b115 test: use `printenv.py --line` in `test-push-http.t` This makes the output easier to update and read. diff --git a/tests/test-push-http.t b/tests/test-push-http.t --- a/tests/test-push-http.t +++ b/tests/test-push-http.t @@ -74,8 +74,8 @@ expect success $ cat >> .hg/hgrc < allow_push = * > [hooks] - > changegroup = sh -c "printenv.py changegroup 0" - > pushkey = sh -c "printenv.py pushkey 0" + > changegroup = sh -c "printenv.py --line changegroup 0" + > pushkey = sh -c "printenv.py --line pushkey 0" > txnclose-phase.test = sh $TESTTMP/hook.sh > EOF $ req "--debug --config extensions.blackbox=" @@ -94,8 +94,15 @@ expect success remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public - remote: running hook changegroup: sh -c "printenv.py changegroup 0" - remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + remote: running hook changegroup: sh -c "printenv.py --line changegroup 0" + remote: changegroup hook: HG_HOOKNAME=changegroup + remote: HG_HOOKTYPE=changegroup + remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 + remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 + remote: HG_SOURCE=serve + remote: HG_TXNID=TXN:$ID$ + remote: HG_URL=remote:http:$LOCALIP: (glob) + remote: % serve errors $ hg rollback repository tip rolled back to revision 0 (undo serve) @@ -114,8 +121,15 @@ expect success remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public remote: running hook txnclose-phase.test: sh $TESTTMP/hook.sh remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public - remote: running hook changegroup: sh -c "printenv.py changegroup 0" - remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + remote: running hook changegroup: sh -c "printenv.py --line changegroup 0" + remote: changegroup hook: HG_HOOKNAME=changegroup + remote: HG_HOOKTYPE=changegroup + remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 + remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 + remote: HG_SOURCE=serve + remote: HG_TXNID=TXN:$ID$ + remote: HG_URL=remote:http:$LOCALIP: (glob) + remote: % serve errors $ hg rollback repository tip rolled back to revision 0 (undo serve) @@ -125,8 +139,8 @@ expect success $ cat >> .hg/hgrc < allow_push = * > [hooks] - > changegroup = sh -c "printenv.py changegroup 0" - > pushkey = sh -c "printenv.py pushkey 0" + > changegroup = sh -c "printenv.py --line changegroup 0" + > pushkey = sh -c "printenv.py --line pushkey 0" > txnclose-phase.test = sh $TESTTMP/hook.sh > EOF $ req @@ -138,7 +152,15 @@ expect success remote: added 1 changesets with 1 changes to 1 files remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public - remote: changegroup hook: HG_BUNDLE2=1 HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$ HG_URL=remote:http:$LOCALIP: (glob) + remote: changegroup hook: HG_BUNDLE2=1 + remote: HG_HOOKNAME=changegroup + remote: HG_HOOKTYPE=changegroup + remote: HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 + remote: HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 + remote: HG_SOURCE=serve + remote: HG_TXNID=TXN:$ID$ + remote: HG_URL=remote:http:$LOCALIP: (glob) + remote: % serve errors $ hg rollback repository tip rolled back to revision 0 (undo serve) @@ -157,8 +179,16 @@ expect success, server lacks the httphea remote: added 1 changesets with 1 changes to 1 files remote: phase-move: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b: draft -> public remote: phase-move: ba677d0156c1196c1a699fa53f390dcfc3ce3872: -> public - remote: changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_NODE_LAST=ba677d0156c1196c1a699fa53f390dcfc3ce3872 HG_SOURCE=serve HG_TXNID=TXN:$ID$
[PATCH 05 of 10] test: use `printenv.py --line` in `test-https.t`
# HG changeset patch # User Boris Feld # Date 1549671740 -3600 # Sat Feb 09 01:22:20 2019 +0100 # Node ID a49388cc4f239e28d47a9f61992a58957e8e2bca # Parent 558d98d70bd179e79d8e24510933425062118ace # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r a49388cc4f23 test: use `printenv.py --line` in `test-https.t` This makes the output easier to update and read. diff --git a/tests/test-https.t b/tests/test-https.t --- a/tests/test-https.t +++ b/tests/test-https.t @@ -207,7 +207,7 @@ pull without cacert $ cd copy-pull $ cat >> .hg/hgrc < [hooks] - > changegroup = sh -c "printenv.py changegroup" + > changegroup = sh -c "printenv.py --line changegroup" > EOF $ hg pull $DISABLECACERTS pulling from https://localhost:$HGPORT/ @@ -226,7 +226,14 @@ pull without cacert adding file changes added 1 changesets with 1 changes to 1 files new changesets 5fed3813f7f5 - changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=https://localhost:$HGPORT/ + changegroup hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d + HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=https://localhost:$HGPORT/ + (run 'hg update' to get a working copy) $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 03 of 10] test: use `printenv.py --line` in `test-hook.t`
# HG changeset patch # User Boris Feld # Date 1549671603 -3600 # Sat Feb 09 01:20:03 2019 +0100 # Node ID 6179e9a9970f23c881187c71705cfe7347ed5c08 # Parent c0b16be6b9b2d9535be8f1f2c91c5a8ebffa0b03 # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 6179e9a9970f test: use `printenv.py --line` in `test-hook.t` This makes the output easier to update and read. diff --git a/tests/test-hook.t b/tests/test-hook.t --- a/tests/test-hook.t +++ b/tests/test-hook.t @@ -14,32 +14,63 @@ commit hooks can see env vars $ cd a $ cat > .hg/hgrc < [hooks] - > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" - > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" - > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" - > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" + > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit" + > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py --line commit.b" + > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py --line precommit" + > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxncommit" > pretxncommit.tip = hg -q tip - > pre-identify = sh -c "printenv.py pre-identify 1" - > pre-cat = sh -c "printenv.py pre-cat" - > post-cat = sh -c "printenv.py post-cat" - > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" - > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" - > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" + > pre-identify = sh -c "printenv.py --line pre-identify 1" + > pre-cat = sh -c "printenv.py --line pre-cat" + > post-cat = sh -c "printenv.py --line post-cat" + > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnopen" + > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line pretxnclose" + > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnclose" > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs - > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" + > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py --line txnabort" > txnclose.checklock = sh -c "hg debuglock > /dev/null" > EOF $ echo a > a $ hg add a $ hg commit -m a - precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1= - pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit - pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1= HG_PENDING=$TESTTMP/a + precommit hook: HG_HOOKNAME=precommit + HG_HOOKTYPE=precommit + HG_PARENT1= + + pretxnopen hook: HG_HOOKNAME=pretxnopen + HG_HOOKTYPE=pretxnopen + HG_TXNID=TXN:$ID$ + HG_TXNNAME=commit + + pretxncommit hook: HG_HOOKNAME=pretxncommit + HG_HOOKTYPE=pretxncommit + HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b + HG_PARENT1= + HG_PENDING=$TESTTMP/a + 0:cb9a9f314b8b - pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit - txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit - commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1= - commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1= + pretxnclose hook: HG_HOOKNAME=pretxnclose + HG_HOOKTYPE=pretxnclose + HG_PENDING=$TESTTMP/a + HG_PHASES_MOVED=1 + HG_TXNID=TXN:$ID$ + HG_TXNNAME=commit + + txnclose hook: HG_HOOKNAME=txnclose + HG_HOOKTYPE=txnclose + HG_PHASES_MOVED=1 + HG_TXNID=TXN:$ID$ + HG_TXNNAME=commit + + commit hook: HG_HOOKNAME=commit + HG_HOOKTYPE=commit + HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b + HG_PARENT1= + + commit.b hook: HG_HOOKNAME=commit.b + HG_HOOKTYPE=commit + HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b + HG_PARENT1= + $ hg clone . ../b updating to branch default @@ -50,9 +81,9 @@ changegroup hooks can see env vars $ cat > .hg/hgrc < [hooks] - > prechangegroup = sh -c "printenv.py prechangegroup" - > changegroup = sh -c "printenv.py changegroup" - > incoming = sh -c "printenv.py incoming" + > prechangegroup = sh -c "printenv.py --line prechangegroup" + > changegroup = sh -c "printenv.py --line changegroup" + > incoming = sh -c "printenv.py --line incoming" > EOF pretxncommit and commit hooks can see both parents of merge @@ -60,103 +91,309 @@ pretxncommit and commit hooks
[PATCH 02 of 10] test: use `printenv.py --line` in `test-bundle2-multiple-changegroups.t`
# HG changeset patch # User Boris Feld # Date 1549671583 -3600 # Sat Feb 09 01:19:43 2019 +0100 # Node ID c0b16be6b9b2d9535be8f1f2c91c5a8ebffa0b03 # Parent 1736fe7d07d8a96349dc678f7a7bcba29886d1a7 # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c0b16be6b9b2 test: use `printenv.py --line` in `test-bundle2-multiple-changegroups.t` This makes the output easier to update and read. diff --git a/tests/test-bundle2-multiple-changegroups.t b/tests/test-bundle2-multiple-changegroups.t --- a/tests/test-bundle2-multiple-changegroups.t +++ b/tests/test-bundle2-multiple-changegroups.t @@ -66,9 +66,9 @@ Add two linear commits $ cd ../clone $ cat >> .hg/hgrc < [hooks] - > pretxnchangegroup = sh -c "printenv.py pretxnchangegroup" - > changegroup = sh -c "printenv.py changegroup" - > incoming = sh -c "printenv.py incoming" + > pretxnchangegroup = sh -c "printenv.py --line pretxnchangegroup" + > changegroup = sh -c "printenv.py --line changegroup" + > incoming = sh -c "printenv.py --line incoming" > EOF Pull the new commits in the clone @@ -81,18 +81,63 @@ Pull the new commits in the clone adding manifests adding file changes added 1 changesets with 1 changes to 1 files - pretxnchangegroup hook: HG_HOOKNAME=pretxnchangegroup HG_HOOKTYPE=pretxnchangegroup HG_NODE=27547f69f25460a52fff66ad004e58da7ad3fb56 HG_NODE_LAST=27547f69f25460a52fff66ad004e58da7ad3fb56 HG_PENDING=$TESTTMP/clone HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo + pretxnchangegroup hook: HG_HOOKNAME=pretxnchangegroup + HG_HOOKTYPE=pretxnchangegroup + HG_NODE=27547f69f25460a52fff66ad004e58da7ad3fb56 + HG_NODE_LAST=27547f69f25460a52fff66ad004e58da7ad3fb56 + HG_PENDING=$TESTTMP/clone + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=file:$TESTTMP/repo + remote: changegroup2 adding changesets adding manifests adding file changes added 1 changesets with 1 changes to 1 files - pretxnchangegroup hook: HG_HOOKNAME=pretxnchangegroup HG_HOOKTYPE=pretxnchangegroup HG_NODE=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 HG_NODE_LAST=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 HG_PENDING=$TESTTMP/clone HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo + pretxnchangegroup hook: HG_HOOKNAME=pretxnchangegroup + HG_HOOKTYPE=pretxnchangegroup + HG_NODE=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 + HG_NODE_LAST=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 + HG_PENDING=$TESTTMP/clone + HG_PHASES_MOVED=1 + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=file:$TESTTMP/repo + new changesets 27547f69f254:f838bfaca5c7 - changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=27547f69f25460a52fff66ad004e58da7ad3fb56 HG_NODE_LAST=27547f69f25460a52fff66ad004e58da7ad3fb56 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo - incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=27547f69f25460a52fff66ad004e58da7ad3fb56 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo - changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 HG_NODE_LAST=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo - incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo + changegroup hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=27547f69f25460a52fff66ad004e58da7ad3fb56 + HG_NODE_LAST=27547f69f25460a52fff66ad004e58da7ad3fb56 + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=file:$TESTTMP/repo + + incoming hook: HG_HOOKNAME=incoming + HG_HOOKTYPE=incoming + HG_NODE=27547f69f25460a52fff66ad004e58da7ad3fb56 + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=file:$TESTTMP/repo + + changegroup hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 + HG_NODE_LAST=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 + HG_PHASES_MOVED=1 + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=file:$TESTTMP/repo + + incoming hook: HG_HOOKNAME=incoming + HG_HOOKTYPE=incoming + HG_NODE=f838bfaca5c7226600ebcfd84f3c3c13a28d3757 + HG_PHASES_MOVED=1 + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=file:$TESTTMP/repo + pullop.cgresult is 1 (run 'hg update' to get a working copy) $ hg update @@ -152,21 +197,86 @@ pullop.cgresult adding manifests adding file changes added 2 changesets with 2 changes to 2 files (+1 heads) - pretxnchangegroup hook: HG_HOOKNAME=pretxnchangegroup HG_HOOKTYPE=pretxnchangegroup HG_NODE=b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e HG_NODE_LAST=8a5212ebc8527f9fb821601504794e3eb11a1ed3 HG_PENDING=$TESTTMP/clone HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/repo + pretxnchangegroup hook:
[PATCH 04 of 10] test: use `printenv.py --line` in `test-http-bundle1.t`
# HG changeset patch # User Boris Feld # Date 1549671635 -3600 # Sat Feb 09 01:20:35 2019 +0100 # Node ID 558d98d70bd179e79d8e24510933425062118ace # Parent 6179e9a9970f23c881187c71705cfe7347ed5c08 # EXP-Topic hook.txname # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 558d98d70bd1 test: use `printenv.py --line` in `test-http-bundle1.t` This makes the output easier to update and read. diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t --- a/tests/test-http-bundle1.t +++ b/tests/test-http-bundle1.t @@ -151,7 +151,7 @@ pull $ cd copy-pull $ cat >> .hg/hgrc < [hooks] - > changegroup = sh -c "printenv.py changegroup" + > changegroup = sh -c "printenv.py --line changegroup" > EOF $ hg pull pulling from http://localhost:$HGPORT1/ @@ -161,7 +161,14 @@ pull adding file changes added 1 changesets with 1 changes to 1 files new changesets 5fed3813f7f5 - changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=http://localhost:$HGPORT1/ + changegroup hook: HG_HOOKNAME=changegroup + HG_HOOKTYPE=changegroup + HG_NODE=5fed3813f7f5e1824344fdc9cf8f63bb662c292d + HG_NODE_LAST=5fed3813f7f5e1824344fdc9cf8f63bb662c292d + HG_SOURCE=pull + HG_TXNID=TXN:$ID$ + HG_URL=http://localhost:$HGPORT1/ + (run 'hg update' to get a working copy) $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5914: cat: respect ui.relative-paths for "skipping missing subrepository"
pulkit added a comment. This does not has any dependency in phabricator but fails to apply cleanly on @ in hg-committed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5914 To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5783: blackbox: test that unsetting track disables blackbox logging
This revision was automatically updated to reflect the committed changes. Closed by commit rHG31dfe7026f8d: blackbox: test that unsetting track disables blackbox logging (authored by spectral, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5783?vs=13653=13962 REVISION DETAIL https://phab.mercurial-scm.org/D5783 AFFECTED FILES tests/test-blackbox.t CHANGE DETAILS diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t --- a/tests/test-blackbox.t +++ b/tests/test-blackbox.t @@ -354,6 +354,17 @@ warning: cannot write to blackbox.log: $TESTTMP/gone/.hg/blackbox.log: $ENOTDIR$ (windows !) $ cd .. +blackbox should disable itself if track is empty + + $ hg --config blackbox.track= init nothing_tracked + $ cd nothing_tracked + $ cat >> .hg/hgrc << EOF + > [blackbox] + > track = + > EOF + $ hg blackbox + $ cd $TESTTMP + #if chg when using chg, blackbox.log should get rotated correctly To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5886: subrepo: adjust subrepo prefix before calling subrepo.diff() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3d094bfaf885: subrepo: adjust subrepo prefix before calling subrepo.diff() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5886?vs=13925=13960 REVISION DETAIL https://phab.mercurial-scm.org/D5886 AFFECTED FILES mercurial/logcmdutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -11,7 +11,6 @@ import errno import hashlib import os -import posixpath import re import stat import subprocess @@ -556,10 +555,9 @@ # in hex format if node2 is not None: node2 = node.bin(node2) -logcmdutil.diffordiffstat(ui, self._repo, diffopts, - node1, node2, match, - prefix=posixpath.join(prefix, self._path), - listsubrepos=True, **opts) +logcmdutil.diffordiffstat(ui, self._repo, diffopts, node1, node2, + match, prefix=prefix, listsubrepos=True, + **opts) except error.RepoLookupError as inst: self.ui.warn(_('warning: error "%s" in subrepository "%s"\n') % (inst, subrelpath(self))) @@ -1779,14 +1777,12 @@ # for Git, this also implies '-p' cmd.append('-U%d' % diffopts.context) -gitprefix = self.wvfs.reljoin(prefix, self._path) - if diffopts.noprefix: -cmd.extend(['--src-prefix=%s/' % gitprefix, -'--dst-prefix=%s/' % gitprefix]) +cmd.extend(['--src-prefix=%s/' % prefix, +'--dst-prefix=%s/' % prefix]) else: -cmd.extend(['--src-prefix=a/%s/' % gitprefix, -'--dst-prefix=b/%s/' % gitprefix]) +cmd.extend(['--src-prefix=a/%s/' % prefix, +'--dst-prefix=b/%s/' % prefix]) if diffopts.ignorews: cmd.append('--ignore-all-space') diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -123,8 +123,9 @@ # subpath. The best we can do is to ignore it. tempnode2 = None submatch = matchmod.subdirmatcher(subpath, match) +subprefix = repo.wvfs.reljoin(prefix, subpath) sub.diff(ui, diffopts, tempnode2, submatch, changes=changes, - stat=stat, fp=fp, prefix=prefix) + stat=stat, fp=fp, prefix=subprefix) class changesetdiffer(object): """Generate diff of changeset with pre-configured filtering functions""" To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5885: subrepo: adjust subrepo prefix before calling subrepo.addremove() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5ee3c49fc9cd: subrepo: adjust subrepo prefix before calling subrepo.addremove() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5885?vs=13896=13959 REVISION DETAIL https://phab.mercurial-scm.org/D5885 AFFECTED FILES mercurial/scmutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -527,8 +527,7 @@ # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True -return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts) +return scmutil.addremove(self._repo, m, prefix, opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1047,8 +1047,9 @@ submatch = matchmod.subdirmatcher(subpath, m) if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) +subprefix = repo.wvfs.reljoin(prefix, subpath) try: -if sub.addremove(submatch, prefix, opts): +if sub.addremove(submatch, subprefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n") To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5883: subrepo: adjust subrepo prefix before calling subrepo.forget() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf92844cb942c: subrepo: adjust subrepo prefix before calling subrepo.forget() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5883?vs=13894=13958 REVISION DETAIL https://phab.mercurial-scm.org/D5883 AFFECTED FILES mercurial/cmdutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -840,8 +840,7 @@ @annotatesubrepoerror def forget(self, match, prefix, dryrun, interactive): -return cmdutil.forget(self.ui, self._repo, match, - self.wvfs.reljoin(prefix, self._path), +return cmdutil.forget(self.ui, self._repo, match, prefix, True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2097,9 +2097,10 @@ for subpath in sorted(wctx.substate): sub = wctx.sub(subpath) +submatch = matchmod.subdirmatcher(subpath, match) +subprefix = repo.wvfs.reljoin(prefix, subpath) try: -submatch = matchmod.subdirmatcher(subpath, match) -subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun, +subbad, subforgot = sub.forget(submatch, subprefix, dryrun=dryrun, interactive=interactive) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5884: subrepo: adjust subrepo prefix before calling subrepo.add() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGed046348675c: subrepo: adjust subrepo prefix before calling subrepo.add() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5884?vs=13895=13957 REVISION DETAIL https://phab.mercurial-scm.org/D5884 AFFECTED FILES mercurial/cmdutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -518,9 +518,7 @@ @annotatesubrepoerror def add(self, ui, match, prefix, explicitonly, **opts): -return cmdutil.add(ui, self._repo, match, - self.wvfs.reljoin(prefix, self._path), - explicitonly, **opts) +return cmdutil.add(ui, self._repo, match, prefix, explicitonly, **opts) @annotatesubrepoerror def addremove(self, m, prefix, opts): diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2059,10 +2059,11 @@ sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) +subprefix = repo.wvfs.reljoin(prefix, subpath) if opts.get(r'subrepos'): -bad.extend(sub.add(ui, submatch, prefix, False, **opts)) +bad.extend(sub.add(ui, submatch, subprefix, False, **opts)) else: -bad.extend(sub.add(ui, submatch, prefix, True, **opts)) +bad.extend(sub.add(ui, submatch, subprefix, True, **opts)) except error.LookupError: ui.status(_("skipping missing subrepository: %s\n") % join(subpath)) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5882: subrepo: adjust subrepo prefix before calling subrepo.removefiles() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2c549abc6b85: subrepo: adjust subrepo prefix before calling subrepo.removefiles() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5882?vs=13893=13956 REVISION DETAIL https://phab.mercurial-scm.org/D5882 AFFECTED FILES mercurial/cmdutil.py mercurial/subrepo.py CHANGE DETAILS diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -847,8 +847,7 @@ @annotatesubrepoerror def removefiles(self, matcher, prefix, after, force, subrepos, dryrun, warnings): -return cmdutil.remove(self.ui, self._repo, matcher, - self.wvfs.reljoin(prefix, self._path), +return cmdutil.remove(self.ui, self._repo, matcher, prefix, after, force, subrepos, dryrun) @annotatesubrepoerror diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2208,11 +2208,12 @@ unit=_('subrepos')) for subpath in subs: submatch = matchmod.subdirmatcher(subpath, m) +subprefix = repo.wvfs.reljoin(prefix, subpath) if subrepos or m.exact(subpath) or any(submatch.files()): progress.increment() sub = wctx.sub(subpath) try: -if sub.removefiles(submatch, prefix, after, force, subrepos, +if sub.removefiles(submatch, subprefix, after, force, subrepos, dryrun, warnings): ret = 1 except error.LookupError: To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5881: subrepo: avoid calculating subrepo prefix twice for cat() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG93620a4ba88d: subrepo: avoid calculating subrepo prefix twice for cat() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5881?vs=13892=13955 REVISION DETAIL https://phab.mercurial-scm.org/D5881 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2361,14 +2361,12 @@ sub = ctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, matcher) - -if not sub.cat(submatch, basefm, fntemplate, - os.path.join(prefix, sub._path), +subprefix = os.path.join(prefix, sub._path) +if not sub.cat(submatch, basefm, fntemplate, subprefix, **pycompat.strkwargs(opts)): err = 0 except error.RepoLookupError: -ui.status(_("skipping missing subrepository: %s\n") - % os.path.join(prefix, subpath)) +ui.status(_("skipping missing subrepository: %s\n") % subprefix) return err To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5878: py3: make sure __repr__ returns str
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3751595ec45e: py3: make sure __repr__ returns str (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5878?vs=13887=13954 REVISION DETAIL https://phab.mercurial-scm.org/D5878 AFFECTED FILES mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -363,7 +363,7 @@ return self._ispatchinga(afile) and self._ispatchingb(bfile) def __repr__(self): -return "" % (self.op, self.path) +return r"" % (self.op, self.path) def readgitpatch(lr): """extract git-style metadata about patches from """ To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5879: py3: use bytes.startswith() instead of comparing with bytes[0]
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7c4e205f71ca: py3: use bytes.startswith() instead of comparing with bytes[0] (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5879?vs=13888=13953 REVISION DETAIL https://phab.mercurial-scm.org/D5879 AFFECTED FILES contrib/python3-whitelist mercurial/crecord.py CHANGE DETAILS diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -377,9 +377,9 @@ def countchanges(self): """changedlines -> (n+,n-)""" add = len([l for l in self.changedlines if l.applied - and l.prettystr()[0] == '+']) +and l.prettystr().startswith('+')]) rem = len([l for l in self.changedlines if l.applied - and l.prettystr()[0] == '-']) +and l.prettystr().startswith('-')]) return add, rem def getfromtoline(self): @@ -423,7 +423,7 @@ changedlinestr = changedline.prettystr() if changedline.applied: hunklinelist.append(changedlinestr) -elif changedlinestr[0] == "-": +elif changedlinestr.startswith("-"): hunklinelist.append(" " + changedlinestr[1:]) fp.write(''.join(self.before + hunklinelist + self.after)) @@ -471,11 +471,11 @@ for line in self.changedlines: text = line.linetext if line.applied: -if text[0] == '+': +if text.startswith('+'): dels.append(text[1:]) -elif text[0] == '-': +elif text.startswith('-'): adds.append(text[1:]) -elif text[0] == '+': +elif text.startswith('+'): dels.append(text[1:]) adds.append(text[1:]) hunk = ['-%s' % l for l in dels] + ['+%s' % l for l in adds] diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -89,6 +89,7 @@ test-close-head.t test-commandserver.t test-commit-amend.t +test-commit-interactive-curses.t test-commit-interactive.t test-commit-multiple.t test-commit-unresolved.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5918: tests: replace match.match(exact=True) by match.exact()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0dc3ed4e712c: tests: replace match.match(exact=True) by match.exact() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5918?vs=13945=13951 REVISION DETAIL https://phab.mercurial-scm.org/D5918 AFFECTED FILES tests/test-manifest.py tests/test-match.py CHANGE DETAILS diff --git a/tests/test-match.py b/tests/test-match.py --- a/tests/test-match.py +++ b/tests/test-match.py @@ -185,8 +185,7 @@ class ExactMatcherTests(unittest.TestCase): def testVisitdir(self): -m = matchmod.match(b'x', b'', patterns=[b'dir/subdir/foo.txt'], - exact=True) +m = matchmod.exact(b'x', b'', files=[b'dir/subdir/foo.txt']) assert isinstance(m, matchmod.exactmatcher) self.assertTrue(m.visitdir(b'.')) self.assertTrue(m.visitdir(b'dir')) @@ -197,8 +196,7 @@ self.assertFalse(m.visitdir(b'folder')) def testVisitchildrenset(self): -m = matchmod.match(b'x', b'', patterns=[b'dir/subdir/foo.txt'], - exact=True) +m = matchmod.exact(b'x', b'', files=[b'dir/subdir/foo.txt']) assert isinstance(m, matchmod.exactmatcher) self.assertEqual(m.visitchildrenset(b'.'), {b'dir'}) self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'}) @@ -208,12 +206,11 @@ self.assertEqual(m.visitchildrenset(b'folder'), set()) def testVisitchildrensetFilesAndDirs(self): -m = matchmod.match(b'x', b'', patterns=[b'rootfile.txt', -b'a/file1.txt', -b'a/b/file2.txt', -# no file in a/b/c -b'a/b/c/d/file4.txt'], - exact=True) +m = matchmod.exact(b'x', b'', files=[b'rootfile.txt', + b'a/file1.txt', + b'a/b/file2.txt', + # no file in a/b/c + b'a/b/c/d/file4.txt']) assert isinstance(m, matchmod.exactmatcher) self.assertEqual(m.visitchildrenset(b'.'), {b'a', b'rootfile.txt'}) self.assertEqual(m.visitchildrenset(b'a'), {b'b', b'file1.txt'}) diff --git a/tests/test-manifest.py b/tests/test-manifest.py --- a/tests/test-manifest.py +++ b/tests/test-manifest.py @@ -289,8 +289,8 @@ the resulting manifest.''' m = self.parsemanifest(A_HUGE_MANIFEST) -match = matchmod.match(b'/', b'', -[b'file1', b'file200', b'file300'], exact=True) +match = matchmod.exact(b'/', b'', +[b'file1', b'file200', b'file300']) m2 = m.matches(match) w = (b'file1\0%sx\n' @@ -304,10 +304,9 @@ ''' m = self.parsemanifest(A_DEEPER_MANIFEST) -match = matchmod.match(b'/', b'', +match = matchmod.exact(b'/', b'', [b'a/b/c/bar.txt', b'a/b/d/qux.py', - b'readme.txt', b'nonexistent'], -exact=True) + b'readme.txt', b'nonexistent']) m2 = m.matches(match) self.assertEqual( @@ -330,7 +329,7 @@ m = self.parsemanifest(A_HUGE_MANIFEST) flist = m.keys()[80:300] -match = matchmod.match(b'/', b'', flist, exact=True) +match = matchmod.exact(b'/', b'', flist) m2 = m.matches(match) self.assertEqual(flist, m2.keys()) @@ -364,7 +363,7 @@ against a directory.''' m = self.parsemanifest(A_DEEPER_MANIFEST) -match = matchmod.match(b'/', b'', [b'a/b'], exact=True) +match = matchmod.exact(b'/', b'', [b'a/b']) m2 = m.matches(match) self.assertEqual([], m2.keys()) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5919: match: remove unused "exact" argument (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG635a12c53ea6: match: remove unused exact argument (API) (authored by martinvonz, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D5919?vs=13946=13952#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5919?vs=13946=13952 REVISION DETAIL https://phab.mercurial-scm.org/D5919 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -115,7 +115,7 @@ return unionmatcher(matchers) def match(root, cwd, patterns=None, include=None, exclude=None, default='glob', - exact=False, auditor=None, ctx=None, listsubrepos=False, warn=None, + auditor=None, ctx=None, listsubrepos=False, warn=None, badfn=None, icasefs=False): """build an object to match a set of file patterns @@ -126,7 +126,6 @@ include - patterns to include (unless they are excluded) exclude - patterns to exclude (even if they are included) default - if a pattern in patterns has no explicit type, assume this one -exact - patterns are actually filenames (include/exclude still apply) warn - optional function used for printing warnings badfn - optional bad() callback for this matcher instead of the default icasefs - make a matcher for wdir on case insensitive filesystems, which @@ -150,9 +149,6 @@ """ normalize = _donormalize if icasefs: -if exact: -raise error.ProgrammingError("a case-insensitive exact matcher " - "doesn't make sense") dirstate = ctx.repo().dirstate dsnormalize = dirstate.normalize @@ -171,9 +167,7 @@ kindpats.append((kind, pats, source)) return kindpats -if exact: -m = exactmatcher(root, cwd, patterns, badfn) -elif patterns: +if patterns: kindpats = normalize(patterns, default, root, cwd, auditor, warn) if _kindpatsalwaysmatch(kindpats): m = alwaysmatcher(root, cwd, badfn, relativeuipath=True) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5893: patch: accept second matcher that applies only to copy sources (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG74f53d3bd685: patch: accept second matcher that applies only to copy sources (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5893?vs=13926=13950 REVISION DETAIL https://phab.mercurial-scm.org/D5893 AFFECTED FILES mercurial/context.py mercurial/logcmdutil.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2240,7 +2240,7 @@ def diff(repo, node1=None, node2=None, match=None, changes=None, opts=None, losedatafn=None, prefix='', relroot='', copy=None, - hunksfilterfn=None): + copysourcematch=None, hunksfilterfn=None): '''yields diff of changes to files between two nodes, or node and working directory. @@ -2264,6 +2264,9 @@ copy, if not empty, should contain mappings {dst@y: src@x} of copy information. +if copysourcematch is not None, then copy sources will be filtered by this +matcher + hunksfilterfn, if not None, should be a function taking a filectx and hunks generator that may yield filtered hunks. ''' @@ -2277,7 +2280,7 @@ repo, ctx1=ctx1, ctx2=ctx2, match=match, changes=changes, opts=opts, losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, -): +copysourcematch=copysourcematch): if hunksfilterfn is not None: # If the file has been removed, fctx2 is None; but this should # not occur here since we catch removed files early in @@ -2292,7 +2295,8 @@ yield text def diffhunks(repo, ctx1, ctx2, match=None, changes=None, - opts=None, losedatafn=None, prefix='', relroot='', copy=None): + opts=None, losedatafn=None, prefix='', relroot='', copy=None, + copysourcematch=None): """Yield diff of changes to files in the form of (`header`, `hunks`) tuples where `header` is a list of diff headers and `hunks` is an iterable of (`hunkrange`, `hunklines`) tuples. @@ -2337,11 +2341,11 @@ if opts.git or opts.upgrade: copy = copies.pathcopies(ctx1, ctx2, match=match) -if relroot: -# filter out copies where source side isn't inside the relative root +if copysourcematch: +# filter out copies where source side isn't inside the matcher # (copies.pathcopies() already filtered out the destination) copy = {dst: src for dst, src in copy.iteritems() -if src.startswith(relroot)} +if copysourcematch(src)} modifiedset = set(modified) addedset = set(added) diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -64,6 +64,7 @@ relroot = pathutil.canonpath(repo.root, repo.getcwd(), root) else: relroot = '' +copysourcematch = None if relroot != '': # XXX relative roots currently don't work if the root is within a # subrepo @@ -76,15 +77,17 @@ relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') match = matchmod.intersectmatchers(match, relrootmatch) +copysourcematch = relrootmatch if stat: diffopts = diffopts.copy(context=0, noprefix=False) width = 80 if not ui.plain(): width = ui.termwidth() - graphwidth chunks = ctx2.diff(ctx1, match, changes, opts=diffopts, prefix=prefix, - relroot=relroot, hunksfilterfn=hunksfilterfn) + relroot=relroot, copysourcematch=copysourcematch, + hunksfilterfn=hunksfilterfn) if fp is not None or ui.canwritewithoutlabels(): out = fp or ui diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -295,15 +295,16 @@ def diff(self, ctx2=None, match=None, changes=None, opts=None, losedatafn=None, prefix='', relroot='', copy=None, - hunksfilterfn=None): + copysourcematch=None, hunksfilterfn=None): """Returns a diff generator for the given contexts and matcher""" if ctx2 is None: ctx2 = self.p1() if ctx2 is not None: ctx2 = self._repo[ctx2] return patch.diff(self._repo, ctx2, self, match=match, changes=changes, opts=opts, losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, + copysourcematch=copysourcematch, hunksfilterfn=hunksfilterfn) def dirs(self): To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list
D5892: patch: let caller pass in root-filtering matcher (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG035cae1d197f: patch: let caller pass in root-filtering matcher (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5892?vs=13906=13949 REVISION DETAIL https://phab.mercurial-scm.org/D5892 AFFECTED FILES mercurial/logcmdutil.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -32,7 +32,6 @@ encoding, error, mail, -match as matchmod, mdiff, pathutil, pycompat, @@ -2320,10 +2319,6 @@ return getfilectx getfilectx = lrugetfilectx() -if relroot: -relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') -match = matchmod.intersectmatchers(match, relrootmatch) - if not changes: changes = ctx1.status(ctx2, match=match) modified, added, removed = changes[:3] diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -74,6 +74,9 @@ ui.warn(_('warning: %s not inside relative root %s\n') % ( match.uipath(matchroot), uirelroot)) +relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') +match = matchmod.intersectmatchers(match, relrootmatch) + if stat: diffopts = diffopts.copy(context=0, noprefix=False) width = 80 To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5891: patch: pass in context objects into diffhunks() (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe834f6f6f221: patch: pass in context objects into diffhunks() (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5891?vs=13905=13948 REVISION DETAIL https://phab.mercurial-scm.org/D5891 AFFECTED FILES mercurial/hgweb/webutil.py mercurial/patch.py CHANGE DETAILS diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -2268,8 +2268,14 @@ hunksfilterfn, if not None, should be a function taking a filectx and hunks generator that may yield filtered hunks. ''' +if not node1 and not node2: +node1 = repo.dirstate.p1() + +ctx1 = repo[node1] +ctx2 = repo[node2] + for fctx1, fctx2, hdr, hunks in diffhunks( -repo, node1=node1, node2=node2, +repo, ctx1=ctx1, ctx2=ctx2, match=match, changes=changes, opts=opts, losedatafn=losedatafn, prefix=prefix, relroot=relroot, copy=copy, ): @@ -2286,7 +2292,7 @@ if text: yield text -def diffhunks(repo, node1=None, node2=None, match=None, changes=None, +def diffhunks(repo, ctx1, ctx2, match=None, changes=None, opts=None, losedatafn=None, prefix='', relroot='', copy=None): """Yield diff of changes to files in the form of (`header`, `hunks`) tuples where `header` is a list of diff headers and `hunks` is an iterable of @@ -2298,9 +2304,6 @@ if opts is None: opts = mdiff.defaultopts -if not node1 and not node2: -node1 = repo.dirstate.p1() - def lrugetfilectx(): cache = {} order = collections.deque() @@ -2317,9 +2320,6 @@ return getfilectx getfilectx = lrugetfilectx() -ctx1 = repo[node1] -ctx2 = repo[node2] - if relroot: relrootmatch = scmutil.match(ctx2, pats=[relroot], default='path') match = matchmod.intersectmatchers(match, relrootmatch) diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -570,11 +570,9 @@ m = match.always(repo.root, repo.getcwd()) diffopts = patch.diffopts(repo.ui, untrusted=True) -node1 = basectx.node() -node2 = ctx.node() parity = paritygen(stripecount) -diffhunks = patch.diffhunks(repo, node1, node2, m, opts=diffopts) +diffhunks = patch.diffhunks(repo, basectx, ctx, m, opts=diffopts) for blockno, (fctx1, fctx2, header, hunks) in enumerate(diffhunks, 1): if style != 'raw': header = header[1:] To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5920: remotefilelog: replace matchandpats() by match()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It doesn't seem like replacing "pats" was useful here. Replacing ("",) by [] doesn't seem like it would make a difference and glob-expansion only happens on Windows. It seem like we should just pass the patterns on to orig() unmodified. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5920 AFFECTED FILES hgext/remotefilelog/__init__.py CHANGE DETAILS diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py --- a/hgext/remotefilelog/__init__.py +++ b/hgext/remotefilelog/__init__.py @@ -902,8 +902,7 @@ # If this is a non-follow log without any revs specified, recommend that # the user add -f to speed it up. if not follow and not revs: -match, pats = scmutil.matchandpats(repo['.'], pats, - pycompat.byteskwargs(opts)) +match = scmutil.match(repo['.'], pats, pycompat.byteskwargs(opts)) isfile = not match.anypats() if isfile: for file in match.files(): To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5919: match: remove unused "exact" argument (API)
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It seems that all callers use match.exact() instead of match.match(exact=True). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5919 AFFECTED FILES mercurial/match.py CHANGE DETAILS diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -115,7 +115,7 @@ return unionmatcher(matchers) def match(root, cwd, patterns=None, include=None, exclude=None, default='glob', - exact=False, auditor=None, ctx=None, listsubrepos=False, warn=None, + auditor=None, ctx=None, listsubrepos=False, warn=None, badfn=None, icasefs=False): """build an object to match a set of file patterns @@ -126,7 +126,6 @@ include - patterns to include (unless they are excluded) exclude - patterns to exclude (even if they are included) default - if a pattern in patterns has no explicit type, assume this one -exact - patterns are actually filenames (include/exclude still apply) warn - optional function used for printing warnings badfn - optional bad() callback for this matcher instead of the default icasefs - make a matcher for wdir on case insensitive filesystems, which @@ -150,9 +149,6 @@ """ normalize = _donormalize if icasefs: -if exact: -raise error.ProgrammingError("a case-insensitive exact matcher " - "doesn't make sense") dirstate = ctx.repo().dirstate dsnormalize = dirstate.normalize @@ -171,9 +167,7 @@ kindpats.append((kind, pats, source)) return kindpats -if exact: -m = exactmatcher(root, cwd, patterns, badfn) -elif patterns: +if patterns: kindpats = normalize(patterns, default, root, cwd, auditor, warn) if _kindpatsalwaysmatch(kindpats): m = alwaysmatcher(root, cwd, badfn) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5918: tests: replace match.match(exact=True) by match.exact()
martinvonz 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/D5918 AFFECTED FILES tests/test-manifest.py tests/test-match.py CHANGE DETAILS diff --git a/tests/test-match.py b/tests/test-match.py --- a/tests/test-match.py +++ b/tests/test-match.py @@ -185,8 +185,7 @@ class ExactMatcherTests(unittest.TestCase): def testVisitdir(self): -m = matchmod.match(b'x', b'', patterns=[b'dir/subdir/foo.txt'], - exact=True) +m = matchmod.exact(b'x', b'', files=[b'dir/subdir/foo.txt']) assert isinstance(m, matchmod.exactmatcher) self.assertTrue(m.visitdir(b'.')) self.assertTrue(m.visitdir(b'dir')) @@ -197,8 +196,7 @@ self.assertFalse(m.visitdir(b'folder')) def testVisitchildrenset(self): -m = matchmod.match(b'x', b'', patterns=[b'dir/subdir/foo.txt'], - exact=True) +m = matchmod.exact(b'x', b'', files=[b'dir/subdir/foo.txt']) assert isinstance(m, matchmod.exactmatcher) self.assertEqual(m.visitchildrenset(b'.'), {b'dir'}) self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'}) @@ -208,12 +206,11 @@ self.assertEqual(m.visitchildrenset(b'folder'), set()) def testVisitchildrensetFilesAndDirs(self): -m = matchmod.match(b'x', b'', patterns=[b'rootfile.txt', -b'a/file1.txt', -b'a/b/file2.txt', -# no file in a/b/c -b'a/b/c/d/file4.txt'], - exact=True) +m = matchmod.exact(b'x', b'', files=[b'rootfile.txt', + b'a/file1.txt', + b'a/b/file2.txt', + # no file in a/b/c + b'a/b/c/d/file4.txt']) assert isinstance(m, matchmod.exactmatcher) self.assertEqual(m.visitchildrenset(b'.'), {b'a', b'rootfile.txt'}) self.assertEqual(m.visitchildrenset(b'a'), {b'b', b'file1.txt'}) diff --git a/tests/test-manifest.py b/tests/test-manifest.py --- a/tests/test-manifest.py +++ b/tests/test-manifest.py @@ -289,8 +289,8 @@ the resulting manifest.''' m = self.parsemanifest(A_HUGE_MANIFEST) -match = matchmod.match(b'/', b'', -[b'file1', b'file200', b'file300'], exact=True) +match = matchmod.exact(b'/', b'', +[b'file1', b'file200', b'file300']) m2 = m.matches(match) w = (b'file1\0%sx\n' @@ -304,10 +304,9 @@ ''' m = self.parsemanifest(A_DEEPER_MANIFEST) -match = matchmod.match(b'/', b'', +match = matchmod.exact(b'/', b'', [b'a/b/c/bar.txt', b'a/b/d/qux.py', - b'readme.txt', b'nonexistent'], -exact=True) + b'readme.txt', b'nonexistent']) m2 = m.matches(match) self.assertEqual( @@ -330,7 +329,7 @@ m = self.parsemanifest(A_HUGE_MANIFEST) flist = m.keys()[80:300] -match = matchmod.match(b'/', b'', flist, exact=True) +match = matchmod.exact(b'/', b'', flist) m2 = m.matches(match) self.assertEqual(flist, m2.keys()) @@ -364,7 +363,7 @@ against a directory.''' m = self.parsemanifest(A_DEEPER_MANIFEST) -match = matchmod.match(b'/', b'', [b'a/b'], exact=True) +match = matchmod.exact(b'/', b'', [b'a/b']) m2 = m.matches(match) self.assertEqual([], m2.keys()) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel