D1679: rebase: fix for hgsubversion
phillco created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY https://phab.mercurial-scm.org/rHG5c25fe7fb1e63a31ed082dfcb93673fa79cf081f broke something in the hgsubversion test path, causing it raise an abort (Abort: nothing to merge) during a perfectly good rebase. I tracked it down to this change. It's probably not hgsubversion related. I suspect that using the same `wctx` from before the initial update causes problems with the wctx's cached manifest property. I noticed we also sometimes stick random gunk on the wctx object in other places (like in `copies.py`) so it's probably best to reset it for now. The line I added before was actually useless since we don't pass wctx to the initial `merge.update`, so it defaults to `repo[None]`. So I just removed it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1679 AFFECTED FILES hgext/rebase.py CHANGE DETAILS diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1102,13 +1102,14 @@ if wctx.isinmemory(): wctx.setbase(repo[p1]) else: -# This is necessary to invalidate workingctx's caches. -wctx = repo[None] if repo['.'].rev() != p1: repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1])) mergemod.update(repo, p1, False, True) else: repo.ui.debug(" already in destination\n") +# This is, alas, necessary to invalidate workingctx's manifest cache, +# as well as other data we litter on it in other places. +wctx = repo[None] repo.dirstate.write(repo.currenttransaction()) repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev])) if base is not None: To: phillco, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] run-tests: accept '\' vs '/' path differences without '(glob)'
> On Dec 13, 2017, at 12:40 AM, Martin von Zweigbergk> wrote: > > Is it this patch that broke test-run-tests.t? See > https://buildbot.mercurial-scm.org/builders/hg%20tests/builds/1357/steps/run-tests.py%20%28python%202.7.10%29/logs/stdio. > I haven't even tried to verify, but Matt and I were both on the blame > list for the broken build and it didn't seem related to anything I > did. My guess is that it’s this one: https://www.mercurial-scm.org/repo/hg-all/rev/fd61bad1a338 I noticed the .replace() wasn’t doing anything useful when I tried adding the other patterns to common-patterns.py last night. Somehow, it not only passed on Windows and Linux for me, it provided the correct output when I eliminated the existing output. Maybe try dropping that tuple in run-tests.py, since I don’t think it’s needed any more. Sorry about that. >> On Mon, Dec 11, 2017 at 5:48 AM, Augie Fackler wrote: >> >>> On Dec 11, 2017, at 00:24, Matt Harbison wrote: >>> >>> On Sun, 10 Dec 2017 18:28:03 -0500, Augie Fackler wrote: >>> > On Dec 10, 2017, at 5:39 PM, Matt Harbison wrote: > > On Sun, 10 Dec 2017 16:48:26 -0500, Augie Fackler > wrote: > >> >>> On Dec 10, 2017, at 3:47 PM, Matt Harbison >>> wrote: >>> >>> # HG changeset patch >>> # User Matt Harbison >>> # Date 1512882971 18000 >>> # Sun Dec 10 00:16:11 2017 -0500 >>> # Node ID ebc7a05d9389989fc2e81d30fa1c10dd01be9a76 >>> # Parent e1119050f15e2169ac766e6a69eeab70729e9e40 >>> run-tests: accept '\' vs '/' path differences without '(glob)’ >> >> series queued, many thanks >> >> […] >> >>> It's probably unreasonable to submit a single patch that wipes out all >>> of the >>> (glob) instances that were only used to hide path differences, given >>> the churn >>> from other contributors. Since their presence isn't harming the tests, >>> these >>> can be removed through attrition. >> >> You could do it if you wanted with a skip-blame annotation as was done >> in d92dc725223b. Then we can pass the right filter to `hg annotate` and >> not see the noop changes. Not a requirement though, don’t feel obligated >> to do so. >>> >>> OK, done. But 3 of 3 isn't showing up in the mail archive, and at ~290K >>> for that patch, I would have expected a digest email too. So something >>> choked. I'll try to check tomorrow around 8:30 EST and resend if needed, >>> before too much more activity occurs. >> >> It probably got stuck in moderation. I'll mod it through. >> >>> >>> Random thought: should these # skip-blame markers also imply a default skip >>> in bisect? It's probably too late to change the name now... >> >> probably not? It's not a default skip in blame, you have to specify the flag >> anyway... >> ___ >> Mercurial-devel mailing list >> Mercurial-devel@mercurial-scm.org >> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] run-tests: accept '\' vs '/' path differences without '(glob)'
Is it this patch that broke test-run-tests.t? See https://buildbot.mercurial-scm.org/builders/hg%20tests/builds/1357/steps/run-tests.py%20%28python%202.7.10%29/logs/stdio. I haven't even tried to verify, but Matt and I were both on the blame list for the broken build and it didn't seem related to anything I did. On Mon, Dec 11, 2017 at 5:48 AM, Augie Facklerwrote: > >> On Dec 11, 2017, at 00:24, Matt Harbison wrote: >> >> On Sun, 10 Dec 2017 18:28:03 -0500, Augie Fackler wrote: >> >>> On Dec 10, 2017, at 5:39 PM, Matt Harbison wrote: On Sun, 10 Dec 2017 16:48:26 -0500, Augie Fackler wrote: > >> On Dec 10, 2017, at 3:47 PM, Matt Harbison wrote: >> >> # HG changeset patch >> # User Matt Harbison >> # Date 1512882971 18000 >> # Sun Dec 10 00:16:11 2017 -0500 >> # Node ID ebc7a05d9389989fc2e81d30fa1c10dd01be9a76 >> # Parent e1119050f15e2169ac766e6a69eeab70729e9e40 >> run-tests: accept '\' vs '/' path differences without '(glob)’ > > series queued, many thanks > > […] > >> It's probably unreasonable to submit a single patch that wipes out all >> of the >> (glob) instances that were only used to hide path differences, given the >> churn >> from other contributors. Since their presence isn't harming the tests, >> these >> can be removed through attrition. > > You could do it if you wanted with a skip-blame annotation as was done in > d92dc725223b. Then we can pass the right filter to `hg annotate` and not > see the noop changes. Not a requirement though, don’t feel obligated to > do so. >> >> OK, done. But 3 of 3 isn't showing up in the mail archive, and at ~290K for >> that patch, I would have expected a digest email too. So something choked. >> I'll try to check tomorrow around 8:30 EST and resend if needed, before too >> much more activity occurs. > > It probably got stuck in moderation. I'll mod it through. > >> >> Random thought: should these # skip-blame markers also imply a default skip >> in bisect? It's probably too late to change the name now... > > probably not? It's not a default skip in blame, you have to specify the flag > anyway... > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] lfs: use 'ui' provided to `upgrade` for output, instead of stealing srcrepo's
# HG changeset patch # User Matt Harbison# Date 1513128518 18000 # Tue Dec 12 20:28:38 2017 -0500 # Node ID d170af7c54722ee27aa5249e704cbfba404c0fa4 # Parent 380a4fb92c06e6725ec3027661ecf6f6d9e6cd1d lfs: use 'ui' provided to `upgrade` for output, instead of stealing srcrepo's Also spotted by Yuya. diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py --- a/hgext/lfs/wrapper.py +++ b/hgext/lfs/wrapper.py @@ -313,7 +313,7 @@ for dirpath, dirs, files in srclfsvfs.walk(): for oid in files: -srcrepo.ui.write(_('copying lfs blob %s\n') % oid) +ui.write(_('copying lfs blob %s\n') % oid) lfutil.link(srclfsvfs.join(oid), dstlfsvfs.join(oid)) def upgraderequirements(orig, repo): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] lfs: correct the directory list value returned by lfsvfs.walk()
# HG changeset patch # User Matt Harbison# Date 1513128158 18000 # Tue Dec 12 20:22:38 2017 -0500 # Node ID 380a4fb92c06e6725ec3027661ecf6f6d9e6cd1d # Parent 37d923cdeba923f4964befcc3d0789362a433a35 lfs: correct the directory list value returned by lfsvfs.walk() Spotted by Yuya. diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -34,7 +34,7 @@ return super(lfsvfs, self).join(path[0:2], path[2:]) def walk(self, path=None, onerror=None): -"""Yield (dirpath, '', oids) tuple for blobs under path +"""Yield (dirpath, [], oids) tuple for blobs under path Oids only exist in the root of this vfs, so dirpath is always ''. """ @@ -53,7 +53,7 @@ oids.extend([dirpath + f for f in files if _lfsre.match(dirpath + f)]) -yield ('', '', oids) +yield ('', [], oids) class filewithprogress(object): """a file-like object that supports __len__ and read. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1678: revset: pass pre-optimized tree in revset.matchany()
pulkit added a subscriber: yuja. pulkit added a comment. @yuja am I headed in the right direction? (I am not sure about whether the API's I changed are used by extensions or not) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1678 To: pulkit, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1678: revset: pass pre-optimized tree in revset.matchany()
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is a part of series where we move logic around so that we can get the tree at a higher level function such as repo.anyrevs(). This will help us in reading the tree and doing certain operations like updating visibility exceptions on base of that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1678 AFFECTED FILES mercurial/localrepo.py mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2163,26 +2163,25 @@ def match(ui, spec, repo=None): """Create a matcher for a single revision spec""" -return matchany(ui, [spec], repo=repo) + +if not specs: +return emptymatcher +if not all(specs): +raise error.ParseError(_("empty query")) + +tree = buildtree([spec], repo) +return matchany(ui, tree, repo=repo) def emptymatcher(repo, subset=None): """ Matcher for empty specs """ return baseset() -def matchany(ui, specs, repo=None, localalias=None): -"""Create a matcher that will include any revisions matching one of the -given specs +def matchany(ui, tree, repo=None, localalias=None): +"""Create a matcher for the tree If localalias is not None, it is a dict {name: definitionstring}. It takes precedence over [revsetalias] config section. """ -if not specs: -return emptymatcher -if not all(specs): -raise error.ParseError(_("empty query")) - -tree = buildtree(specs, repo) - aliases = [] warn = None if ui: diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -804,11 +804,19 @@ definitions overriding user aliases, set ``localalias`` to ``{name: definitionstring}``. ''' + +if not specs: +return revset.emptymatcher(self) +if not all(specs): +raise error.ParseError(_("empty query")) + if user: -m = revset.matchany(self.ui, specs, repo=self, +tree = revset.buildtree(specs, self) +m = revset.matchany(self.ui, tree, repo=self, localalias=localalias) else: -m = revset.matchany(None, specs, localalias=localalias) +tree = revset.buildtree(specs) +m = revset.matchany(None, tree, localalias=localalias) return m(self) def url(self): 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
D1677: revset: extract the logic to build the tree in it's own function
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will help us to get the tree at more high level API and we can parse the tree there before doing optimizations and returning the matcher. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1677 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2148,6 +2148,19 @@ # hook for extensions to execute code on the optimized tree pass +def buildtree(specs, repo=None): +""" builds the tree on basis of specs and returns it """ +lookup = None +if repo: +lookup = repo.__contains__ +if len(specs) == 1: +tree = revsetlang.parse(specs[0], lookup) +else: +tree = ('or', +('list',) + tuple(revsetlang.parse(s, lookup) for s in specs)) + +return tree + def match(ui, spec, repo=None): """Create a matcher for a single revision spec""" return matchany(ui, [spec], repo=repo) @@ -2167,14 +2180,8 @@ return emptymatcher if not all(specs): raise error.ParseError(_("empty query")) -lookup = None -if repo: -lookup = repo.__contains__ -if len(specs) == 1: -tree = revsetlang.parse(specs[0], lookup) -else: -tree = ('or', -('list',) + tuple(revsetlang.parse(s, lookup) for s in specs)) + +tree = buildtree(specs, repo) aliases = [] warn = None 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
D1676: revset: take out logic generating matcher for empty spec in it's own fn
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This will help us in calling the functions from another modules and is done so that we can get the tree object parsed at revset.matchany() and update visibility exceptions based on that. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1676 AFFECTED FILES mercurial/revset.py CHANGE DETAILS diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2152,17 +2152,19 @@ """Create a matcher for a single revision spec""" return matchany(ui, [spec], repo=repo) +def emptymatcher(repo, subset=None): +""" Matcher for empty specs """ +return baseset() + def matchany(ui, specs, repo=None, localalias=None): """Create a matcher that will include any revisions matching one of the given specs If localalias is not None, it is a dict {name: definitionstring}. It takes precedence over [revsetalias] config section. """ if not specs: -def mfunc(repo, subset=None): -return baseset() -return mfunc +return emptymatcher if not all(specs): raise error.ParseError(_("empty query")) lookup = None 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
file patterns, globbing, sparse, etc
The plethora of Mercurial's file pattern behaviors are really confusing. It's only through carefully trying to compose this email for over an hour that I'm even starting to understand it, and that complexity is a barrier to adoption. hblancha@aurora:base.hg$ tree . ├── dir │ ├── dir.txt │ └── subdir │ └── subdir.txt ├── file.txt └── top.txt hblancha@aurora:base.hg$ echo dir/* dir/dir.txt dir/subdir I want shell globbing, as seen in that 'echo' command. Except hg doesn't track directories, so I expect hg's shell globbing will only list dir.txt. hblancha@aurora:base.hg$ hg files 'dir/*' hblancha@aurora:base.hg$ Nope. Nothing at all. (Oops, it's a "fileset"! Certainly not what I expected.) hblancha@aurora:base.hg$ hg files --include 'dir/*' dir/dir.txt dir/subdir/subdir.txt If I use "--include", now I get radically different behavior. I had no idea that would happen, but now I get my shell globs! Except it's still not what I expected, because subdir.txt ended up there. (Yes, I see the fine print in 'hg help patterns' that says "For "-I" and "-X" options, "glob:" will match directories recursively." Again, not what I expected.) hblancha@aurora:base.hg$ hg files 'glob:dir/*' dir/dir.txt Finally, here's my glob! Even though 'hg help files' said I could only use "filenames or filesets", not patterns, it turns out I could use patterns after all... Now I just have to remember which of these three very similar methods I'm supposed to use, and explain it to my comrades who didn't invest the effort to experiment for themselves and hope they care to remember. Now I think I've figured out how file globbing/patterns/etc works. But wait, it gets worse: hblancha@aurora:base.hg$ hg sparse --reset; hg sparse -I 'dir/subdir'; tree . └── dir ├──*dir.txt* └── subdir └── subdir.txt hblancha@aurora:base.hg$ hg sparse --reset; hg sparse -I 'glob:dir/subdir'; tree . └── dir └── subdir └── subdir.txt We can see that 'dir/subdir' is not the same as 'glob:dir/subdir', even though the documentation claims it should be. Also, neither should display *dir.txt* (as far as I understand, from my experimentation this evening), so there seems to be a sparse bug here. Also, remember how I got the glob I wanted above? Well I can't do that with sparse, because I can /only/ use --include, and that gets me the behavior I didn't want. hblancha@aurora:base.hg$ hg files 'glob:dir/*' dir/dir.txt hblancha@aurora:base.hg$ hg sparse --reset; hg sparse --include 'rootfilesin:dir'; tree . └── dir └── dir.txt hblancha@aurora:base.hg$ hg files 'rootfilesin:dir' dir/dir.txt So now I have to use "rootfilesin:" prefix, which I've never heard of and have no muscle memory for, and is more annoying to type. At least it works in both commands, though I don't know if I'll ever want to type that unless I have no other choice. I guess, in summary, my complaint is that we shouldn't have to conduct all these experiments to figure out how to use a fundamental technique like shell globbing in Mercurial. At best that slows us down; at worst it makes us look elsewhere, and I really don't want that. Thanks for listening. -- Hollis BlanchardMentor Graphics Emulation Division ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 V4] debuglocks: allow setting a lock
# HG changeset patch # User Paul Morelle# Date 1510497286 -3600 # Sun Nov 12 15:34:46 2017 +0100 # Node ID 8bcccbbeafba2bc80ed9e427945e11a4728802e8 # Parent 9beb49c91570014c034c3eaad9ce0a7a37e4c931 # EXP-Topic debugsetlocks # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8bcccbbeafba debuglocks: allow setting a lock diff -r 9beb49c91570 -r 8bcccbbeafba mercurial/debugcommands.py --- a/mercurial/debugcommands.pySun Nov 12 15:34:19 2017 +0100 +++ b/mercurial/debugcommands.pySun Nov 12 15:34:46 2017 +0100 @@ -77,6 +77,8 @@ command = registrar.command() +_confirmlockremovalmsg = _("ready to release the lock (Y)? $$ ") + @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) def debugancestor(ui, repo, *args): """find the ancestor revision of two revisions in a given index""" @@ -1275,7 +1277,10 @@ @command('debuglocks', [('L', 'force-lock', None, _('free the store lock (DANGEROUS)')), ('W', 'force-wlock', None, - _('free the working state lock (DANGEROUS)'))], + _('free the working state lock (DANGEROUS)')), + ('s', 'set-lock', None, _('set the store lock until stopped')), + ('S', 'set-wlock', None, + _('set the working state lock until stopped'))], _('[OPTION]...')) def debuglocks(ui, repo, **opts): """show or modify state of locks @@ -1294,6 +1299,10 @@ instance, on a shared filesystem). Removing locks may also be blocked by filesystem permissions. +Setting a lock will prevent other commands from changing the data. +The command will wait until an interruption (SIGINT, SIGTERM, ...) occurs. +The set locks are removed when the command exits. + Returns 0 if no locks are held. """ @@ -1305,6 +1314,24 @@ if opts.get(r'force_lock') or opts.get(r'force_wlock'): return 0 +locks = [] +try: +if opts.get(r'set_wlock'): +try: +locks.append(repo.wlock(False)) +except error.LockHeld: +raise error.Abort(_('wlock is already held')) +if opts.get(r'set_lock'): +try: +locks.append(repo.lock(False)) +except error.LockHeld: +raise error.Abort(_('lock is already held')) +if len(locks): +ui.promptchoice(_confirmlockremovalmsg) +return 0 +finally: +release(*locks) + now = time.time() held = 0 diff -r 9beb49c91570 -r 8bcccbbeafba tests/test-completion.t --- a/tests/test-completion.t Sun Nov 12 15:34:19 2017 +0100 +++ b/tests/test-completion.t Sun Nov 12 15:34:46 2017 +0100 @@ -274,7 +274,7 @@ debuginstall: template debugknown: debuglabelcomplete: - debuglocks: force-lock, force-wlock + debuglocks: force-lock, force-wlock, set-lock, set-wlock debugmergestate: debugnamecomplete: debugobsolete: flags, record-parents, rev, exclusive, index, delete, date, user, template diff -r 9beb49c91570 -r 8bcccbbeafba tests/test-debugcommands.t --- a/tests/test-debugcommands.tSun Nov 12 15:34:19 2017 +0100 +++ b/tests/test-debugcommands.tSun Nov 12 15:34:46 2017 +0100 @@ -1,4 +1,6 @@ $ cat << EOF >> $HGRCPATH + > [ui] + > interactive=yes > [format] > usegeneraldelta=yes > EOF @@ -157,7 +159,7 @@ amount of time, displays error message and returns 1 $ waitlock() { > start=`date +%s` - > timeout=1 + > timeout=5 > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do > now=`date +%s` > if [ "`expr $now - $start`" -gt $timeout ]; then @@ -167,26 +169,16 @@ > sleep 0.1 > done > } -dolock [wlock] [lock] will set the locks until interrupted $ dolock() { - > declare -A options - > options=([${1:-nolock}]=1 [${2:-nowlock}]=1) - > python < from mercurial import hg, ui as uimod - > import os - > import time - > - > repo = hg.repository(uimod.ui.load(), path='.') - > `[ -n "${options["wlock"]}" ] && echo "with repo.wlock(False):" || echo "if True:"` - > `[ -n "${options["lock"]}" ] && echo "with repo.lock(False):" || echo "if True:"` - > while not os.path.exists('.hg/unlock'): - > time.sleep(0.1) - > os.unlink('.hg/unlock') - > EOF + > { + > waitlock .hg/unlock + > rm -f .hg/unlock + > echo y + > } | hg debuglocks "$@" > } - - $ dolock lock & + $ dolock -s & $ waitlock .hg/store/lock + ready to release the lock (Y)? (no-eol) $ hg debuglocks lock: user *, process * (*s) (glob) @@ -194,11 +186,15 @@ [1] $ touch .hg/unlock $ wait + y + $ [ -f .hg/store/lock ] || echo "There is no lock" + There is no lock * Test setting the wlock - $ dolock wlock & + $ dolock -S & $ waitlock .hg/wlock + ready to release the lock (Y)?
[PATCH 1 of 2 V4] debuglocks: add tests (and fix typo in early return)
# HG changeset patch # User Paul Morelle# Date 1510497259 -3600 # Sun Nov 12 15:34:19 2017 +0100 # Node ID 9beb49c91570014c034c3eaad9ce0a7a37e4c931 # Parent 37d923cdeba923f4964befcc3d0789362a433a35 # EXP-Topic debugsetlocks # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9beb49c91570 debuglocks: add tests (and fix typo in early return) diff -r 37d923cdeba9 -r 9beb49c91570 mercurial/debugcommands.py --- a/mercurial/debugcommands.pySun Dec 10 22:50:57 2017 -0500 +++ b/mercurial/debugcommands.pySun Nov 12 15:34:19 2017 +0100 @@ -1302,7 +1302,7 @@ repo.svfs.unlink('lock') if opts.get(r'force_wlock'): repo.vfs.unlink('wlock') -if opts.get(r'force_lock') or opts.get(r'force_lock'): +if opts.get(r'force_lock') or opts.get(r'force_wlock'): return 0 now = time.time() diff -r 37d923cdeba9 -r 9beb49c91570 tests/test-debugcommands.t --- a/tests/test-debugcommands.tSun Dec 10 22:50:57 2017 -0500 +++ b/tests/test-debugcommands.tSun Nov 12 15:34:19 2017 +0100 @@ -145,6 +145,122 @@ 7 6-1 ??? ?????? ??? ???0 ??? ? 12 (glob) 8 7-1 ??? ?????? ??? ???0 ??? ? 13 (glob) +Test debuglocks command: + + $ hg debuglocks + lock: free + wlock: free + +* Test setting the lock + +waitlock will wait for file to be created. If it isn't in a reasonable +amount of time, displays error message and returns 1 + $ waitlock() { + > start=`date +%s` + > timeout=1 + > while [ \( ! -f $1 \) -a \( ! -L $1 \) ]; do + > now=`date +%s` + > if [ "`expr $now - $start`" -gt $timeout ]; then + > echo "timeout: $1 was not created in $timeout seconds" + > return 1 + > fi + > sleep 0.1 + > done + > } +dolock [wlock] [lock] will set the locks until interrupted + $ dolock() { + > declare -A options + > options=([${1:-nolock}]=1 [${2:-nowlock}]=1) + > python < from mercurial import hg, ui as uimod + > import os + > import time + > + > repo = hg.repository(uimod.ui.load(), path='.') + > `[ -n "${options["wlock"]}" ] && echo "with repo.wlock(False):" || echo "if True:"` + > `[ -n "${options["lock"]}" ] && echo "with repo.lock(False):" || echo "if True:"` + > while not os.path.exists('.hg/unlock'): + > time.sleep(0.1) + > os.unlink('.hg/unlock') + > EOF + > } + + $ dolock lock & + $ waitlock .hg/store/lock + + $ hg debuglocks + lock: user *, process * (*s) (glob) + wlock: free + [1] + $ touch .hg/unlock + $ wait + +* Test setting the wlock + + $ dolock wlock & + $ waitlock .hg/wlock + + $ hg debuglocks + lock: free + wlock: user *, process * (*s) (glob) + [1] + $ touch .hg/unlock + $ wait + +* Test setting both locks + + $ dolock wlock lock & + $ waitlock .hg/wlock && waitlock .hg/store/lock + + $ hg debuglocks + lock: user *, process * (*s) (glob) + wlock: user *, process * (*s) (glob) + [2] + $ touch .hg/unlock + $ wait + + $ hg debuglocks + lock: free + wlock: free + +* Test forcing the lock + + $ dolock lock & + $ waitlock .hg/store/lock + + $ hg debuglocks + lock: user *, process * (*s) (glob) + wlock: free + [1] + + $ hg debuglocks -L + + $ hg debuglocks + lock: free + wlock: free + + $ touch .hg/unlock + $ wait + +* Test forcing the wlock + + $ dolock wlock & + $ waitlock .hg/wlock + + $ hg debuglocks + lock: free + wlock: user *, process * (*s) (glob) + [1] + + $ hg debuglocks -W + + $ hg debuglocks + lock: free + wlock: free + + $ touch .hg/unlock + $ wait + Test WdirUnsupported exception $ hg debugdata -c ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1672: py3: handle keyword arguments correctly in bundlerepo.py
pulkit 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/D1672 AFFECTED FILES mercurial/bundlerepo.py CHANGE DETAILS diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -541,10 +541,10 @@ and other.capable('bundle2')) if canbundle2: kwargs = {} -kwargs['common'] = common -kwargs['heads'] = rheads -kwargs['bundlecaps'] = exchange.caps20to10(repo) -kwargs['cg'] = True +kwargs[r'common'] = common +kwargs[r'heads'] = rheads +kwargs[r'bundlecaps'] = exchange.caps20to10(repo) +kwargs[r'cg'] = True b2 = other.getbundle('incoming', **kwargs) fname = bundle = changegroup.writechunks(ui, b2._forwardchunks(), bundlename) 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
D1671: py3: handle keyword arguments correctly in debugcommands.py
pulkit 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/D1671 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 @@ -365,6 +365,7 @@ norepo=True) def debugcapabilities(ui, path, **opts): """lists the capabilities of a remote peer""" +opts = pycompat.byteskwargs(opts) peer = hg.peer(ui, opts, path) caps = peer.capabilities() ui.write(('Main capabilities:\n')) @@ -867,6 +868,7 @@ Use --verbose to get extra information about current config value and Mercurial default.""" +opts = pycompat.byteskwargs(opts) maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) maxvariantlength = max(len('format-variant'), maxvariantlength) @@ -2296,7 +2298,7 @@ ctx = repo[rev] ui.write('%s\n'% ctx2str(ctx)) for succsset in obsutil.successorssets(repo, ctx.node(), -closest=opts['closest'], +closest=opts[r'closest'], cache=cache): if succsset: ui.write('') @@ -2422,6 +2424,7 @@ for k, v in opts.iteritems(): if v: args[k] = v +args = pycompat.strkwargs(args) # run twice to check that we don't mess up the stream for the next command res1 = repo.debugwireargs(*vals, **args) res2 = repo.debugwireargs(*vals, **args) 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
D1674: py3: pass bytes from extension to ui.write() in test-revlog-mmapindex.t
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This makes the test pass on Python 3. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1674 AFFECTED FILES tests/test-revlog-mmapindex.t CHANGE DETAILS diff --git a/tests/test-revlog-mmapindex.t b/tests/test-revlog-mmapindex.t --- a/tests/test-revlog-mmapindex.t +++ b/tests/test-revlog-mmapindex.t @@ -6,12 +6,13 @@ > > from mercurial import ( > extensions, + > pycompat, > util, > ) > > def extsetup(ui): > def mmapread(orig, fp): - > ui.write("mmapping %s\n" % fp.name) + > ui.write(b"mmapping %s\n" % pycompat.bytestr(fp.name)) > ui.flush() > return orig(fp) > 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
D1675: py3: introduce pycompat.ziplist as zip is a generator on Python 3
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Similar to map, the return value of zip was also turned into a generator on Python 3. We have multiple occurences in our codebase where we retrieve the values of zip multiple times, so let's introduce pycompat.ziplist similar to pycompat.maplist. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1675 AFFECTED FILES mercurial/pycompat.py CHANGE DETAILS diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -63,6 +63,7 @@ sysexecutable = os.fsencode(sysexecutable) stringio = io.BytesIO maplist = lambda *args: list(map(*args)) +ziplist = lambda *args: list(zip(*args)) rawinput = input # TODO: .buffer might not exist if std streams were replaced; we'll need @@ -313,6 +314,7 @@ shlexsplit = shlex.split stringio = cStringIO.StringIO maplist = map +ziplist = zip rawinput = raw_input isjython = sysplatform.startswith('java') 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
D1673: py3: handle keyword arguments correctly in hgext/record.py
pulkit 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/D1673 AFFECTED FILES hgext/record.py CHANGE DETAILS diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -68,13 +68,13 @@ raise error.Abort(_('running non-interactively, use %s instead') % 'commit') -opts["interactive"] = True +opts[r"interactive"] = True overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): return commands.commit(ui, repo, *pats, **opts) def qrefresh(origfn, ui, repo, *pats, **opts): -if not opts['interactive']: +if not opts[r'interactive']: return origfn(ui, repo, *pats, **opts) mq = extensions.find('mq') @@ -112,16 +112,16 @@ repo.mq.checkpatchname(patch) def committomq(ui, repo, *pats, **opts): -opts['checkname'] = False +opts[r'checkname'] = False mq.new(ui, repo, patch, *pats, **opts) overrides = {('experimental', 'crecord'): False} with ui.configoverride(overrides, 'record'): cmdutil.dorecord(ui, repo, committomq, cmdsuggest, False, cmdutil.recordfilter, *pats, **opts) def qnew(origfn, ui, repo, patch, *args, **opts): -if opts['interactive']: +if opts[r'interactive']: return _qrecord(None, ui, repo, patch, *args, **opts) return origfn(ui, repo, patch, *args, **opts) 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
Re: That pesky windows run-tests failure on the buildbot
> On Dec 12, 2017, at 5:57 PM, Augie Facklerwrote: > > Finally, some useful output: > > + --- $TESTTMP/anothertests/test-runtestdir.t > + +++ $TESTTMP/anothertests/test-runtestdir.t.err > + @@ -10,6 +10,7 @@ > + If this prints a path, that means RUNTESTDIR didn't equal > + TESTDIR as it should have. > + $ test "$RUNTESTDIR" = > "G:\Users\test\projects\hg-default-x86_64\Win7_x86_64_hg_tests\build\tests" > || echo "$RUNTESTDIR" > + + > g:\Users\test\projects\hg-default-x86_64\Win7_x86_64_hg_tests\build\tests > > Basically, it's failing because one of os.path.{abspath,dirname} is deciding > to lowercase the drive letter. I suspect it's abspath, but I don't have a > Windows machine handy to test against. Anyone got a clever idea on how to fix > this? The odd thing is, this runs fine on this machine from this directory when not under buildbot. Nothing in the environment looked out or place, so idk why that happens. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] lfs: add an experimental config to masquerade as git for the blob transfer
> On Dec 12, 2017, at 5:48 PM, Augie Facklerwrote: > > >> On Dec 12, 2017, at 17:32, Matt Harbison wrote: >> >> diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py >> --- a/hgext/lfs/blobstore.py >> +++ b/hgext/lfs/blobstore.py >> @@ -101,7 +101,10 @@ class _gitlfsremote(object): >>self.ui = ui >>baseurl, authinfo = url.authinfo() >>self.baseurl = baseurl.rstrip('/') >> -self.urlopener = urlmod.opener(ui, authinfo) >> +useragent = None >> +if repo.ui.configbool('experimental', 'lfs.git-user-agent'): >> +useragent = 'git/2.15.1' > > what happens if you say something like 'git/2.15.1 (compatible; Mercurial > %s)' % util.version()? Does that work? I’ll give it a try tomorrow. I suspect it will be totally dependent on the particular server. I wonder if in the future, the git version would ever be checked by 3rd party servers to know what features to support, or something like that. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
That pesky windows run-tests failure on the buildbot
Finally, some useful output: + --- $TESTTMP/anothertests/test-runtestdir.t + +++ $TESTTMP/anothertests/test-runtestdir.t.err + @@ -10,6 +10,7 @@ + If this prints a path, that means RUNTESTDIR didn't equal + TESTDIR as it should have. + $ test "$RUNTESTDIR" = "G:\Users\test\projects\hg-default-x86_64\Win7_x86_64_hg_tests\build\tests" || echo "$RUNTESTDIR" + + g:\Users\test\projects\hg-default-x86_64\Win7_x86_64_hg_tests\build\tests Basically, it's failing because one of os.path.{abspath,dirname} is deciding to lowercase the drive letter. I suspect it's abspath, but I don't have a Windows machine handy to test against. Anyone got a clever idea on how to fix this? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] lfs: add an experimental config to masquerade as git for the blob transfer
> On Dec 12, 2017, at 17:32, Matt Harbisonwrote: > > # HG changeset patch > # User Matt Harbison > # Date 1513109762 18000 > # Tue Dec 12 15:16:02 2017 -0500 > # Node ID f5141924d7e23da93e04fe1c5fb6e1fc593416fd > # Parent 4937db58b663faa6893c51a41cec28114a165dd0 > lfs: add an experimental config to masquerade as git for the blob transfer > > As we were trying to transition off of the non production lfs-test-server for > further experimenting, one of the problems we ran into was interoperability. > A > coworker setup gitbucket[1] to act as the blob server, tested with git, and > passed it off to me. But push failed with a message saying "abort: LFS server > returns invalid JSON:", and then proceeded to dump a huge HTML page to the > screen. It turn out that it is assuming that git is the only thing that wants > to do a blob transfer, and everything else is a web browser wanting HTML. > > It's only a single data point, but I suspect other things may be doing this > too. > I didn't turn it on by default, because hopefully these things can be reported > and fixed. I made it experimental because I suspect we will need it for > longer > than the extension is experimental, but hopefully it can go away. There's > nothing significant about the version of git chosen, other than it is the > current version. > > [1] https://github.com/gitbucket/gitbucket/ > > diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py > --- a/hgext/lfs/__init__.py > +++ b/hgext/lfs/__init__.py > @@ -28,6 +28,11 @@ Configs:: > # the local directory to store lfs files for sharing across local clones. > # If not set, the cache is located in an OS specific cache location. > usercache = /path/to/global/cache > + > +[experimental] > +# Some servers will check the User-Agent header, and send back html if it > +# doesn't look like a git client. Set this to True to masquerade as git. > +lfs.git-user-agent = True > """ > > from __future__ import absolute_import > @@ -63,6 +68,10 @@ testedwith = 'ships-with-hg-core' > configtable = {} > configitem = registrar.configitem(configtable) > > +configitem('experimental', 'lfs.git-user-agent', > +default=False, > +) > + > configitem('lfs', 'url', > default=configitem.dynamicdefault, > ) > diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py > --- a/hgext/lfs/blobstore.py > +++ b/hgext/lfs/blobstore.py > @@ -101,7 +101,10 @@ class _gitlfsremote(object): > self.ui = ui > baseurl, authinfo = url.authinfo() > self.baseurl = baseurl.rstrip('/') > -self.urlopener = urlmod.opener(ui, authinfo) > +useragent = None > +if repo.ui.configbool('experimental', 'lfs.git-user-agent'): > +useragent = 'git/2.15.1' what happens if you say something like 'git/2.15.1 (compatible; Mercurial %s)' % util.version()? Does that work? > +self.urlopener = urlmod.opener(ui, authinfo, useragent) > self.retry = ui.configint('lfs', 'retry') > > def writebatch(self, pointers, fromstore): > diff --git a/mercurial/url.py b/mercurial/url.py > --- a/mercurial/url.py > +++ b/mercurial/url.py > @@ -466,7 +466,7 @@ class cookiehandler(urlreq.basehandler): > > handlerfuncs = [] > > -def opener(ui, authinfo=None): > +def opener(ui, authinfo=None, useragent=None): > ''' > construct an opener suitable for urllib2 > authinfo will be added to the password manager > @@ -512,8 +512,14 @@ def opener(ui, authinfo=None): > # own distribution name. Since servers should not be using the user > # agent string for anything, clients should be able to define whatever > # user agent they deem appropriate. > -agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() > -opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] > +# > +# The custom user agent is for lfs, because unfortunately some servers > +# do look at this value. > +if not useragent: > +agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() > +opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] > +else: > +opener.addheaders = [(r'User-agent', pycompat.sysstr(useragent))] > > # This header should only be needed by wire protocol requests. But it has > # been sent on all requests since forever. We keep sending it for > backwards > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH STABLE] histedit: preserve active branch while histediting
> On Dec 12, 2017, at 16:51, Boris Feldwrote: > > # HG changeset patch > # User Boris Feld > # Date 1513099331 -3600 > # Tue Dec 12 18:22:11 2017 +0100 > # Branch stable > # Node ID 97530db4626d07f40fa71c5b28f8557baa867024 > # Parent fdd09d87635b32dbf06563bf1ccaac56798ad882 > # EXP-Topic histedit-branch > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 97530db4626d > histedit: preserve active branch while histediting queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] lfs: add an experimental config to masquerade as git for the blob transfer
# HG changeset patch # User Matt Harbison# Date 1513109762 18000 # Tue Dec 12 15:16:02 2017 -0500 # Node ID f5141924d7e23da93e04fe1c5fb6e1fc593416fd # Parent 4937db58b663faa6893c51a41cec28114a165dd0 lfs: add an experimental config to masquerade as git for the blob transfer As we were trying to transition off of the non production lfs-test-server for further experimenting, one of the problems we ran into was interoperability. A coworker setup gitbucket[1] to act as the blob server, tested with git, and passed it off to me. But push failed with a message saying "abort: LFS server returns invalid JSON:", and then proceeded to dump a huge HTML page to the screen. It turn out that it is assuming that git is the only thing that wants to do a blob transfer, and everything else is a web browser wanting HTML. It's only a single data point, but I suspect other things may be doing this too. I didn't turn it on by default, because hopefully these things can be reported and fixed. I made it experimental because I suspect we will need it for longer than the extension is experimental, but hopefully it can go away. There's nothing significant about the version of git chosen, other than it is the current version. [1] https://github.com/gitbucket/gitbucket/ diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -28,6 +28,11 @@ Configs:: # the local directory to store lfs files for sharing across local clones. # If not set, the cache is located in an OS specific cache location. usercache = /path/to/global/cache + +[experimental] +# Some servers will check the User-Agent header, and send back html if it +# doesn't look like a git client. Set this to True to masquerade as git. +lfs.git-user-agent = True """ from __future__ import absolute_import @@ -63,6 +68,10 @@ testedwith = 'ships-with-hg-core' configtable = {} configitem = registrar.configitem(configtable) +configitem('experimental', 'lfs.git-user-agent', +default=False, +) + configitem('lfs', 'url', default=configitem.dynamicdefault, ) diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -101,7 +101,10 @@ class _gitlfsremote(object): self.ui = ui baseurl, authinfo = url.authinfo() self.baseurl = baseurl.rstrip('/') -self.urlopener = urlmod.opener(ui, authinfo) +useragent = None +if repo.ui.configbool('experimental', 'lfs.git-user-agent'): +useragent = 'git/2.15.1' +self.urlopener = urlmod.opener(ui, authinfo, useragent) self.retry = ui.configint('lfs', 'retry') def writebatch(self, pointers, fromstore): diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -466,7 +466,7 @@ class cookiehandler(urlreq.basehandler): handlerfuncs = [] -def opener(ui, authinfo=None): +def opener(ui, authinfo=None, useragent=None): ''' construct an opener suitable for urllib2 authinfo will be added to the password manager @@ -512,8 +512,14 @@ def opener(ui, authinfo=None): # own distribution name. Since servers should not be using the user # agent string for anything, clients should be able to define whatever # user agent they deem appropriate. -agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() -opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] +# +# The custom user agent is for lfs, because unfortunately some servers +# do look at this value. +if not useragent: +agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() +opener.addheaders = [(r'User-agent', pycompat.sysstr(agent))] +else: +opener.addheaders = [(r'User-agent', pycompat.sysstr(useragent))] # This header should only be needed by wire protocol requests. But it has # been sent on all requests since forever. We keep sending it for backwards ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1670: debugbuilddag: create filectx instance in 'filectxfn' callback
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Same motivation is previous patch. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1670 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 @@ -183,7 +183,7 @@ id, ps = data files = [] -fctxs = {} +filecontent = {} p2 = None if mergeable_file: @@ -204,27 +204,29 @@ ml[id * linesperrev] += " r%i" % id mergedtext = "\n".join(ml) files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, mergedtext) +filecontent[fn] = mergedtext if overwritten_file: fn = "of" files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) +filecontent[fn] = "r%i\n" % id if new_file: fn = "nf%i" % id files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) +filecontent[fn] = "r%i\n" % id if len(ps) > 1: if not p2: p2 = repo[ps[1]] for fn in p2: if fn.startswith("nf"): files.append(fn) -fctxs[fn] = p2[fn] +filecontent[fn] = p2[fn].data() def fctxfn(repo, cx, path): -return fctxs.get(path) +if path in filecontent: +return context.memfilectx(repo, path, filecontent[path]) +return None if len(ps) == 0 or ps[0] < 0: pars = [None, None] 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
D1669: synthrepo: create filectx instance in 'filectxfn' callback
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I would like to pass the memctx to the memfilectx constructor, but it's not available where we currently create the memfilectx. It is available in the 'filectxfn' callback, so let's create the memfilectx there instead. A later patch will start actually passing the memctx. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1669 AFFECTED FILES contrib/synthrepo.py CHANGE DETAILS diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py --- a/contrib/synthrepo.py +++ b/contrib/synthrepo.py @@ -369,14 +369,14 @@ while not validpath(path): path = pickpath() data = '%s contents\n' % path -files[path] = context.memfilectx(repo, path, data) +files[path] = data dir = os.path.dirname(path) while dir and dir not in dirs: dirs.add(dir) dir = os.path.dirname(dir) def filectxfn(repo, memctx, path): -return files[path] +return context.memfilectx(repo, path, files[path]) ui.progress(_synthesizing, None) message = 'synthesized wide repo with %d files' % (len(files),) @@ -444,14 +444,12 @@ for __ in xrange(add): lines.insert(random.randint(0, len(lines)), makeline()) path = fctx.path() -changes[path] = context.memfilectx(repo, path, - '\n'.join(lines) + '\n') +changes[path] = '\n'.join(lines) + '\n' for __ in xrange(pick(filesremoved)): path = random.choice(mfk) for __ in xrange(10): path = random.choice(mfk) if path not in changes: -changes[path] = None break if filesadded: dirs = list(pctx.dirs()) @@ -466,9 +464,11 @@ pathstr = '/'.join(filter(None, path)) data = '\n'.join(makeline() for __ in xrange(pick(linesinfilesadded))) + '\n' -changes[pathstr] = context.memfilectx(repo, pathstr, data) +changes[pathstr] = data def filectxfn(repo, memctx, path): -return changes[path] +if path not in changes: +return None +return context.memfilectx(repo, path, changes[path]) if not changes: continue if revs: 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
D1657: debugbuilddag: create filectx instance in 'filectxfn' callback
martinvonz updated this revision to Diff 4393. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1657?vs=4391=4393 REVISION DETAIL https://phab.mercurial-scm.org/D1657 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 @@ -183,7 +183,7 @@ id, ps = data files = [] -fctxs = {} +filecontent = {} p2 = None if mergeable_file: @@ -204,27 +204,29 @@ ml[id * linesperrev] += " r%i" % id mergedtext = "\n".join(ml) files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, mergedtext) +filecontent[fn] = mergedtext if overwritten_file: fn = "of" files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) +filecontent[fn] = "r%i\n" % id if new_file: fn = "nf%i" % id files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) +filecontent[fn] = "r%i\n" % id if len(ps) > 1: if not p2: p2 = repo[ps[1]] for fn in p2: if fn.startswith("nf"): files.append(fn) -fctxs[fn] = p2[fn] +filecontent[fn] = p2[fn].data() def fctxfn(repo, cx, path): -return fctxs.get(path) +if path in filecontent: +return context.memfilectx(repo, path, filecontent[path]) +return None if len(ps) == 0 or ps[0] < 0: pars = [None, None] To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1657: debugbuilddag: create filectx instance in 'filectxfn' callback
durin42 added a comment. arg, this was pushed in error by me - @martinvonz will need to re-phabsend. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1657 To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1656: synthrepo: create filectx instance in 'filectxfn' callback
martinvonz updated this revision to Diff 4392. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1656?vs=4390=4392 REVISION DETAIL https://phab.mercurial-scm.org/D1656 AFFECTED FILES contrib/synthrepo.py CHANGE DETAILS diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py --- a/contrib/synthrepo.py +++ b/contrib/synthrepo.py @@ -369,14 +369,14 @@ while not validpath(path): path = pickpath() data = '%s contents\n' % path -files[path] = context.memfilectx(repo, path, data) +files[path] = data dir = os.path.dirname(path) while dir and dir not in dirs: dirs.add(dir) dir = os.path.dirname(dir) def filectxfn(repo, memctx, path): -return files[path] +return context.memfilectx(repo, path, files[path]) ui.progress(_synthesizing, None) message = 'synthesized wide repo with %d files' % (len(files),) @@ -444,14 +444,12 @@ for __ in xrange(add): lines.insert(random.randint(0, len(lines)), makeline()) path = fctx.path() -changes[path] = context.memfilectx(repo, path, - '\n'.join(lines) + '\n') +changes[path] = '\n'.join(lines) + '\n' for __ in xrange(pick(filesremoved)): path = random.choice(mfk) for __ in xrange(10): path = random.choice(mfk) if path not in changes: -changes[path] = None break if filesadded: dirs = list(pctx.dirs()) @@ -466,9 +464,11 @@ pathstr = '/'.join(filter(None, path)) data = '\n'.join(makeline() for __ in xrange(pick(linesinfilesadded))) + '\n' -changes[pathstr] = context.memfilectx(repo, pathstr, data) +changes[pathstr] = data def filectxfn(repo, memctx, path): -return changes[path] +if path not in changes: +return None +return context.memfilectx(repo, path, changes[path]) if not changes: continue if revs: To: martinvonz, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1656: synthrepo: create filectx instance in 'filectxfn' callback
durin42 added a comment. Crud. I had an old version of this queued, and failed to drop it. Fixing now... REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1656 To: martinvonz, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1657: debugbuilddag: create filectx instance in 'filectxfn' callback
This revision was automatically updated to reflect the committed changes. Closed by commit rHGee2e1d4c15de: debugbuilddag: create filectx instance in filectxfn callback (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1657?vs=4357=4391 REVISION DETAIL https://phab.mercurial-scm.org/D1657 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 @@ -183,7 +183,7 @@ id, ps = data files = [] -fctxs = {} +filecontent = {} p2 = None if mergeable_file: @@ -204,27 +204,29 @@ ml[id * linesperrev] += " r%i" % id mergedtext = "\n".join(ml) files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, mergedtext) +filecontent[fn] = mergedtext if overwritten_file: fn = "of" files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) +filecontent[fn] = "r%i\n" % id if new_file: fn = "nf%i" % id files.append(fn) -fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) +filecontent[fn] = "r%i\n" % id if len(ps) > 1: if not p2: p2 = repo[ps[1]] for fn in p2: if fn.startswith("nf"): files.append(fn) -fctxs[fn] = p2[fn] +filecontent[fn] = p2[fn].data() def fctxfn(repo, cx, path): -return fctxs.get(path) +if path in filecontent: +return context.memfilectx(repo, path, filecontent[path]) +return None if len(ps) == 0 or ps[0] < 0: pars = [None, None] To: martinvonz, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1656: synthrepo: create filectx instance in 'filectxfn' callback
This revision was automatically updated to reflect the committed changes. martinvonz marked an inline comment as done. Closed by commit rHG304179b21bff: synthrepo: create filectx instance in filectxfn callback (authored by martinvonz, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D1656?vs=4380=4390#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1656?vs=4380=4390 REVISION DETAIL https://phab.mercurial-scm.org/D1656 AFFECTED FILES contrib/synthrepo.py CHANGE DETAILS diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py --- a/contrib/synthrepo.py +++ b/contrib/synthrepo.py @@ -369,14 +369,14 @@ while not validpath(path): path = pickpath() data = '%s contents\n' % path -files[path] = context.memfilectx(repo, path, data) +files[path] = data dir = os.path.dirname(path) while dir and dir not in dirs: dirs.add(dir) dir = os.path.dirname(dir) def filectxfn(repo, memctx, path): -return files[path] +return context.memfilectx(repo, path, files[path]) ui.progress(_synthesizing, None) message = 'synthesized wide repo with %d files' % (len(files),) To: martinvonz, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH STABLE] histedit: preserve active branch while histediting
# HG changeset patch # User Boris Feld# Date 1513099331 -3600 # Tue Dec 12 18:22:11 2017 +0100 # Branch stable # Node ID 97530db4626d07f40fa71c5b28f8557baa867024 # Parent fdd09d87635b32dbf06563bf1ccaac56798ad882 # EXP-Topic histedit-branch # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 97530db4626d histedit: preserve active branch while histediting The branch information was properly preserved in the changeset, but the "active" branch of the working copy could be lost (the branch of the base being used). Histedit used to behave properly in this regard but the case was not tested and regressed 4 years ago in ab2362e1672e. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -487,6 +487,7 @@ class histeditaction(object): repo.ui.pushbuffer(error=True, labeled=True) hg.update(repo, self.state.parentctxnode, quietempty=True) stats = applychanges(repo.ui, repo, rulectx, {}) +repo.dirstate.setbranch(rulectx.branch()) if stats and stats[3] > 0: buf = repo.ui.popbuffer() repo.ui.write(*buf) diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t --- a/tests/test-histedit-commute.t +++ b/tests/test-histedit-commute.t @@ -454,3 +454,36 @@ Now, let's try to fold the second commit rename to another-dir/renamed-file $ cd .. + +Test that branches are preserved and stays active +- + + $ hg init repo-with-branch + $ cd repo-with-branch + $ echo a > a + $ hg add a + $ hg commit -m A + $ hg branch foo + marked working directory as branch foo + (branches are permanent and global, did you want a bookmark?) + $ echo a > b + $ hg add b + $ hg commit -m foo-B + $ echo a > c + $ hg add c + $ hg commit -m foo-C + + $ hg branch + foo + $ echo "pick efefa76d6dc3 2 foo-C" >> cmd + $ echo "pick 7336e7550422 1 foo-B" >> cmd + + $ HGEDITOR=cat hg histedit -r ".^" --commands cmd --quiet + $ hg log --template '{rev} {branch}\n' + 2 foo + 1 foo + 0 default + $ hg branch + foo + + $ cd .. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
quark added a comment. @ikostia This Phabricator instance should support "tests:" in title so there is no need to workaround that by using an underscore. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1667 To: ikostia, #hg-reviewers, quark, akushner Cc: durin42, akushner, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
quark added a comment. In https://phab.mercurial-scm.org/D1667#28537, @akushner wrote: > Why was there a quote on Linux? I didn't see a quote when I ran the find command. coreutils (starting from some version) added quotes by default if it finds special characters in paths: https://unix.stackexchange.com/questions/258679/why-is-ls-suddenly-wrapping-items-with-spaces-in-single-quotes I think some distros have that disabled by default. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1667 To: ikostia, #hg-reviewers, quark, akushner Cc: durin42, akushner, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
durin42 added a comment. Beat you to it: https://www.mercurial-scm.org/repo/hg-committed/rev/85f866bf9362 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1667 To: ikostia, #hg-reviewers, quark, akushner Cc: durin42, akushner, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1457: workers: don't use backgroundfilecloser in threads
wlis updated this revision to Diff 4386. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1457?vs=4022=4386 REVISION DETAIL https://phab.mercurial-scm.org/D1457 AFFECTED FILES mercurial/vfs.py CHANGE DETAILS diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -277,8 +277,12 @@ to ``__call__``/``open`` to result in the file possibly being closed asynchronously, on a background thread. """ -# This is an arbitrary restriction and could be changed if we ever -# have a use case. +# Sharing backgroundfilecloser between threads is complex and using +# multiple instances puts us at risk of running out of file descriptors +# only allow to use backgroundfilecloser when in main thread. +if not isinstance(threading.currentThread(), threading._MainThread): +yield +return vfs = getattr(self, 'vfs', self) if getattr(vfs, '_backgroundfilecloser', None): raise error.Abort( @@ -413,7 +417,8 @@ ' valid for checkambig=True') % mode) fp = checkambigatclosing(fp) -if backgroundclose: +if (backgroundclose and +isinstance(threading.currentThread(), threading._MainThread)): if not self._backgroundfilecloser: raise error.Abort(_('backgroundclose can only be used when a ' 'backgroundclosing context manager is active') To: wlis, #hg-reviewers, indygreg, krbullock Cc: krbullock, durin42, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1458: workers: implemented worker on windows
wlis added a comment. @durin42 yes, I tested without remotefilelog (at least I believe it was not being used at that time). I cloned a repo with --config extensions.remotefilelog=! and then put appropriate section in .hg/hgrc Ran updates between far revisions and verified that threads get started during update. Hg didn't complain about anything and repo stayed healthy. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1458 To: wlis, #hg-reviewers Cc: durin42, indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@35389: 61 new changesets (1 on stable)
61 new changesets (1 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/169d66db5920 changeset: 35329:169d66db5920 user:Augie Facklerdate:Fri Dec 08 16:14:19 2017 -0500 summary: highlight: eagerly discover plugin lexers while demandimport is off https://www.mercurial-scm.org/repo/hg/rev/0c1aff6d73a7 changeset: 35330:0c1aff6d73a7 user:Jun Wu date:Fri Dec 08 14:20:34 2017 -0800 summary: revset: use phasecache.getrevset to calculate public() https://www.mercurial-scm.org/repo/hg/rev/773a9a06047c changeset: 35331:773a9a06047c user:Pulkit Goyal <7895pul...@gmail.com> date:Wed Dec 06 06:40:27 2017 +0530 summary: clone: add support for storing remotenames while cloning https://www.mercurial-scm.org/repo/hg/rev/03bec089e105 changeset: 35332:03bec089e105 user:Phil Cohen date:Fri Dec 08 15:27:58 2017 -0800 summary: rebase: disable `inmemory` if the rebaseset contains the working copy https://www.mercurial-scm.org/repo/hg/rev/8dba17546016 changeset: 35333:8dba17546016 user:Phil Cohen date:Fri Dec 08 12:44:27 2017 -0800 summary: rebase: extract _assignworkingcopy https://www.mercurial-scm.org/repo/hg/rev/85f866bf9362 changeset: 35334:85f866bf9362 user:Augie Fackler date:Fri Dec 08 23:48:23 2017 -0500 summary: tests: glob away ' that doesn't occur on all platforms in lfs test https://www.mercurial-scm.org/repo/hg/rev/0181f99819d2 changeset: 35335:0181f99819d2 user:Boris Feld date:Thu Dec 07 15:55:59 2017 +0100 summary: upgrade: rename 'removecldeltachain' to 'plain-cl-delta' https://www.mercurial-scm.org/repo/hg/rev/c3e4f196b6e0 changeset: 35336:c3e4f196b6e0 user:Boris Feld date:Thu Dec 07 16:19:46 2017 +0100 summary: debugformat: add a 'debugformat' command https://www.mercurial-scm.org/repo/hg/rev/cfb403b92f43 changeset: 35337:cfb403b92f43 user:Boris Feld date:Thu Dec 07 16:05:20 2017 +0100 summary: debugformat: add data about the config when verbose https://www.mercurial-scm.org/repo/hg/rev/bd326f3e0e14 changeset: 35338:bd326f3e0e14 user:Boris Feld date:Thu Dec 07 16:12:32 2017 +0100 summary: debugformat: update label depending on value difference https://www.mercurial-scm.org/repo/hg/rev/740d40ec15c3 changeset: 35339:740d40ec15c3 user:Boris Feld date:Thu Dec 07 16:49:24 2017 +0100 summary: debugformat: handle non-boolean value for variant https://www.mercurial-scm.org/repo/hg/rev/ead01b74be04 changeset: 35340:ead01b74be04 user:Boris Feld date:Thu Dec 07 16:50:48 2017 +0100 summary: upgrade: register compression as a format variants https://www.mercurial-scm.org/repo/hg/rev/cb7a0ae053c6 changeset: 35341:cb7a0ae053c6 user:Boris Feld date:Thu Dec 07 20:50:24 2017 +0100 summary: upgrade: add a test to show the repository config being ignored https://www.mercurial-scm.org/repo/hg/rev/75520786ad2f changeset: 35342:75520786ad2f user:Boris Feld date:Thu Dec 07 18:55:35 2017 +0100 summary: upgrade: use the repository 'ui' as the base for the new repository https://www.mercurial-scm.org/repo/hg/rev/06987c6971be changeset: 35343:06987c6971be user:Boris Feld date:Thu Dec 07 18:56:10 2017 +0100 summary: upgrade: more standard creation of the temporary repository https://www.mercurial-scm.org/repo/hg/rev/8f3f8b8dbab7 changeset: 35344:8f3f8b8dbab7 user:Boris Feld date:Thu Dec 07 22:37:18 2017 +0100 summary: upgrade: use actual filelog to convert filelog https://www.mercurial-scm.org/repo/hg/rev/6226668a7169 changeset: 35345:6226668a7169 user:Boris Feld date:Thu Dec 07 20:27:03 2017 +0100 summary: upgrade: add a 'redeltafullall' mode https://www.mercurial-scm.org/repo/hg/rev/9eb19b13e92a changeset: 35346:9eb19b13e92a user:Boris Feld date:Thu Dec 07 21:56:18 2017 +0100 summary: lfs: allow to run 'debugupgraderepo' on repo with largefiles https://www.mercurial-scm.org/repo/hg/rev/a29fe459fc49 changeset: 35347:a29fe459fc49 user:Pulkit Goyal <7895pul...@gmail.com> date:Thu Dec 07 00:26:45 2017 +0530 summary: remotenames: rename related file and storage dir to logexchange https://www.mercurial-scm.org/repo/hg/rev/576ba8194fa8 changeset: 35348:576ba8194fa8 user:Pulkit Goyal <7895pul...@gmail.com> date:Sun Dec 10 02:52:48 2017 +0530 summary: py3: handle keyword arguments correctly in
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
akushner accepted this revision. akushner added a comment. Why was there a quote on Linux? I didn't see a quote when I ran the find command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1667 To: ikostia, #hg-reviewers, quark, akushner Cc: akushner, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1667: tests_: fix test-lfs.t on OSX where find does not have quotes
ikostia created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. TEST PLAN - run test-lfs.t REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D1667 AFFECTED FILES tests/test-lfs.t CHANGE DETAILS diff --git a/tests/test-lfs.t b/tests/test-lfs.t --- a/tests/test-lfs.t +++ b/tests/test-lfs.t @@ -571,7 +571,7 @@ the user cache. $ find $TESTTMP/repo12/.hg/store/lfs/objects -type f - find: */repo12/.hg/store/lfs/objects': $ENOENT$ (glob) + find: */repo12/.hg/store/lfs/objects*: $ENOENT$ (glob) [1] $ hg --config extensions.share= share repo12 repo13 To: ikostia, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1658: memfilectx: make changectx argument mandatory in constructor (API)
martinvonz added a comment. In https://phab.mercurial-scm.org/D1658#28514, @yuja wrote: > Looks good, but can you flag this as (API) change? Good point. Done. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1658 To: martinvonz, durin42, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1658: memfilectx: make changectx argument mandatory in constructor
martinvonz updated this revision to Diff 4381. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1658?vs=4365=4381 REVISION DETAIL https://phab.mercurial-scm.org/D1658 AFFECTED FILES contrib/synthrepo.py hgext/convert/hg.py hgext/histedit.py hgext/largefiles/lfcommands.py hgext/uncommit.py mercurial/cmdutil.py mercurial/context.py mercurial/debugcommands.py tests/test-commit.t tests/test-context.py CHANGE DETAILS diff --git a/tests/test-context.py b/tests/test-context.py --- a/tests/test-context.py +++ b/tests/test-context.py @@ -32,7 +32,7 @@ # test memctx with non-ASCII commit message def filectxfn(repo, memctx, path): -return context.memfilectx(repo, "foo", "") +return context.memfilectx(repo, memctx, "foo", "") ctx = context.memctx(repo, ['tip', None], encoding.tolocal("Gr\xc3\xbcezi!"), @@ -49,7 +49,7 @@ data, flags = fctx.data(), fctx.flags() if f == 'foo': data += 'bar\n' -return context.memfilectx(repo, f, data, 'l' in flags, 'x' in flags) +return context.memfilectx(repo, memctx, f, data, 'l' in flags, 'x' in flags) ctxa = repo.changectx(0) ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"], diff --git a/tests/test-commit.t b/tests/test-commit.t --- a/tests/test-commit.t +++ b/tests/test-commit.t @@ -648,7 +648,8 @@ > u = uimod.ui.load() > r = hg.repository(u, '.') > def filectxfn(repo, memctx, path): - > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') + > return context.memfilectx(repo, memctx, path, + > '[hooks]\nupdate = echo owned') > c = context.memctx(r, [r['tip'].node(), node.nullid], >'evil', [notrc], filectxfn, 0) > r.commitctx(c) @@ -673,7 +674,8 @@ > u = uimod.ui.load() > r = hg.repository(u, '.') > def filectxfn(repo, memctx, path): - > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') + > return context.memfilectx(repo, memctx, path, + > '[hooks]\nupdate = echo owned') > c = context.memctx(r, [r['tip'].node(), node.nullid], >'evil', [notrc], filectxfn, 0) > r.commitctx(c) @@ -692,7 +694,8 @@ > u = uimod.ui.load() > r = hg.repository(u, '.') > def filectxfn(repo, memctx, path): - > return context.memfilectx(repo, path, '[hooks]\nupdate = echo owned') + > return context.memfilectx(repo, memctx, path, + > '[hooks]\nupdate = echo owned') > c = context.memctx(r, [r['tip'].node(), node.nullid], >'evil', [notrc], filectxfn, 0) > r.commitctx(c) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -225,7 +225,8 @@ def fctxfn(repo, cx, path): if path in filecontent: -return context.memfilectx(repo, path, filecontent[path]) +return context.memfilectx(repo, cx, path, + filecontent[path]) return None if len(ps) == 0 or ps[0] < 0: diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2204,12 +2204,11 @@ files = self._cache.keys() def getfile(repo, memctx, path): if self._cache[path]['exists']: -return memfilectx(repo, path, +return memfilectx(repo, memctx, path, self._cache[path]['data'], 'l' in self._cache[path]['flags'], 'x' in self._cache[path]['flags'], - self._cache[path]['copied'], - memctx) + self._cache[path]['copied']) else: # Returning None, but including the path in `files`, is # necessary for memctx to register a deletion. @@ -2389,9 +2388,9 @@ copied = fctx.renamed() if copied: copied = copied[0] -return memfilectx(repo, path, fctx.data(), +return memfilectx(repo, memctx, path, fctx.data(), islink=fctx.islink(), isexec=fctx.isexec(), - copied=copied, memctx=memctx) + copied=copied) return getfilectx @@ -2405,9 +2404,8 @@ if data is None: return None islink, isexec = mode -return memfilectx(repo, path, data, islink=islink, - isexec=isexec, copied=copied, - memctx=memctx) +return memfilectx(repo, memctx, path, data, islink=islink, + isexec=isexec, copied=copied) return getfilectx @@ -2539,16 +2537,16 @@ See memctx and committablefilectx
D1656: synthrepo: create filectx instance in 'filectxfn' callback
martinvonz updated this revision to Diff 4380. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1656?vs=4364=4380 REVISION DETAIL https://phab.mercurial-scm.org/D1656 AFFECTED FILES contrib/synthrepo.py CHANGE DETAILS diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py --- a/contrib/synthrepo.py +++ b/contrib/synthrepo.py @@ -369,14 +369,14 @@ while not validpath(path): path = pickpath() data = '%s contents\n' % path -files[path] = context.memfilectx(repo, path, data) +files[path] = data dir = os.path.dirname(path) while dir and dir not in dirs: dirs.add(dir) dir = os.path.dirname(dir) def filectxfn(repo, memctx, path): -return files[path] +return context.memfilectx(repo, path, files[path]) ui.progress(_synthesizing, None) message = 'synthesized wide repo with %d files' % (len(files),) @@ -444,14 +444,12 @@ for __ in xrange(add): lines.insert(random.randint(0, len(lines)), makeline()) path = fctx.path() -changes[path] = context.memfilectx(repo, path, - '\n'.join(lines) + '\n') +changes[path] = '\n'.join(lines) + '\n' for __ in xrange(pick(filesremoved)): path = random.choice(mfk) for __ in xrange(10): path = random.choice(mfk) if path not in changes: -changes[path] = None break if filesadded: dirs = list(pctx.dirs()) @@ -466,9 +464,11 @@ pathstr = '/'.join(filter(None, path)) data = '\n'.join(makeline() for __ in xrange(pick(linesinfilesadded))) + '\n' -changes[pathstr] = context.memfilectx(repo, pathstr, data) +changes[pathstr] = data def filectxfn(repo, memctx, path): -return changes[path] +if path not in changes: +return None +return context.memfilectx(repo, path, changes[path]) if not changes: continue if revs: To: martinvonz, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1656: synthrepo: create filectx instance in 'filectxfn' callback
martinvonz marked an inline comment as done. martinvonz added inline comments. INLINE COMMENTS > yuja wrote in synthrepo.py:453 > Perhaps filectxfn() should return None in this case. Oops, good catch. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1656 To: martinvonz, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
hg-configexpress 0.3.0
Hello all, A new version (0.3.0) of hg-configexpress has been released, containing: * Various fixes (including for Windows and compatibility with 4.4) * Support for sending details about enabled extensions and their versions to the server The extension can be found at https://bitbucket.org/Mathiasdm/hg-configexpress/overview , be sure to give it a try! Greetings, Pierre-Yves and Mathias P.S. I forgot to send about this mail earlier, my apologies. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 4] hgweb: render next pages on /graph incrementally
# HG changeset patch # User Anton Shestakov# Date 1512978236 -28800 # Mon Dec 11 15:43:56 2017 +0800 # Node ID 865e71e7184410b60e2dd2912407d3884514e437 # Parent 79649cbad159b574d85902abc195089af01241cf hgweb: render next pages on /graph incrementally Previously, when user scrolled down to see the next page on /graph, all hgweb did was re-render everything that would be visible (by simply incrementing revcount). It was not efficient at all, and this patch makes /graph page behave similarly to the regular /log: every new page only consists of new changesets, no duplication, and only jsdata is based on the full set of changesets required to build accurate graph. This is achieved by adding "?graphtop=" to the next page URL template, effectively remembering where the graph started, and using that value to create the new `tree` that covers the whole visible graph. That variable is then used to produce jsdata for redrawing graph client-side. nextentry is used for the same purpose as on /log page (to format the next page URL), but it's not a part of the graph. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1207,6 +1207,10 @@ def graph(web, req, tmpl): morevars = copy.copy(tmpl.defaults['sessionvars']) morevars['revcount'] = revcount * 2 +graphtop = req.form.get('graphtop', [ctx.hex()])[0] +graphvars = copy.copy(tmpl.defaults['sessionvars']) +graphvars['graphtop'] = graphtop + count = len(web.repo) pos = rev @@ -1215,14 +1219,22 @@ def graph(web, req, tmpl): changenav = webutil.revnav(web.repo).gen(pos, revcount, count) tree = [] +nextentry = [] +lastrev = 0 if pos != -1: allrevs = web.repo.changelog.revs(pos, 0) revs = [] for i in allrevs: revs.append(i) -if len(revs) >= revcount: +if len(revs) >= revcount + 1: break +if len(revs) > revcount: +nextentry = [webutil.commonentry(web.repo, web.repo[revs[-1]])] +revs = revs[:-1] + +lastrev = revs[-1] + # We have to feed a baseset to dagwalker as it is expecting smartset # object. This does not have a big impact on hgweb performance itself # since hgweb graphing code is not itself lazy yet. @@ -1231,11 +1243,21 @@ def graph(web, req, tmpl): tree = list(item for item in graphmod.colored(dag, web.repo) if item[1] == graphmod.CHANGESET) +def fulltree(): +pos = web.repo[graphtop].rev() +tree = [] +if pos != -1: +revs = web.repo.changelog.revs(pos, lastrev) +dag = graphmod.dagwalker(web.repo, smartset.baseset(revs)) +tree = list(item for item in graphmod.colored(dag, web.repo) +if item[1] == graphmod.CHANGESET) +return tree + def jsdata(): return [{'node': pycompat.bytestr(ctx), 'vertex': vtx, 'edges': edges} -for (id, type, ctx, vtx, edges) in tree] +for (id, type, ctx, vtx, edges) in fulltree()] def nodes(): for row, (id, type, ctx, vtx, edges) in enumerate(tree): @@ -1260,9 +1282,11 @@ def graph(web, req, tmpl): return tmpl('graph', rev=rev, symrev=symrev, revcount=revcount, uprev=uprev, lessvars=lessvars, morevars=morevars, downrev=downrev, +graphvars=graphvars, rows=rows, bg_height=bg_height, changesets=count, +nextentry=nextentry, jsdata=lambda **x: jsdata(), nodes=lambda **x: nodes(), node=ctx.hex(), changenav=changenav) diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl --- a/mercurial/templates/gitweb/graph.tmpl +++ b/mercurial/templates/gitweb/graph.tmpl @@ -67,9 +67,12 @@ graph.render(data);
[PATCH 2 of 4] hgweb: calculate width and height client-side
# HG changeset patch # User Anton Shestakov# Date 1512892582 -28800 # Sun Dec 10 15:56:22 2017 +0800 # Node ID 2319d0216460c6f3b91f174a5027190aa80e07b7 # Parent e35959da063b5944369277f3b2c69c3af06e2710 hgweb: calculate width and height client-side hgweb determines and passes to templates some variables related to graph appearance, like bg_height, canvaswidth and canvasheight. bg_height was and still is used for graph.scale() call in graph.tmpl, and the two latter variables were used in element as width and height properties, and they were set before JS code got to run. Setting these properties server-side doesn't make a lot of sense, because a graph that has been scaled should calculate things like width and height on its own when being rendered. Let's move (re)sizing to JavaScript (to Graph.render function) and stop parsing HTML with regular expressions just to know new width and height. That extra loop that only counts cols is required because can't be resized after or in the process of rendering (or it gets cleared). Incidentally, SVG doesn't have this problem and I'm hoping to switch graph to using it in future. There also was truecanvasheight, but according to hg grep --all it was never used, see d490edc71146. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1231,13 +1231,6 @@ def graph(web, req, tmpl): tree = list(item for item in graphmod.colored(dag, web.repo) if item[1] == graphmod.CHANGESET) -def getcolumns(tree): -cols = 0 -for (id, type, ctx, vtx, edges) in tree: -cols = max(cols, max([edge[0] for edge in edges] or [0]), - max([edge[1] for edge in edges] or [0])) -return cols - def graphdata(usetuples): data = [] @@ -1266,17 +1259,14 @@ def graph(web, req, tmpl): return data -cols = getcolumns(tree) rows = len(tree) -canvasheight = (rows + 1) * bg_height - 27 return tmpl('graph', rev=rev, symrev=symrev, revcount=revcount, uprev=uprev, lessvars=lessvars, morevars=morevars, downrev=downrev, -cols=cols, rows=rows, changesets=count, -canvaswidth=(cols + 1) * bg_height, -truecanvasheight=rows * bg_height, -canvasheight=canvasheight, bg_height=bg_height, +rows=rows, +bg_height=bg_height, +changesets=count, jsdata=lambda **x: graphdata(True), nodes=lambda **x: graphdata(False), node=ctx.hex(), changenav=changenav) diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl --- a/mercurial/templates/gitweb/graph.tmpl +++ b/mercurial/templates/gitweb/graph.tmpl @@ -38,7 +38,7 @@ graph | - + {nodes%graphentry} diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl --- a/mercurial/templates/monoblue/graph.tmpl +++ b/mercurial/templates/monoblue/graph.tmpl @@ -30,7 +30,7 @@ The revision graph only works with JavaScript-enabled browsers. - + {nodes%graphentry} diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl --- a/mercurial/templates/paper/graph.tmpl +++ b/mercurial/templates/paper/graph.tmpl @@ -51,7 +51,7 @@ - + {nodes%graphentry} diff --git a/mercurial/templates/spartan/graph.tmpl b/mercurial/templates/spartan/graph.tmpl --- a/mercurial/templates/spartan/graph.tmpl +++ b/mercurial/templates/spartan/graph.tmpl @@ -32,7 +32,7 @@ navigate: {chang - + {nodes%graphentry} diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js --- a/mercurial/templates/static/mercurial.js +++ b/mercurial/templates/static/mercurial.js @@ -111,19 +111,30 @@ Graph.prototype = { var backgrounds = ''; var nodedata = ''; - var line, start, end, color, x, y, x0, y0, x1, y1, column, radius; + var i, j, cur, line, start, end, color, x, y, x0, y0, x1, y1, column, radius; - for (var i = 0; i < data.length; i++) { + var cols = 0; + for (i = 0; i < data.length; i++) { + cur = data[i]; + for (j = 0; j < cur.edges.length; j++) { + line = cur.edges[j]; + cols = Math.max(cols, line[0], line[1]); + } + } + this.canvas.width = (cols + 1) * this.bg_height; + this.canvas.height = (data.length + 1) * this.bg_height - 27; + + for (i = 0; i < data.length; i++) { var parity = i % 2; this.cell[1] +=
[PATCH 3 of 4] hgweb: split graphdata() into jsdata() and nodes()
# HG changeset patch # User Anton Shestakov# Date 1512971278 -28800 # Mon Dec 11 13:47:58 2017 +0800 # Node ID 79649cbad159b574d85902abc195089af01241cf # Parent 2319d0216460c6f3b91f174a5027190aa80e07b7 hgweb: split graphdata() into jsdata() and nodes() nodes keyword passed to the template can be any iterator, but jsdata needs to be a list because it gets JSONified. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1231,33 +1231,29 @@ def graph(web, req, tmpl): tree = list(item for item in graphmod.colored(dag, web.repo) if item[1] == graphmod.CHANGESET) -def graphdata(usetuples): -data = [] +def jsdata(): +return [{'node': pycompat.bytestr(ctx), + 'vertex': vtx, + 'edges': edges} +for (id, type, ctx, vtx, edges) in tree] -row = 0 -for (id, type, ctx, vtx, edges) in tree: -if usetuples: -node = pycompat.bytestr(ctx) -data.append({'node': node, 'vertex': vtx, 'edges': edges}) -else: -entry = webutil.commonentry(web.repo, ctx) -edgedata = [{'col': edge[0], 'nextcol': edge[1], - 'color': (edge[2] - 1) % 6 + 1, - 'width': edge[3], 'bcolor': edge[4]} -for edge in edges] +def nodes(): +for row, (id, type, ctx, vtx, edges) in enumerate(tree): +entry = webutil.commonentry(web.repo, ctx) +edgedata = [{'col': edge[0], + 'nextcol': edge[1], + 'color': (edge[2] - 1) % 6 + 1, + 'width': edge[3], + 'bcolor': edge[4]} +for edge in edges] -entry.update( -{'col': vtx[0], - 'color': (vtx[1] - 1) % 6 + 1, - 'edges': edgedata, - 'row': row, - 'nextrow': row + 1}) +entry.update({'col': vtx[0], + 'color': (vtx[1] - 1) % 6 + 1, + 'edges': edgedata, + 'row': row, + 'nextrow': row + 1}) -data.append(entry) - -row += 1 - -return data +yield entry rows = len(tree) @@ -1267,8 +1263,8 @@ def graph(web, req, tmpl): rows=rows, bg_height=bg_height, changesets=count, -jsdata=lambda **x: graphdata(True), -nodes=lambda **x: graphdata(False), +jsdata=lambda **x: jsdata(), +nodes=lambda **x: nodes(), node=ctx.hex(), changenav=changenav) def _getdoc(e): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 4] hgweb: filter graphmod.colored() output before iterating over it
# HG changeset patch # User Anton Shestakov# Date 1512741011 -28800 # Fri Dec 08 21:50:11 2017 +0800 # Node ID e35959da063b5944369277f3b2c69c3af06e2710 # Parent b963750b125f6e342a0e2148535b7c7d0bc50e3b hgweb: filter graphmod.colored() output before iterating over it Consumers in this function use output of graphmod.colored(), but only want items with type == CHANGESET, so let's filter it early. This is primarily just a refactoring, but it also fixes a potential small bug with `rows = len(tree)` (this variable is used for "Rows shown" line in raw-graph) if there are items of other types. diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -1228,13 +1228,12 @@ def graph(web, req, tmpl): # since hgweb graphing code is not itself lazy yet. dag = graphmod.dagwalker(web.repo, smartset.baseset(revs)) # As we said one line above... not lazy. -tree = list(graphmod.colored(dag, web.repo)) +tree = list(item for item in graphmod.colored(dag, web.repo) +if item[1] == graphmod.CHANGESET) def getcolumns(tree): cols = 0 for (id, type, ctx, vtx, edges) in tree: -if type != graphmod.CHANGESET: -continue cols = max(cols, max([edge[0] for edge in edges] or [0]), max([edge[1] for edge in edges] or [0])) return cols @@ -1244,9 +1243,6 @@ def graph(web, req, tmpl): row = 0 for (id, type, ctx, vtx, edges) in tree: -if type != graphmod.CHANGESET: -continue - if usetuples: node = pycompat.bytestr(ctx) data.append({'node': node, 'vertex': vtx, 'edges': edges}) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] templatefilters: add slashpath() to convert path separator to slash
# HG changeset patch # User Yuya Nishihara# Date 1508573942 -32400 # Sat Oct 21 17:19:02 2017 +0900 # Node ID c2ff7689990d5c163cff48c38880928ee98e4248 # Parent 6ef72e8546b2c86b7ca4ba190fe1affcaa3a440c templatefilters: add slashpath() to convert path separator to slash Prepares for deprecating the ui.slash option, which isn't always respected. diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -349,6 +349,11 @@ def shortdate(text): """Date. Returns a date like "2006-09-18".""" return util.shortdate(text) +@templatefilter('slashpath') +def slashpath(path): +"""Any text. Replaces the native path separator with slash.""" +return util.pconvert(path) + @templatefilter('splitlines') def splitlines(text): """Any text. Split text into a list of lines.""" diff --git a/tests/test-locate.t b/tests/test-locate.t --- a/tests/test-locate.t +++ b/tests/test-locate.t @@ -151,4 +151,13 @@ Issue294: hg remove --after dir fails wh $ hg files . [1] +Convert native path separator to slash (issue5572) + + $ hg files -T '{path|slashpath}\n' + ../b + ../dir.h/foo + ../t.h + ../t/e.h + ../t/x + $ cd ../.. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] help: deprecate ui.slash in favor of slashpath template filter (issue5572)
# HG changeset patch # User Yuya Nishihara# Date 1508574434 -32400 # Sat Oct 21 17:27:14 2017 +0900 # Node ID 740dce20be8f125bd7a55aad849932e1c40820a9 # Parent c2ff7689990d5c163cff48c38880928ee98e4248 help: deprecate ui.slash in favor of slashpath template filter (issue5572) > For some reason, I thought someone (Mads?) said we had basically given > up on ui.slash, and some commands didn't support it. (from https://bz.mercurial-scm.org/show_bug.cgi?id=5572#c1) So the ui.slash option doesn't always work and is somewhat confusing. Let's make it clearer we won't improve the situation. diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -2184,6 +2184,8 @@ User interface controls. (default: True) ``slash`` +(Deprecated. Use ``slashpath`` template filter instead.) + Display paths using a slash (``/``) as the path separator. This only makes a difference on systems where the default path separator is not the slash character (e.g. Windows uses the ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] extdata: abort if external command exits with non-zero status (BC)
# HG changeset patch # User Yuya Nishihara# Date 1506856910 -3600 # Sun Oct 01 12:21:50 2017 +0100 # Node ID 6ef72e8546b2c86b7ca4ba190fe1affcaa3a440c # Parent b963750b125f6e342a0e2148535b7c7d0bc50e3b extdata: abort if external command exits with non-zero status (BC) Per the last discussion, this is more reliable and consistent way than suppressing an error. For grep, erroring out might be inconvenient, but for curl, non-zero exit status should be detected. The latter wouldn't be possible if non-zero status is ignored. https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-October/105727.html diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1100,12 +1100,11 @@ def extdatasource(repo, source): finally: if proc: proc.communicate() -if proc.returncode != 0: -# not an error so 'cmd | grep' can be empty -repo.ui.debug("extdata command '%s' %s\n" - % (cmd, util.explainexit(proc.returncode)[0])) if src: src.close() +if proc and proc.returncode != 0: +raise error.Abort(_("extdata command '%s' failed: %s") + % (cmd, util.explainexit(proc.returncode)[0])) return data diff --git a/tests/test-extdata.t b/tests/test-extdata.t --- a/tests/test-extdata.t +++ b/tests/test-extdata.t @@ -46,8 +46,8 @@ test weight of extdata() revset test non-zero exit of shell command $ hg log -qr "extdata(emptygrep)" - $ hg log -qr "extdata(emptygrep)" --debug - extdata command 'cat extdata.txt | grep empty' exited with status * (glob) + abort: extdata command 'cat extdata.txt | grep empty' failed: exited with status 1 + [255] test bad extdata() revset source ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4 V2] lfs: restore the local blob store after a repo upgrade
On Sat, 09 Dec 2017 20:57:11 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1512710310 18000 > # Fri Dec 08 00:18:30 2017 -0500 > # Node ID d435feccadfa39d45fefc162ebda0efac2e2ba7c > # Parent f060232e47d7e6f480c102e091e444d5f79de889 > lfs: restore the local blob store after a repo upgrade > +def upgradefinishdatamigration(orig, ui, srcrepo, dstrepo, requirements): > +orig(ui, srcrepo, dstrepo, requirements) > + > +srclfsvfs = srcrepo.svfs.lfslocalblobstore.vfs > +dstlfsvfs = dstrepo.svfs.lfslocalblobstore.vfs > + > +for dirpath, dirs, files in srclfsvfs.walk(): > +for oid in files: > +srcrepo.ui.write(_('copying lfs blob %s\n') % oid) ^^ Nit: perhaps it's better to use 'ui' passed by argument, not srcrepo's. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 4 V2] lfs: override walk() in lfsvfs
On Sat, 09 Dec 2017 20:57:10 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1512708246 18000 > # Thu Dec 07 23:44:06 2017 -0500 > # Node ID f060232e47d7e6f480c102e091e444d5f79de889 > # Parent 174a9429a46635c56e038def4a1ac87d8d96ba88 > lfs: override walk() in lfsvfs > --- a/hgext/lfs/blobstore.py > +++ b/hgext/lfs/blobstore.py > @@ -15,6 +15,7 @@ > > from mercurial import ( > error, > +pathutil, > url as urlmod, > util, > vfs as vfsmod, > @@ -32,6 +33,28 @@ > raise error.ProgrammingError('unexpected lfs path: %s' % path) > return super(lfsvfs, self).join(path[0:2], path[2:]) > > +def walk(self, path=None, onerror=None): > +"""Yield (dirpath, '', oids) tuple for blobs under path > + > +Oids only exist in the root of this vfs, so dirpath is always ''. > +""" > +root = os.path.normpath(self.base) > +# when dirpath == root, dirpath[prefixlen:] becomes empty > +# because len(dirpath) < prefixlen. > +prefixlen = len(pathutil.normasprefix(root)) > +oids = [] > + > +for dirpath, dirs, files in os.walk(self.reljoin(self.base, path or > ''), > +onerror=onerror): > +dirpath = dirpath[prefixlen:] > + > +# Silently skip unexpected files and directories > +if len(dirpath) == 2: > +oids.extend([dirpath + f for f in files > + if _lfsre.match(dirpath + f)]) Accumulating all files might not be ideal as the directory structure is designed to not, but I have no idea how lfsvfs.walk() should behave. > + > +yield ('', '', oids) ^^ 'dirs' should be an empty list. Can you send a follow up? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1666: rebase: replace --inmemory flag with rebase.experimental.inmemory config
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdd11df900f7f: rebase: replace --inmemory flag with rebase.experimental.inmemory config (authored by phillco, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1666?vs=4377=4379 REVISION DETAIL https://phab.mercurial-scm.org/D1666 AFFECTED FILES hgext/rebase.py mercurial/configitems.py tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -4,6 +4,8 @@ > amend= > rebase= > debugdrawdag=$TESTDIR/drawdag.py + > [rebase] + > experimental.inmemory=1 > [diff] > git=1 > [alias] @@ -35,7 +37,7 @@ c (no-eol) $ hg cat -r 2 b b (no-eol) - $ hg rebase --inmemory --debug -r b -d c | grep rebasing + $ hg rebase --debug -r b -d c | grep rebasing rebasing in-memory rebasing 2:db0e82a16a62 "b" (b) $ hg tglog @@ -94,7 +96,7 @@ b (no-eol) $ hg cat -r 3 e somefile (no-eol) - $ hg rebase --inmemory --debug -s b -d a | grep rebasing + $ hg rebase --debug -s b -d a | grep rebasing rebasing in-memory rebasing 2:db0e82a16a62 "b" (b) $ hg tglog @@ -110,7 +112,7 @@ c (no-eol) $ hg cat -r 3 b b (no-eol) - $ hg rebase --inmemory --debug -s 1 -d 3 | grep rebasing + $ hg rebase --debug -s 1 -d 3 | grep rebasing rebasing in-memory rebasing 1:02952614a83d "d" (d) rebasing 2:f56b71190a8f "c" @@ -142,7 +144,7 @@ we requested in-memory. $ hg up -C 3 0 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ hg rebase -r 3 -d 0 --inmemory --debug | grep rebasing + $ hg rebase -r 3 -d 0 --debug | grep rebasing rebasing on disk rebasing 3:753feb6fd12a "c" (tip) $ hg tglog diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -1269,3 +1269,6 @@ coreconfigitem('rebase', 'singletransaction', default=False, ) +coreconfigitem('rebase', 'experimental.inmemory', +default=False, +) diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -136,7 +136,7 @@ class rebaseruntime(object): """This class is a container for rebase runtime state""" -def __init__(self, repo, ui, opts=None): +def __init__(self, repo, ui, inmemory=False, opts=None): if opts is None: opts = {} @@ -179,7 +179,7 @@ self.keepopen = opts.get('keepopen', False) self.obsoletenotrebased = {} self.obsoletewithoutsuccessorindestination = set() -self.inmemory = opts.get('inmemory', False) +self.inmemory = inmemory @property def repo(self): @@ -645,7 +645,6 @@ ('i', 'interactive', False, _('(DEPRECATED)')), ('t', 'tool', '', _('specify merge tool')), ('c', 'continue', False, _('continue an interrupted rebase')), -('', 'inmemory', False, _('run rebase in-memory (EXPERIMENTAL)')), ('a', 'abort', False, _('abort an interrupted rebase'))] + cmdutil.formatteropts, _('[-s REV | -b REV] [-d REV] [OPTION]')) @@ -757,35 +756,40 @@ [rebase] singletransaction = True +By default, rebase writes to the working copy, but you can configure it to +run in-memory for for better performance, and to allow it to run if the +working copy is dirty:: + + [rebase] + experimental.inmemory = True + Return Values: Returns 0 on success, 1 if nothing to rebase or there are unresolved conflicts. """ +inmemory = ui.configbool('rebase', 'experimental.inmemory') if opts.get('continue') or opts.get('abort'): # in-memory rebase is not compatible with resuming rebases. -opts['inmemory'] = False +inmemory = False -if opts.get('inmemory', False): +if inmemory: try: # in-memory merge doesn't support conflicts, so if we hit any, abort # and re-run as an on-disk merge. -return _origrebase(ui, repo, **opts) +return _origrebase(ui, repo, inmemory=inmemory, **opts) except error.InMemoryMergeConflictsError: ui.warn(_('hit merge conflicts; re-running rebase without in-memory' ' merge\n')) _origrebase(ui, repo, **{'abort': True}) -opts['inmemory'] = False -return _origrebase(ui, repo, **opts) +return _origrebase(ui, repo, inmemory=False, **opts) else: return _origrebase(ui, repo, **opts) -def _origrebase(ui, repo, **opts): +def _origrebase(ui, repo, inmemory=False, **opts): opts = pycompat.byteskwargs(opts) -if 'inmemory' not in opts: -opts['inmemory'] = False -rbsrt = rebaseruntime(repo, ui, opts) +rbsrt = rebaseruntime(repo, ui, inmemory, opts) with repo.wlock(), repo.lock():
D1653: tests: add some commentary and diagnostics to test-run-tests.t
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc0c6df81c9bb: tests: add some commentary and diagnostics to test-run-tests.t (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1653?vs=4349=4378 REVISION DETAIL https://phab.mercurial-scm.org/D1653 AFFECTED FILES tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1214,7 +1214,12 @@ > #else > $ test "\$TESTDIR" = "$TESTTMP"/anothertests > #endif - > $ test "\$RUNTESTDIR" = "$TESTDIR" + > If this prints a path, that means RUNTESTDIR didn't equal + > TESTDIR as it should have. + > $ test "\$RUNTESTDIR" = "$TESTDIR" || echo "\$RUNTESTDIR" + > This should print the start of check-code. If this passes but the + > previous check failed, that means we found a copy of check-code at whatever + > RUNTESTSDIR ended up containing, even though it doesn't match TESTDIR. > $ head -n 3 "\$RUNTESTDIR"/../contrib/check-code.py | sed 's@.!.*python@#!USRBINENVPY@' > #!USRBINENVPY > # To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] hgweb: implement json-graph
On Thu, 07 Dec 2017 18:02:35 +0800, Anton Shestakov wrote: > # HG changeset patch > # User Anton Shestakov> # Date 1512638309 -28800 > # Thu Dec 07 17:18:29 2017 +0800 > # Node ID 4c48bb27dbf7473326b372c776bc1abc57a65d3d > # Parent cb0df5a3affba6e8f1789de337230cbeecda9c5a > hgweb: implement json-graph > > It's essentially a copy of json-log with graph-related things added (col, row, > color, edges). Seems fine. Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1658: memfilectx: make changectx argument mandatory in constructor
yuja added a comment. Looks good, but can you flag this as (API) change? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1658 To: martinvonz, durin42, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1656: synthrepo: create filectx instance in 'filectxfn' callback
yuja requested changes to this revision. yuja added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > synthrepo.py:453 > if path not in changes: > changes[path] = None > break Perhaps filectxfn() should return None in this case. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1656 To: martinvonz, #hg-reviewers, durin42, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1621: transaction: encodes tuples in changes['phases'] as 4 bit ints
yuja added a comment. In https://phab.mercurial-scm.org/D1621#28387, @joerg.sonnenberger wrote: > The bitset version has shown already that optimizing this is worthwhile and can eliminate up to 10% of the total size of the transaction object. IIRC, Jun said a plain intbitset wouldn't be optimal for all scenarios, and I agree with that. Also, it isn't a standard Python library. I think the current way of recording phase change is too ad-hoc if it does iterate all incoming nodes to build `(old, new)` phases pairs. Instead, can't we reconstruct them from DAG + old/new phase roots, for example? If the current `tr.changes['phases']` is only used by hooks and third-party extensions, it can be opt-in feature. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1621 To: joerg.sonnenberger, #hg-reviewers, quark Cc: yuja, quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] templater: fix "one arguments"
On Tue, 12 Dec 2017 17:08:53 +0800, Anton Shestakov wrote: > # HG changeset patch > # User Anton Shestakov> # Date 1513067366 -28800 > # Tue Dec 12 16:29:26 2017 +0800 > # Node ID c77b2387bd202d65f410392f472a40e9a6668f95 > # Parent cb0df5a3affba6e8f1789de337230cbeecda9c5a > # EXP-Topic hgweb-more-info > templater: fix "one arguments" Queued for stable, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] templater: fix "one arguments"
# HG changeset patch # User Anton Shestakov# Date 1513067366 -28800 # Tue Dec 12 16:29:26 2017 +0800 # Node ID c77b2387bd202d65f410392f472a40e9a6668f95 # Parent cb0df5a3affba6e8f1789de337230cbeecda9c5a # EXP-Topic hgweb-more-info templater: fix "one arguments" diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -918,7 +918,7 @@ def max_(context, mapping, args, **kwarg """Return the max of an iterable""" if len(args) != 1: # i18n: "max" is a keyword -raise error.ParseError(_("max expects one arguments")) +raise error.ParseError(_("max expects one argument")) iterable = evalfuncarg(context, mapping, args[0]) try: @@ -933,7 +933,7 @@ def min_(context, mapping, args, **kwarg """Return the min of an iterable""" if len(args) != 1: # i18n: "min" is a keyword -raise error.ParseError(_("min expects one arguments")) +raise error.ParseError(_("min expects one argument")) iterable = evalfuncarg(context, mapping, args[0]) try: @@ -958,7 +958,7 @@ def obsfateoperations(context, mapping, """Compute obsfate related information based on markers (EXPERIMENTAL)""" if len(args) != 1: # i18n: "obsfateoperations" is a keyword -raise error.ParseError(_("obsfateoperations expects one arguments")) +raise error.ParseError(_("obsfateoperations expects one argument")) markers = evalfuncarg(context, mapping, args[0]) @@ -975,7 +975,7 @@ def obsfatedate(context, mapping, args): """Compute obsfate related information based on markers (EXPERIMENTAL)""" if len(args) != 1: # i18n: "obsfatedate" is a keyword -raise error.ParseError(_("obsfatedate expects one arguments")) +raise error.ParseError(_("obsfatedate expects one argument")) markers = evalfuncarg(context, mapping, args[0]) @@ -992,7 +992,7 @@ def obsfateusers(context, mapping, args) """Compute obsfate related information based on markers (EXPERIMENTAL)""" if len(args) != 1: # i18n: "obsfateusers" is a keyword -raise error.ParseError(_("obsfateusers expects one arguments")) +raise error.ParseError(_("obsfateusers expects one argument")) markers = evalfuncarg(context, mapping, args[0]) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1426: logtoprocess: add the possibility to not start a shell
lothiraldan added a comment. I've access to a Windows machine this week, so you can expect a comment or new version before the end of the week. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1426 To: lothiraldan, #hg-reviewers, mbthomas Cc: durin42, yuja, mbthomas, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel