D6387: bookmarks: keep bookmarks in .hg/store if new config set
martinvonz created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Bookmarks storage consists of two parts: (1) the set of bookmarks and their positions, and (2) the current bookmark. The former can get updated by exchange, while the latter cannot. However, they are both stored in directly .hg/ and protected by repo.wlock(). As a result, ugly workarounds were needed. This patch introduces a new config option to store the set of bookmarks and their positions in .hg/store/ but still storing the current bookmark directory in .hg/. The config option only takes effect at repo creation time. It results in a new requirement being set. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6387 AFFECTED FILES hgext/share.py mercurial/bookmarks.py mercurial/configitems.py mercurial/help/config.txt mercurial/localrepo.py mercurial/store.py tests/test-help.t tests/test-share-bookmarks.t CHANGE DETAILS diff --git a/tests/test-share-bookmarks.t b/tests/test-share-bookmarks.t --- a/tests/test-share-bookmarks.t +++ b/tests/test-share-bookmarks.t @@ -1,6 +1,13 @@ +#testcases vfs svfs + $ echo "[extensions]" >> $HGRCPATH $ echo "share = " >> $HGRCPATH +#if svfs + $ echo "[format]" >> $HGRCPATH + $ echo "bookmarks-in-store = yes " >> $HGRCPATH +#endif + prepare repo1 $ hg init repo1 @@ -33,17 +40,21 @@ $ cd ../repo2 $ hg book bm2 $ hg bookmarks + bm1 2:c2e0ac586386 (svfs !) * bm2 2:c2e0ac586386 $ cd ../repo3 $ hg bookmarks bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) $ hg book bm3 $ hg bookmarks bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) * bm3 2:c2e0ac586386 $ cd ../repo1 $ hg bookmarks * bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) bm3 2:c2e0ac586386 check whether HG_PENDING makes pending changes only in relatd @@ -70,14 +81,18 @@ $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX @repo1 bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) bm3 2:c2e0ac586386 * bmX 2:c2e0ac586386 @repo2 + bm1 2:c2e0ac586386 (svfs !) * bm2 2:c2e0ac586386 + bm3 2:c2e0ac586386 (svfs !) @repo3 bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) * bm3 2:c2e0ac586386 - bmX 2:c2e0ac586386 + bmX 2:c2e0ac586386 (vfs !) transaction abort! rollback completed abort: pretxnclose hook exited with status 1 @@ -92,19 +107,28 @@ $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX @repo1 * bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) bm3 2:c2e0ac586386 @repo2 + bm1 2:c2e0ac586386 (svfs !) * bm2 2:c2e0ac586386 + bm3 2:c2e0ac586386 (svfs !) @repo3 bm1 2:c2e0ac586386 + bm2 2:c2e0ac586386 (svfs !) bm3 2:c2e0ac586386 * bmX 2:c2e0ac586386 transaction abort! rollback completed abort: pretxnclose hook exited with status 1 [255] $ hg book bm3 +clean up bm2 since it's uninteresting (not shared in the vfs case and +same as bm3 in the svfs case) + $ cd ../repo2 + $ hg book -d bm2 + $ cd ../repo1 test that commits work diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1513,6 +1513,8 @@ "revlog-compression" + "bookmarks-in-store" + "profiling" --- diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -337,7 +337,7 @@ mode = None return mode -_data = ('narrowspec data meta 00manifest.d 00manifest.i' +_data = ('bookmarks narrowspec data meta 00manifest.d 00manifest.i' ' 00changelog.d 00changelog.i phaseroots obsstore') def isrevlog(f, kind, st): @@ -612,7 +612,7 @@ raise def copylist(self): -d = ('narrowspec data meta dh fncache phaseroots obsstore' +d = ('bookmarks narrowspec data meta dh fncache phaseroots obsstore' ' 00manifest.d 00manifest.i 00changelog.d 00changelog.i') return (['requires', '00changelog.i'] + ['store/' + f for f in d.split()]) dif
D6388: exchange: don't take wlock if bookmarks are stored in .hg/store/
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY If bookmarks are stored in .hg/store/, there is no need for the wlock(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6388 AFFECTED FILES mercurial/exchange.py CHANGE DETAILS diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -539,10 +539,12 @@ # get lock as we might write phase data wlock = lock = None try: -# bundle2 push may receive a reply bundle touching bookmarks or other -# things requiring the wlock. Take it now to ensure proper ordering. +# bundle2 push may receive a reply bundle touching bookmarks +# requiring the wlock. Take it now to ensure proper ordering. maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback') -if (not _forcebundle1(pushop)) and maypushback: +if ((not _forcebundle1(pushop)) and +maypushback and +not bookmod.bookmarksinstore(repo)): wlock = pushop.repo.wlock() lock = pushop.repo.lock() pushop.trmanager = transactionmanager(pushop.repo, @@ -1548,7 +1550,10 @@ raise error.Abort(msg) pullop.trmanager = transactionmanager(repo, 'pull', remote.url()) -with repo.wlock(), repo.lock(), pullop.trmanager: +wlock = util.nullcontextmanager() +if not bookmod.bookmarksinstore(repo): +wlock = repo.wlock() +with wlock, repo.lock(), pullop.trmanager: # Use the modern wire protocol, if available. if remote.capable('command-changesetdata'): exchangev2.pull(pullop) @@ -2395,7 +2400,8 @@ try: def gettransaction(): if not lockandtr[2]: -lockandtr[0] = repo.wlock() +if not bookmod.bookmarksinstore(repo): +lockandtr[0] = repo.wlock() lockandtr[1] = repo.lock() lockandtr[2] = repo.transaction(source) lockandtr[2].hookargs['source'] = source 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
D6386: help: add missing blank line, making "revlog-compression" show up
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6386 AFFECTED FILES mercurial/help/config.txt tests/test-help.t CHANGE DETAILS diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1511,6 +1511,8 @@ "sparse-revlog" + "revlog-compression" + "profiling" --- diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -870,6 +870,7 @@ Repositories with this on-disk format require Mercurial version 4.7 Enabled by default. + ``revlog-compression`` Compression algorithm used by revlog. Supported value are `zlib` and `zstd`. The `zlib` engine is the historical default of Mercurial. `zstd` is a newer 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
D6384: tests: separate out bookmarks tests from test-share.t
martinvonz created this revision. Herald added subscribers: mercurial-devel, mjpieters. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6384 AFFECTED FILES tests/test-share-bookmarks.t tests/test-share.t CHANGE DETAILS diff --git a/tests/test-share.t b/tests/test-share.t --- a/tests/test-share.t +++ b/tests/test-share.t @@ -157,251 +157,16 @@ $ cd .. -test sharing bookmarks - - $ hg share -B repo1 repo3 - updating working directory - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd repo1 - $ hg bookmark bm1 - $ hg bookmarks - * bm1 2:c2e0ac586386 - $ cd ../repo2 - $ hg book bm2 - $ hg bookmarks - * bm2 3:0e6e70d1d5f1 - $ cd ../repo3 - $ hg bookmarks - bm1 2:c2e0ac586386 - $ hg book bm3 - $ hg bookmarks - bm1 2:c2e0ac586386 - * bm3 2:c2e0ac586386 - $ cd ../repo1 - $ hg bookmarks - * bm1 2:c2e0ac586386 - bm3 2:c2e0ac586386 - -check whether HG_PENDING makes pending changes only in relatd -repositories visible to an external hook. - -In "hg share" case, another transaction can't run in other -repositories sharing same source repository, because starting -transaction requires locking store of source repository. - -Therefore, this test scenario ignores checking visibility of -.hg/bookmakrs.pending in repo2, which shares repo1 without bookmarks. - - $ cat > $TESTTMP/checkbookmarks.sh < echo "@repo1" - > hg -R "$TESTTMP/repo1" bookmarks - > echo "@repo2" - > hg -R "$TESTTMP/repo2" bookmarks - > echo "@repo3" - > hg -R "$TESTTMP/repo3" bookmarks - > exit 1 # to avoid adding new bookmark for subsequent tests - > EOF - - $ cd ../repo1 - $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX - @repo1 - bm1 2:c2e0ac586386 - bm3 2:c2e0ac586386 - * bmX 2:c2e0ac586386 - @repo2 - * bm2 3:0e6e70d1d5f1 - @repo3 - bm1 2:c2e0ac586386 - * bm3 2:c2e0ac586386 - bmX 2:c2e0ac586386 - transaction abort! - rollback completed - abort: pretxnclose hook exited with status 1 - [255] - $ hg book bm1 - -FYI, in contrast to above test, bmX is invisible in repo1 (= shared -src), because (1) HG_PENDING refers only repo3 and (2) -"bookmarks.pending" is written only into repo3. - - $ cd ../repo3 - $ hg --config hooks.pretxnclose="sh $TESTTMP/checkbookmarks.sh" -q book bmX - @repo1 - * bm1 2:c2e0ac586386 - bm3 2:c2e0ac586386 - @repo2 - * bm2 3:0e6e70d1d5f1 - @repo3 - bm1 2:c2e0ac586386 - bm3 2:c2e0ac586386 - * bmX 2:c2e0ac586386 - transaction abort! - rollback completed - abort: pretxnclose hook exited with status 1 - [255] - $ hg book bm3 - - $ cd ../repo1 - -test that commits work - - $ echo 'shared bookmarks' > a - $ hg commit -m 'testing shared bookmarks' - $ hg bookmarks - * bm1 3:b87954705719 - bm3 2:c2e0ac586386 - $ cd ../repo3 - $ hg bookmarks - bm1 3:b87954705719 - * bm3 2:c2e0ac586386 - $ echo 'more shared bookmarks' > a - $ hg commit -m 'testing shared bookmarks' - created new head - $ hg bookmarks - bm1 3:b87954705719 - * bm3 4:62f4ded848e4 - $ cd ../repo1 - $ hg bookmarks - * bm1 3:b87954705719 - bm3 4:62f4ded848e4 - $ cd .. - non largefiles repos won't enable largefiles - $ hg share --config extensions.largefiles= repo3 sharedrepo + $ hg share --config extensions.largefiles= repo2 sharedrepo The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved $ [ -f sharedrepo/.hg/hgrc ] [1] -test pushing bookmarks works - - $ hg clone repo3 repo4 - updating to branch default - 2 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cd repo4 - $ hg boo bm4 - $ echo foo > b - $ hg commit -m 'foo in b' - $ hg boo - bm1 3:b87954705719 - bm3 4:62f4ded848e4 - * bm4 5:92793bfc8cad - $ hg push -B bm4 - pushing to $TESTTMP/repo3 - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - exporting bookmark bm4 - $ cd ../repo1
D6385: tests: fix share test to actually share the repo
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY "repo2" is clearly meant to be a share from "repo1" but without sharing bookmarks. However, `hg unshare` was called in the repo, so it had become completely unrelated and thus not testing what it was supposed to test. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6385 AFFECTED FILES tests/test-share-bookmarks.t CHANGE DETAILS diff --git a/tests/test-share-bookmarks.t b/tests/test-share-bookmarks.t --- a/tests/test-share-bookmarks.t +++ b/tests/test-share-bookmarks.t @@ -21,21 +21,6 @@ updating working directory 2 files updated, 0 files merged, 0 files removed, 0 files unresolved -unshare it - - $ cd repo2 - $ hg unshare - -check that a change does not propagate - - $ echo b >> b - $ hg commit -m'change in unshared' - $ cd ../repo1 - $ hg id -r tip - c2e0ac586386 tip - - $ cd .. - test sharing bookmarks $ hg share -B repo1 repo3 @@ -48,7 +33,7 @@ $ cd ../repo2 $ hg book bm2 $ hg bookmarks - * bm2 3:0e6e70d1d5f1 + * bm2 2:c2e0ac586386 $ cd ../repo3 $ hg bookmarks bm1 2:c2e0ac586386 @@ -69,7 +54,7 @@ transaction requires locking store of source repository. Therefore, this test scenario ignores checking visibility of -.hg/bookmakrs.pending in repo2, which shares repo1 without bookmarks. +.hg/bookmarks.pending in repo2, which shares repo1 without bookmarks. $ cat > $TESTTMP/checkbookmarks.sh < echo "@repo1" @@ -88,7 +73,7 @@ bm3 2:c2e0ac586386 * bmX 2:c2e0ac586386 @repo2 - * bm2 3:0e6e70d1d5f1 + * bm2 2:c2e0ac586386 @repo3 bm1 2:c2e0ac586386 * bm3 2:c2e0ac586386 @@ -109,7 +94,7 @@ * bm1 2:c2e0ac586386 bm3 2:c2e0ac586386 @repo2 - * bm2 3:0e6e70d1d5f1 + * bm2 2:c2e0ac586386 @repo3 bm1 2:c2e0ac586386 bm3 2:c2e0ac586386 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
D6383: bookmarks: use vfs.tryread() instead of reimplementing it
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6383 AFFECTED FILES mercurial/bookmarks.py CHANGE DETAILS diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -297,28 +297,12 @@ itself as we commit. This function returns the name of that bookmark. It is stored in .hg/bookmarks.current """ -try: -file = repo.vfs('bookmarks.current') -except IOError as inst: -if inst.errno != errno.ENOENT: -raise -return None -try: -# No readline() in osutil.posixfile, reading everything is -# cheap. -# Note that it's possible for readlines() here to raise -# IOError, since we might be reading the active mark over -# static-http which only tries to load the file when we try -# to read from it. -mark = encoding.tolocal((file.readlines() or [''])[0]) -if mark == '' or mark not in marks: -mark = None -except IOError as inst: -if inst.errno != errno.ENOENT: -raise -return None -finally: -file.close() +# No readline() in osutil.posixfile, reading everything is +# cheap. +content = repo.vfs.tryread('bookmarks.current') +mark = encoding.tolocal((content.splitlines() or [''])[0]) +if mark == '' or mark not in marks: +mark = None return mark def activate(repo, mark): 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
D6382: bookmarks: use context manager when writing files
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6382 AFFECTED FILES mercurial/bookmarks.py CHANGE DETAILS diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -204,27 +204,18 @@ rbm._writeactive() with repo.wlock(): -file_ = repo.vfs('bookmarks', 'w', atomictemp=True, - checkambig=True) -try: -self._write(file_) -except: # re-raises -file_.discard() -raise -finally: -file_.close() +with repo.vfs('bookmarks', 'w', atomictemp=True, + checkambig=True) as f: +self._write(f) def _writeactive(self): if self._aclean: return with self._repo.wlock(): if self._active is not None: -f = self._repo.vfs('bookmarks.current', 'w', atomictemp=True, - checkambig=True) -try: +with self._repo.vfs('bookmarks.current', 'w', atomictemp=True, + checkambig=True) as f: f.write(encoding.fromlocal(self._active)) -finally: -f.close() else: self._repo.vfs.tryunlink('bookmarks.current') self._aclean = True To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6381: exthelper: add some semi-useful trace logs
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It'd be nice to make the trace functions a little better-named in the output, but I'm not sure how much better we can do without overhead. This at least lets you see if a single reposetup function is eating all the time or if it's spread over all of them. I needed this because Google's uber-extension has a long load time and I wasn't sure where the problem was. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6381 AFFECTED FILES mercurial/exthelper.py CHANGE DETAILS diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py --- a/mercurial/exthelper.py +++ b/mercurial/exthelper.py @@ -15,9 +15,12 @@ commands, error, extensions, +pycompat, registrar, ) +from hgdemandimport import tracing + class exthelper(object): """Helper for modular extension setup @@ -135,7 +138,8 @@ for cont, funcname, wrapper in self._functionwrappers: extensions.wrapfunction(cont, funcname, wrapper) for c in self._uicallables: -c(ui) +with tracing.log(b'finaluisetup: %s', pycompat.sysbytes(repr(c))): +c(ui) def finaluipopulate(self, ui): """Method to be used as the extension uipopulate @@ -175,7 +179,8 @@ entry[1].append(opt) for c in self._extcallables: -c(ui) +with tracing.log(b'finalextsetup: %s', pycompat.sysbytes(repr(c))): +c(ui) def finalreposetup(self, ui, repo): """Method to be used as the extension reposetup @@ -187,7 +192,8 @@ - Changes to repo.__class__, repo.dirstate.__class__ """ for c in self._repocallables: -c(ui, repo) +with tracing.log(b'finalreposetup: %s', pycompat.sysbytes(repr(c))): +c(ui, repo) def uisetup(self, call): """Decorated function will be executed during uisetup To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@42289: 3 new changesets
3 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/5265c7d47213 changeset: 42287:5265c7d47213 user:Martin von Zweigbergk date:Fri May 10 10:23:08 2019 -0700 summary: tests: demonstrate another failure with in-memory rebase and copies https://www.mercurial-scm.org/repo/hg/rev/cdcebc897529 changeset: 42288:cdcebc897529 user:Martin von Zweigbergk date:Fri May 10 11:03:54 2019 -0700 summary: overlaycontext: allow calling copydata() on clean context https://www.mercurial-scm.org/repo/hg/rev/83b225fbd788 changeset: 42289:83b225fbd788 bookmark:@ tag: tip user:Martin von Zweigbergk date:Fri May 10 10:23:46 2019 -0700 summary: tests: demonstrate loss of changeset copy metadata on rebase -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] log: flag topo-sorted set as such
On Wed, May 15, 2019 at 4:34 PM Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1557962120 -32400 > # Thu May 16 08:15:20 2019 +0900 > # Node ID 77eb2f52d411836a9f7cadd7b3c7d095945cadcc > # Parent 52c3d16d4c62567e4858ddc8c082443a1f7a2f78 > log: flag topo-sorted set as such > Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] log: flag topo-sorted set as such
# HG changeset patch # User Yuya Nishihara # Date 1557962120 -32400 # Thu May 16 08:15:20 2019 +0900 # Node ID 77eb2f52d411836a9f7cadd7b3c7d095945cadcc # Parent 52c3d16d4c62567e4858ddc8c082443a1f7a2f78 log: flag topo-sorted set as such This isn't required right now, but revs.istopo() should return True. diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -750,7 +750,7 @@ def getrevs(repo, pats, opts): if not revs.istopo(): revs = dagop.toposort(revs, repo.changelog.parentrevs) # TODO: try to iterate the set lazily -revs = revset.baseset(list(revs)) +revs = revset.baseset(list(revs), istopo=True) elif not (revs.isdescending() or revs.istopo()): revs.sort(reverse=True) if expr: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6380: copies: fix duplicatecopies() with overlay context
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The reasoning for this check is in https://phab.mercurial-scm.org/rHG78d760aa3607f13c8d24b9a6807aa998c4d61f0a (duplicatecopies: do not mark items not in the dirstate as copies, 2013-03-28). The check was then moved to workingfilectx in https://phab.mercurial-scm.org/rHG754b5117622f2a60c408fcd61fa6183ccb1c1e92 (context: add workingfilectx.markcopied, 2017-10-15) and no corresponding check was added later when overlayworkingfilectx was added. Rather than adding the check there, this patch adds a more generic check on the callers side and removes the check in workingfilectx.markcopied(). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6380 AFFECTED FILES mercurial/context.py mercurial/copies.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 @@ -795,12 +795,10 @@ $ hg co -q 0 $ echo a2 > a $ hg ci -qm 'modify a' -BROKEN: obviously... $ hg rebase -r . -d 1 --collapse rebasing 2:41c4ea50d4cf "modify a" (tip) merging b and a to b - abort: a@b977edf6f839: not found in manifest! - [255] + saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg $ cd .. Test rebasing when the file we are merging in destination is empty diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -798,4 +798,5 @@ for dst, src in pathcopies(repo[fromrev], repo[rev]).iteritems(): if dst in exclude: continue -wctx[dst].markcopied(src) +if dst in wctx: +wctx[dst].markcopied(src) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1773,8 +1773,7 @@ def markcopied(self, src): """marks this file a copy of `src`""" -if self._repo.dirstate[self._path] in "nma": -self._repo.dirstate.copy(src, self._path) +self._repo.dirstate.copy(src, self._path) def clearunknown(self): """Removes conflicting items in the working directory so that 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
D6379: tests: demonstrate crash when rebasing across copy with --collapse
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As reported by timeless. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6379 AFFECTED FILES tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -784,6 +784,25 @@ R a $ cd .. +Rebase across a copy with --collapse + + $ hg init rebase-rename-collapse + $ cd rebase-rename-collapse + $ echo a > a + $ hg ci -Aqm 'add a' + $ hg mv a b + $ hg ci -m 'rename a to b' + $ hg co -q 0 + $ echo a2 > a + $ hg ci -qm 'modify a' +BROKEN: obviously... + $ hg rebase -r . -d 1 --collapse + rebasing 2:41c4ea50d4cf "modify a" (tip) + merging b and a to b + abort: a@b977edf6f839: not found in manifest! + [255] + $ cd .. + Test rebasing when the file we are merging in destination is empty $ hg init test To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@42286: 18 new changesets
18 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/c8d55ff80da1 changeset: 42269:c8d55ff80da1 user:Augie Fackler date:Sat May 04 23:31:42 2019 -0400 summary: sslutil: add support for SSLKEYLOGFILE to wrapsocket https://www.mercurial-scm.org/repo/hg/rev/19b95afb0c01 changeset: 42270:19b95afb0c01 user:Matt Harbison date:Sat May 11 22:08:57 2019 -0400 summary: record: avoid modifying the matcher passed as a method parameter https://www.mercurial-scm.org/repo/hg/rev/0ed293a3f00e changeset: 42271:0ed293a3f00e user:Martin von Zweigbergk date:Wed May 01 20:54:27 2019 -0700 summary: releasenotes: add a file in which to record release notes https://www.mercurial-scm.org/repo/hg/rev/cbff7f996dc4 changeset: 42272:cbff7f996dc4 user:Martin von Zweigbergk date:Tue May 14 09:46:38 2019 -0700 summary: tests: avoid the word "dirty" to mean "not a descendant of merge base" https://www.mercurial-scm.org/repo/hg/rev/651f325e4fdd changeset: 42273:651f325e4fdd user:Martin von Zweigbergk date:Wed May 01 15:24:16 2019 -0700 summary: remotefilelog: move most functions in onetimeclientsetup() to top level https://www.mercurial-scm.org/repo/hg/rev/8a0e03f7baf4 changeset: 42274:8a0e03f7baf4 user:Martin von Zweigbergk date:Wed May 01 15:34:03 2019 -0700 summary: remotefilelog: move most setup from onetimesetup() to uisetup() https://www.mercurial-scm.org/repo/hg/rev/730edbd836d8 changeset: 42275:730edbd836d8 user:Gregory Szorc date:Fri Apr 19 05:07:44 2019 -0700 summary: automation: only iterate over our AMIs https://www.mercurial-scm.org/repo/hg/rev/fcb97cb91ff8 changeset: 42276:fcb97cb91ff8 user:Gregory Szorc date:Fri Apr 19 05:15:43 2019 -0700 summary: automation: detach policies before deleting role https://www.mercurial-scm.org/repo/hg/rev/dd6a9723ae2b changeset: 42277:dd6a9723ae2b user:Gregory Szorc date:Fri Apr 19 05:20:33 2019 -0700 summary: automation: don't create resources when deleting things https://www.mercurial-scm.org/repo/hg/rev/8dc22a209420 changeset: 42278:8dc22a209420 user:Gregory Szorc date:Sat Apr 27 11:38:58 2019 -0700 summary: automation: wait for instance profiles and roles https://www.mercurial-scm.org/repo/hg/rev/f30184484dd1 changeset: 42279:f30184484dd1 user:Gregory Szorc date:Fri Apr 19 06:07:00 2019 -0700 summary: automation: wait longer for WinRM connection https://www.mercurial-scm.org/repo/hg/rev/e570106beda1 changeset: 42280:e570106beda1 user:Gregory Szorc date:Fri Apr 19 07:34:55 2019 -0700 summary: automation: shore up rebooting behavior https://www.mercurial-scm.org/repo/hg/rev/4274b1369b75 changeset: 42281:4274b1369b75 user:Gregory Szorc date:Fri Apr 19 08:21:02 2019 -0700 summary: automation: add check that hg source directory is a repo https://www.mercurial-scm.org/repo/hg/rev/5c242c427897 changeset: 42282:5c242c427897 user:Gregory Szorc date:Fri Apr 19 08:32:24 2019 -0700 summary: automation: do a force push to synchronize https://www.mercurial-scm.org/repo/hg/rev/d137a3d5ad41 changeset: 42283:d137a3d5ad41 user:Gregory Szorc date:Fri Apr 19 09:18:23 2019 -0700 summary: automation: add --version argument to build-all-windows-packages https://www.mercurial-scm.org/repo/hg/rev/195dcc10b3d7 changeset: 42284:195dcc10b3d7 user:Gregory Szorc date:Tue Apr 23 21:57:32 2019 -0700 summary: automation: move image operations to own functions https://www.mercurial-scm.org/repo/hg/rev/65b3ef162b39 changeset: 42285:65b3ef162b39 user:Gregory Szorc date:Sat Apr 27 11:48:26 2019 -0700 summary: automation: initial support for running Linux tests https://www.mercurial-scm.org/repo/hg/rev/8988e640a8ac changeset: 42286:8988e640a8ac bookmark:@ tag: tip user:Martin von Zweigbergk date:Tue May 14 16:40:49 2019 -0700 summary: commit: fix a typo ("form p1" -> "from p1") -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Google Summer of Code '19: Add functionality to store an unresolved merge-state
On Wed, 15 May, 2019, 10:26 PM Pulkit Goyal, <7895pul...@gmail.com> wrote: > > > On Wed, May 15, 2019 at 7:53 PM Martin von Zweigbergk via Mercurial-devel < > mercurial-devel@mercurial-scm.org> wrote: > >> >> >> *From: *Navaneeth Suresh >> *Date: *Wed, May 15, 2019 at 5:13 AM >> *To: *Pierre-Yves David >> *Cc: *mercurial-devel >> >> On Tue, May 14, 2019 at 5:51 PM Pierre-Yves David < >>> pierre-yves.da...@ens-lyon.org> wrote: >>> On 5/12/19 8:31 PM, Navaneeth Suresh wrote: > Hello everyone, > > I am Navaneeth Suresh, one of the GSoC '19 students with Mercurial. I > wanted to discuss my project on adding functionality to store an > unresolved merge-state[1] > < https://www.mercurial-scm.org/wiki/SummerOfCode/Ideas2019#Add_functionality_to_store_an_unresolved_merge-state> with > the community. Having gone through past mailing list archives on similar > issues, I got some ideas on the implementation of the project. However, > there can be other alternatives and I might encounter some issues which > I might not aware of. So, I'm sharing my idea of implementation. > > As said by @marmoute, we are storing only one active unresolved > merge-state. Yes, the active merge state exists in .hg/merge/. It is used for the operation the triggered a merge (hg merge, hg rebase, etc) and will exist until the merge is concluded or aborted. As far as I understand your project, is to offer a third alternative: delaying the merge resolution until later. Right ? >>> >>> Yes. For example, if a user wants to fix an urgent bug without losing >>> their partly done enormous conflict resolution, this project will help them >>> to store the conflicts and resume the resolution after fixing the bug. In >>> the current scenario, they are only allowed to either fully discard or >>> complete the partly done resolution to perform a new commit. >>> >>> How do you see the final user experience? What is the workflow to delay and later conclude/abort a merge? (note: there are some UX details from you later in this email, but it probably worth being explained independently). >>> >>> From the UI point of view, it appeared to me as shelving with conflicts. >>> >> >> Good idea. >> >> >>> I thought of introducing two commands `hg store-conflicts` and `hg >>> restore-conflicts`. >>> >> >> Or even reuse `hg shelve` and `hg unshelve`? >> > > I agree. `hg shelve --unresolved`. > This project also involves publishing the conflict changesets so that other users can also help in the resolution. This will violate the default behaviour of shelve changesets if it comes under shelve. That's why I left that idea on shelve. > (I am still in-process of writing a reply to whole proposal) > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] rust: published the three extension crates to crates.io
> On Apr 16, 2019, at 17:12, Georges Racinet > wrote: > > Of course I'm all willing to give ownership on these crates to the > project, but that requires a GitHub Organization (only for > authentication). Reference: (ref: > https://doc.rust-lang.org/cargo/reference/publishing.html#cargo-owner). > I don't feel like I should be the one to create one out of the blue, but > I could and would invite the whole steering committee if I did. https://github.com/mercurial-scm is now a thing, and I've sent you an invitation. I ticked the box to require two-factor auth for all org members, hopefully that doesn't make life difficult. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6331: log: add config for making `hg log -G` always topo-sorted
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa39f8aa64cef: log: add config for making `hg log -G` always topo-sorted (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6331?vs=15076&id=15122 REVISION DETAIL https://phab.mercurial-scm.org/D6331 AFFECTED FILES mercurial/configitems.py mercurial/logcmdutil.py relnotes/next tests/test-glog-topological.t CHANGE DETAILS diff --git a/tests/test-glog-topological.t b/tests/test-glog-topological.t --- a/tests/test-glog-topological.t +++ b/tests/test-glog-topological.t @@ -114,3 +114,41 @@ |/ o 0 + +Topological sort can be turned on via config + + $ cat >> $HGRCPATH << EOF + > [experimental] + > log.topo=true + > EOF + + $ hg log -G + o 8 + | + o 3 + | + o 2 + | + o 1 + | + | o 7 + | | + | o 6 + | | + | o 5 + | | + | o 4 + |/ + o 0 + +Does not affect non-graph log + $ hg log -T '{rev}\n' + 8 + 7 + 6 + 5 + 4 + 3 + 2 + 1 + 0 diff --git a/relnotes/next b/relnotes/next --- a/relnotes/next +++ b/relnotes/next @@ -3,6 +3,16 @@ * New config `commands.commit.post-status` shows status after successful commit. + +== New Experimental Features == + + * New config `experimental.log.topo` makes `hg log -G` use + topological sorting. This is especially useful for aliases since it + lets the alias accept an `-r` option while still using topological + sorting with or without the `-r` (unlike if you use the `sort(..., + topo)` revset). + + == Bug Fixes == diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -746,7 +746,12 @@ if opts.get('graph'): # User-specified revs might be unsorted, but don't sort before # _makerevset because it might depend on the order of revs -if not (revs.isdescending() or revs.istopo()): +if repo.ui.configbool('experimental', 'log.topo'): +if not revs.istopo(): +revs = dagop.toposort(revs, repo.changelog.parentrevs) +# TODO: try to iterate the set lazily +revs = revset.baseset(list(revs)) +elif not (revs.isdescending() or revs.istopo()): revs.sort(reverse=True) if expr: matcher = revset.match(None, expr) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -529,6 +529,9 @@ coreconfigitem('experimental', 'evolution.bundle-obsmarker', default=False, ) +coreconfigitem('experimental', 'log.topo', +default=False, +) coreconfigitem('experimental', 'evolution.report-instabilities', default=True, ) To: martinvonz, #hg-reviewers, pulkit Cc: marmoute, yuja, mjpieters, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5112: graphmod: remove support for graph lines mixing parent/grandparent styles (BC)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2e97640c598e: graphmod: remove support for graph lines mixing parent/grandparent styles (BC) (authored by spectral, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5112?vs=12159&id=15120 REVISION DETAIL https://phab.mercurial-scm.org/D5112 AFFECTED FILES mercurial/graphmod.py tests/test-glog.t CHANGE DETAILS diff --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -3028,12 +3028,14 @@ date:Thu Jan 01 00:00:04 1970 + summary: (4) merge two known; one immediate left, one immediate right -Draw only part of a grandparent line differently with ""; only the -last N lines (for positive N) or everything but the first N lines (for -negative N) along the current node use the style, the rest of the edge uses -the parent edge styling. +Previously, one could specify graphstyle.grandparent = to draw +on only the last N lines (for positive N) or everything but the first N lines +(for negative N), with the rest of the edge using the parent edge styling. -Last 3 lines: +This was removed, and this test now shows that muliple characters being +specified in graphstyle.grandparent aren't treated specially (including in width +calculations; there's no specific reason to *avoid* handling the width +calculations, but it's difficult to do correctly and efficiently). $ cat << EOF >> $HGRCPATH > [experimental] @@ -3043,77 +3045,77 @@ > EOF $ hg log -G -r '36:18 & file("a")' -m @ changeset: 36:08a19a744424 - ! branch: branch - ! tag: tip - ! parent: 35:9159c3644c5e - ! parent: 35:9159c3644c5e - ! user:test - . date:Thu Jan 01 00:00:36 1970 + - . summary: (36) buggy merge: identical parents - . + 3. branch: branch + 3. tag: tip + 3. parent: 35:9159c3644c5e + 3. parent: 35:9159c3644c5e + 3. user:test + 3. date:Thu Jan 01 00:00:36 1970 + + 3. summary: (36) buggy merge: identical parents + 3. ochangeset: 32:d06dffa21a31 !\ parent: 27:886ed638191b - ! ! parent: 31:621d83e11f67 - ! ! user:test - ! . date:Thu Jan 01 00:00:32 1970 + - ! . summary: (32) expand - ! . - o ! changeset: 31:621d83e11f67 - !\! parent: 21:d42a756af44d - ! ! parent: 30:6e11cd4b648f - ! ! user:test - ! ! date:Thu Jan 01 00:00:31 1970 + - ! ! summary: (31) expand - ! ! - o !changeset: 30:6e11cd4b648f + ! 3. parent: 31:621d83e11f67 + ! 3. user:test + ! 3. date:Thu Jan 01 00:00:32 1970 + + ! 3. summary: (32) expand + ! 3. + o 3. changeset: 31:621d83e11f67 + !\3. parent: 21:d42a756af44d + ! 3. parent: 30:6e11cd4b648f + ! 3. user:test + ! 3. date:Thu Jan 01 00:00:31 1970 + + ! 3. summary: (31) expand + ! 3. + o 3. changeset: 30:6e11cd4b648f !\ \ parent: 28:44ecd0b9ae99 - ! ~ ! parent: 29:cd9bb2be7593 - ! ! user:test - ! ! date:Thu Jan 01 00:00:30 1970 + - ! ! summary: (30) expand + ! ~ 3. parent: 29:cd9bb2be7593 + ! 3. user:test + ! 3. date:Thu Jan 01 00:00:30 1970 + + ! 3. summary: (30) expand ! / - o !changeset: 28:44ecd0b9ae99 + o 3. changeset: 28:44ecd0b9ae99 !\ \ parent: 1:6db2ef61d156 - ! ~ ! parent: 26:7f25b6c2f0b9 - ! ! user:test - ! ! date:Thu Jan 01 00:00:28 1970 + - ! ! summary: (28) merge zero known + ! ~ 3. parent: 26:7f25b6c2f0b9 + ! 3. user:test + ! 3. date:Thu Jan 01 00:00:28 1970 + + ! 3. summary: (28) merge zero known ! / - o !changeset: 26:7f25b6c2f0b9 + o 3. changeset: 26:7f25b6c2f0b9 !\ \ parent: 18:1aa84d96232a - ! ! ! parent: 25:91da8ed57247 - ! ! ! user:test - ! ! ! date:Thu Jan 01 00:00:26 1970 + - ! ! ! summary: (26) merge one known; far right - ! ! ! - ! o ! changeset: 25:91da8ed57247 - ! !\! parent: 21:d42a756af44d - ! ! ! parent: 24:a9c19a3d96b7 - ! ! ! user:test - ! ! ! date:Thu Jan 01 00:00:25 1970 + - ! ! ! summary: (25) merge one known; far left - ! ! ! - ! o !changeset: 24:a9c19a3d96b7 + ! ! 3. parent: 25:91da8ed57247 + ! ! 3. user:test + ! ! 3. date:Thu Jan 01 00:00:26 1970 + + ! ! 3. summary: (26) merge one known; far right + ! ! 3. + ! o 3. changeset: 25:91da8ed57247 + ! !\3. parent: 21:d42a756af44d + ! ! 3. parent: 24:a9c19a3d96b7 + ! ! 3. user:test + ! ! 3. date:Thu Jan 01 00:00:25 1970 + + ! ! 3. summary: (25) merge one known; far left + !
D6372: log: remove an unnecessary "and opts.get('rev')" condition
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9bf6455741c4: log: remove an unnecessary "and opts.get('rev')" condition (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6372?vs=15069&id=15121 REVISION DETAIL https://phab.mercurial-scm.org/D6372 AFFECTED FILES mercurial/logcmdutil.py CHANGE DETAILS diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -743,7 +743,7 @@ return match expr = _makerevset(repo, match, pats, slowpath, opts) -if opts.get('graph') and opts.get('rev'): +if opts.get('graph'): # User-specified revs might be unsorted, but don't sort before # _makerevset because it might depend on the order of revs if not (revs.isdescending() or revs.istopo()): To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6261: rust-discovery: exposing sampling to python
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe7d3e56fa32e: rust-discovery: exposing sampling to python (authored by gracinet, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6261?vs=15023&id=15119 REVISION DETAIL https://phab.mercurial-scm.org/D6261 AFFECTED FILES rust/hg-cpython/src/discovery.rs CHANGE DETAILS diff --git a/rust/hg-cpython/src/discovery.rs b/rust/hg-cpython/src/discovery.rs --- a/rust/hg-cpython/src/discovery.rs +++ b/rust/hg-cpython/src/discovery.rs @@ -15,7 +15,8 @@ use crate::conversion::{py_set, rev_pyiter_collect}; use cindex::Index; use cpython::{ -ObjectProtocol, PyDict, PyModule, PyObject, PyResult, Python, ToPyObject, +ObjectProtocol, PyDict, PyModule, PyObject, PyResult, PyTuple, Python, +PythonObject, ToPyObject, }; use exceptions::GraphError; use hg::discovery::PartialDiscovery as CorePartialDiscovery; @@ -101,6 +102,32 @@ .map_err(|e| GraphError::pynew(py, e))? ) } + +def takefullsample(&self, _headrevs: PyObject, + size: usize) -> PyResult { +let mut inner = self.inner(py).borrow_mut(); +let sample = inner.take_full_sample(size) +.map_err(|e| GraphError::pynew(py, e))?; +let as_vec: Vec = sample +.iter() +.map(|rev| rev.to_py_object(py).into_object()) +.collect(); +Ok(PyTuple::new(py, as_vec.as_slice()).into_object()) +} + +def takequicksample(&self, headrevs: PyObject, +size: usize) -> PyResult { +let mut inner = self.inner(py).borrow_mut(); +let revsvec: Vec = rev_pyiter_collect(py, &headrevs)?; +let sample = inner.take_quick_sample(revsvec, size) +.map_err(|e| GraphError::pynew(py, e))?; +let as_vec: Vec = sample +.iter() +.map(|rev| rev.to_py_object(py).into_object()) +.collect(); +Ok(PyTuple::new(py, as_vec.as_slice()).into_object()) +} + }); /// Create the module, with __package__ given from parent To: gracinet, #hg-reviewers, kevincox Cc: durin42, kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6377: py3: add a r'' to prevent transformer adding b''
This revision was automatically updated to reflect the committed changes. Closed by commit rHGeefe3d669beb: py3: add a r'' to prevent transformer adding b'' (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6377?vs=15112&id=15117 REVISION DETAIL https://phab.mercurial-scm.org/D6377 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4680,7 +4680,7 @@ """ ret = repo.recover() if ret: -if opts['verify']: +if opts[r'verify']: return hg.verify(repo) else: msg = _("(verify step skipped, run `hg verify` to check your " 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
D6349: rust-dirstate: add rust-cpython bindings to the new parse/pack functions
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe240bec26626: rust-dirstate: add rust-cpython bindings to the new parse/pack functions (authored by Alphare, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6349?vs=15067&id=15115 REVISION DETAIL https://phab.mercurial-scm.org/D6349 AFFECTED FILES mercurial/cext/parsers.c rust/Cargo.lock rust/hg-core/src/lib.rs rust/hg-cpython/src/dirstate.rs rust/hg-cpython/src/lib.rs CHANGE DETAILS diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs --- a/rust/hg-cpython/src/lib.rs +++ b/rust/hg-cpython/src/lib.rs @@ -23,13 +23,15 @@ extern crate cpython; extern crate hg; extern crate libc; +extern crate python27_sys; pub mod ancestors; mod cindex; mod conversion; pub mod dagops; pub mod discovery; pub mod exceptions; +pub mod dirstate; py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| { m.add( @@ -42,6 +44,7 @@ m.add(py, "ancestor", ancestors::init_module(py, &dotted_name)?)?; m.add(py, "dagop", dagops::init_module(py, &dotted_name)?)?; m.add(py, "discovery", discovery::init_module(py, &dotted_name)?)?; +m.add(py, "dirstate", dirstate::init_module(py, &dotted_name)?)?; m.add(py, "GraphError", py.get_type::())?; Ok(()) }); diff --git a/rust/hg-cpython/src/dirstate.rs b/rust/hg-cpython/src/dirstate.rs new file mode 100644 --- /dev/null +++ b/rust/hg-cpython/src/dirstate.rs @@ -0,0 +1,227 @@ +// dirstate.rs +// +// Copyright 2019 Raphaël Gomès +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +//! Bindings for the `hg::dirstate` module provided by the +//! `hg-core` package. +//! +//! From Python, this will be seen as `mercurial.rustext.dirstate` + +use cpython::{ +exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyObject, PyResult, +PySequence, PyTuple, Python, ToPyObject, +}; +use hg::{ +pack_dirstate, parse_dirstate, CopyVecEntry, DirstateEntry, +DirstatePackError, DirstateParents, DirstateParseError, DirstateVec, +}; +use std::collections::HashMap; +use std::ffi::CStr; +#[cfg(feature = "python27")] +extern crate python27_sys as python_sys; +#[cfg(feature = "python3")] +extern crate python3_sys as python_sys; +use self::python_sys::PyCapsule_Import; +use libc::{c_char, c_int}; +use std::mem::transmute; + +/// C code uses a custom `dirstate_tuple` type, checks in multiple instances +/// for this type, and raises a Python `Exception` if the check does not pass. +/// Because this type differs only in name from the regular Python tuple, it +/// would be a good idea in the near future to remove it entirely to allow +/// for a pure Python tuple of the same effective structure to be used, +/// rendering this type and the capsule below useless. +type MakeDirstateTupleFn = extern "C" fn( +state: c_char, +mode: c_int, +size: c_int, +mtime: c_int, +) -> PyObject; + +/// This is largely a copy/paste from cindex.rs, pending the merge of a +/// `py_capsule_fn!` macro in the rust-cpython project: +/// https://github.com/dgrunwald/rust-cpython/pull/169 +fn decapsule_make_dirstate_tuple(py: Python) -> PyResult { +unsafe { +let caps_name = CStr::from_bytes_with_nul_unchecked( +b"mercurial.cext.parsers.make_dirstate_tuple_CAPI\0", +); +let from_caps = PyCapsule_Import(caps_name.as_ptr(), 0); +if from_caps.is_null() { +return Err(PyErr::fetch(py)); +} +Ok(transmute(from_caps)) +} +} + +fn parse_dirstate_wrapper( +py: Python, +dmap: PyDict, +copymap: PyDict, +st: PyBytes, +) -> PyResult { +match parse_dirstate(st.data(py)) { +Ok((parents, dirstate_vec, copies)) => { +for (filename, entry) in dirstate_vec { +dmap.set_item( +py, +PyBytes::new(py, &filename[..]), +decapsule_make_dirstate_tuple(py)?( +entry.state, +entry.mode, +entry.size, +entry.mtime, +), +)?; +} +for CopyVecEntry { path, copy_path } in copies { +copymap.set_item( +py, +PyBytes::new(py, path), +PyBytes::new(py, copy_path), +)?; +} +Ok((PyBytes::new(py, parents.p1), PyBytes::new(py, parents.p2)) +.to_py_object(py)) +} +Err(e) => Err(PyErr::new::( +py, +match e { +DirstateParseError::TooLittleData => { +"too little data for parents".to_string() +} +DirstateParseError::Overflow => { +"overflow in dirstate".t
D6378: py3: add 5 new passing tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG181583d30539: py3: add 5 new passing tests (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6378?vs=15113&id=15118 REVISION DETAIL https://phab.mercurial-scm.org/D6378 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -4,6 +4,7 @@ test-absorb-phase.t test-absorb-rename.t test-absorb-strip.t +test-absorb-unfinished.t test-absorb.t test-acl.t test-add.t @@ -126,6 +127,7 @@ test-convert-svn-sink.t test-convert-tagsbranch-topology.t test-convert.t +test-copies-in-changeset.t test-copies.t test-copy-move-merge.t test-copy.t @@ -139,6 +141,7 @@ test-debugrename.t test-default-push.t test-demandimport.py +test-devel-warnings.t test-diff-antipatience.t test-diff-binary-file.t test-diff-change.t @@ -597,6 +600,7 @@ test-releasenotes-merging.t test-releasenotes-parsing.t test-relink.t +test-remote-hidden.t test-remotefilelog-bad-configs.t test-remotefilelog-bgprefetch.t test-remotefilelog-blame.t @@ -658,6 +662,7 @@ test-run-tests.py test-run-tests.t test-rust-ancestor.py +test-rust-discovery.py test-schemes.t test-serve.t test-server-view.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6348: rust-dirstate: add rust implementation of `parse_dirstate` and `pack_dirstate`
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd1786c1d34fa: rust-dirstate: add rust implementation of `parse_dirstate` and `pack_dirstate` (authored by Alphare, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6348?vs=15066&id=15114 REVISION DETAIL https://phab.mercurial-scm.org/D6348 AFFECTED FILES rust/hg-core/Cargo.toml rust/hg-core/src/dirstate.rs rust/hg-core/src/lib.rs CHANGE DETAILS diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs --- a/rust/hg-core/src/lib.rs +++ b/rust/hg-core/src/lib.rs @@ -2,6 +2,9 @@ // // This software may be used and distributed according to the terms of the // GNU General Public License version 2 or any later version. +extern crate byteorder; +extern crate memchr; + mod ancestors; pub mod dagops; pub use ancestors::{AncestorsIterator, LazyAncestors, MissingAncestors}; @@ -40,3 +43,29 @@ ParentOutOfRange(Revision), WorkingDirectoryUnsupported, } + +#[derive(Clone, Debug, PartialEq)] +pub enum DirstateParseError { +TooLittleData, +Overflow, +CorruptedEntry(String), +} + +#[derive(Debug, PartialEq)] +pub enum DirstatePackError { +CorruptedEntry(String), +CorruptedParent, +BadSize(usize, usize), +} + +impl From for DirstatePackError { +fn from(e: std::io::Error) -> Self { +DirstatePackError::CorruptedEntry(e.to_string()) +} +} + +impl From for DirstateParseError { +fn from(e: std::io::Error) -> Self { +DirstateParseError::CorruptedEntry(e.to_string()) +} +} diff --git a/rust/hg-core/src/dirstate.rs b/rust/hg-core/src/dirstate.rs new file mode 100644 --- /dev/null +++ b/rust/hg-core/src/dirstate.rs @@ -0,0 +1,409 @@ +// Copyright 2019 Raphaël Gomès +// +// This software may be used and distributed according to the terms of the +// GNU General Public License version 2 or any later version. + +use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; +use std::collections::HashMap; +use std::io::Cursor; +use {DirstatePackError, DirstateParseError}; + +#[derive(Debug, PartialEq, Copy, Clone)] +pub struct DirstateParents<'a> { +pub p1: &'a [u8], +pub p2: &'a [u8], +} +/// The C implementation uses all signed types. This will be an issue +/// either when 4GB+ source files are commonplace or in 2038, whichever +/// comes first. +#[derive(Debug, PartialEq)] +pub struct DirstateEntry { +pub state: i8, +pub mode: i32, +pub mtime: i32, +pub size: i32, +} +pub type DirstateVec = Vec<(Vec, DirstateEntry)>; + +#[derive(Debug, PartialEq)] +pub struct CopyVecEntry<'a> { +pub path: &'a [u8], +pub copy_path: &'a [u8], +} +pub type CopyVec<'a> = Vec>; + +/// Parents are stored in the dirstate as byte hashes. +const PARENT_SIZE: usize = 20; +/// Dirstate entries have a static part of 8 + 32 + 32 + 32 + 32 bits. +const MIN_ENTRY_SIZE: usize = 17; + +pub fn parse_dirstate( +contents: &[u8], +) -> Result<(DirstateParents, DirstateVec, CopyVec), DirstateParseError> { +if contents.len() < PARENT_SIZE * 2 { +return Err(DirstateParseError::TooLittleData); +} + +let mut dirstate_vec = vec![]; +let mut copies = vec![]; +let mut curr_pos = PARENT_SIZE * 2; +let parents = DirstateParents { +p1: &contents[..PARENT_SIZE], +p2: &contents[PARENT_SIZE..curr_pos], +}; + +while curr_pos < contents.len() { +if curr_pos + MIN_ENTRY_SIZE > contents.len() { +return Err(DirstateParseError::Overflow); +} +let entry_bytes = &contents[curr_pos..]; + +let mut cursor = Cursor::new(entry_bytes); +let state = cursor.read_i8()?; +let mode = cursor.read_i32::()?; +let size = cursor.read_i32::()?; +let mtime = cursor.read_i32::()?; +let path_len = cursor.read_i32::()? as usize; + +if path_len > contents.len() - curr_pos { +return Err(DirstateParseError::Overflow); +} + +// Slice instead of allocating a Vec needed for `read_exact` +let path = &entry_bytes[MIN_ENTRY_SIZE..MIN_ENTRY_SIZE + (path_len)]; + +let (path, copy) = match memchr::memchr(0, path) { +None => (path, None), +Some(i) => (&path[..i], Some(&path[(i + 1)..])), +}; + +if let Some(copy_path) = copy { +copies.push(CopyVecEntry { path, copy_path }); +}; +dirstate_vec.push(( +path.to_owned(), +DirstateEntry { +state, +mode, +size, +mtime, +}, +)); +curr_pos = curr_pos + MIN_ENTRY_SIZE + (path_len); +} + +Ok((parents, dirstate_vec, copies)) +} + +pub fn pack_dirstate( +dirstate_vec: &DirstateVec, +copymap: &HashMap, Vec>, +parents: DirstateParents, +now: i32, +) -> Result<(Vec, DirstateVec), DirstatePackError> { +if parents.p1.len() != PAREN
D6350: rust-dirstate: call parse/pack bindings from Python
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9c6c0f736e1d: rust-dirstate: call parse/pack bindings from Python (authored by Alphare, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6350?vs=15033&id=15116 REVISION DETAIL https://phab.mercurial-scm.org/D6350 AFFECTED FILES mercurial/dirstate.py tests/fakedirstatewritetime.py CHANGE DETAILS diff --git a/tests/fakedirstatewritetime.py b/tests/fakedirstatewritetime.py --- a/tests/fakedirstatewritetime.py +++ b/tests/fakedirstatewritetime.py @@ -16,6 +16,12 @@ ) from mercurial.utils import dateutil +try: +from mercurial import rustext +rustext.__name__ # force actual import (see hgdemandimport) +except ImportError: +rustext = None + configtable = {} configitem = registrar.configitem(configtable) @@ -51,16 +57,22 @@ # 'fakenow' value and 'touch -t mmddHHMM' argument easy fakenow = dateutil.parsedate(fakenow, [b'%Y%m%d%H%M'])[0] -orig_pack_dirstate = parsers.pack_dirstate +if rustext is not None: +orig_module = rustext.dirstate +orig_pack_dirstate = rustext.dirstate.pack_dirstate +else: +orig_module = parsers +orig_pack_dirstate = parsers.pack_dirstate + orig_dirstate_getfsnow = dirstate._getfsnow wrapper = lambda *args: pack_dirstate(fakenow, orig_pack_dirstate, *args) -parsers.pack_dirstate = wrapper +orig_module.pack_dirstate = wrapper dirstate._getfsnow = lambda *args: fakenow try: return func() finally: -parsers.pack_dirstate = orig_pack_dirstate +orig_module.pack_dirstate = orig_pack_dirstate dirstate._getfsnow = orig_dirstate_getfsnow def _poststatusfixup(orig, workingctx, status, fixup): diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -27,6 +27,12 @@ util, ) +try: +from . import rustext +rustext.__name__ # force actual import (see hgdemandimport) +except ImportError: +rustext = None + parsers = policy.importmod(r'parsers') propertycache = util.propertycache @@ -1465,7 +1471,12 @@ # parsing the dirstate. # # (we cannot decorate the function directly since it is in a C module) -parse_dirstate = util.nogc(parsers.parse_dirstate) +if rustext is not None: +parse_dirstate = rustext.dirstate.parse_dirstate +else: +parse_dirstate = parsers.parse_dirstate + +parse_dirstate = util.nogc(parse_dirstate) p = parse_dirstate(self._map, self.copymap, st) if not self._dirtyparents: self.setparents(*p) @@ -1476,7 +1487,12 @@ self.get = self._map.get def write(self, st, now): -st.write(parsers.pack_dirstate(self._map, self.copymap, +if rustext is not None: +pack_dirstate = rustext.dirstate.pack_dirstate +else: +pack_dirstate = parsers.pack_dirstate + +st.write(pack_dirstate(self._map, self.copymap, self.parents(), now)) st.close() self._dirtyparents = False To: Alphare, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6271: rust-filepatterns: add a Rust implementation of pattern-related utils
durin42 requested changes to this revision. durin42 added a comment. This revision now requires changes to proceed. (forgot to tag as needing changes) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6271 To: Alphare, #hg-reviewers, kevincox, durin42 Cc: durin42, kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6273: rust-filepatterns: call new Rust implementations from Python
durin42 accepted this revision. durin42 added a comment. This revision is now accepted and ready to land. Are there any performance implications of this yet? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6273 To: Alphare, #hg-reviewers, durin42 Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6271: rust-filepatterns: add a Rust implementation of pattern-related utils
durin42 accepted this revision. durin42 added a comment. This revision is now accepted and ready to land. Meta-comment: we should extract an hgignore crate (with minimal other deps) and publish that, because that'd be a step towards automatic hgignore support in ripgrep (burntsushi has previously indicated that if there was a maintained hgignore crate that it'd be a doable feature). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6271 To: Alphare, #hg-reviewers, kevincox, durin42 Cc: durin42, kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6271: rust-filepatterns: add a Rust implementation of pattern-related utils
durin42 added a comment. Ugh, but I got conflicts in Cargo.lock - could you rebase and let me know when you're ready? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6271 To: Alphare, #hg-reviewers, kevincox, durin42 Cc: durin42, kevincox, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5299: phabricator: fallback reading arcanist config files
durin42 requested changes to this revision. durin42 added a comment. This revision now requires changes to proceed. I see at least one outstanding comment that points out a typo. I'm generally in favor of this though, so please let us know when it's time to take another look. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5299 To: philpep, #hg-reviewers, durin42 Cc: durin42, Kwan, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6377: py3: add a r'' to prevent transformer adding b''
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just r'' prefix REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6377 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4680,7 +4680,7 @@ """ ret = repo.recover() if ret: -if opts['verify']: +if opts[r'verify']: return hg.verify(repo) else: msg = _("(verify step skipped, run `hg verify` to check your " 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
D6378: py3: add 5 new passing tests
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/D6378 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -4,6 +4,7 @@ test-absorb-phase.t test-absorb-rename.t test-absorb-strip.t +test-absorb-unfinished.t test-absorb.t test-acl.t test-add.t @@ -126,6 +127,7 @@ test-convert-svn-sink.t test-convert-tagsbranch-topology.t test-convert.t +test-copies-in-changeset.t test-copies.t test-copy-move-merge.t test-copy.t @@ -139,6 +141,7 @@ test-debugrename.t test-default-push.t test-demandimport.py +test-devel-warnings.t test-diff-antipatience.t test-diff-binary-file.t test-diff-change.t @@ -597,6 +600,7 @@ test-releasenotes-merging.t test-releasenotes-parsing.t test-relink.t +test-remote-hidden.t test-remotefilelog-bad-configs.t test-remotefilelog-bgprefetch.t test-remotefilelog-blame.t @@ -658,6 +662,7 @@ test-run-tests.py test-run-tests.t test-rust-ancestor.py +test-rust-discovery.py test-schemes.t test-serve.t test-server-view.t To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6306: copies: write empty entries in changeset when also writing to filelog
This revision was automatically updated to reflect the committed changes. Closed by commit rHG278dcb24e535: copies: write empty entries in changeset when also writing to filelog (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6306?vs=15083&id=15110 REVISION DETAIL https://phab.mercurial-scm.org/D6306 AFFECTED FILES mercurial/changelog.py mercurial/localrepo.py tests/test-copies-in-changeset.t CHANGE DETAILS diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t --- a/tests/test-copies-in-changeset.t +++ b/tests/test-copies-in-changeset.t @@ -103,6 +103,7 @@ $ hg changesetcopies files: j p1copies: j\x00a (esc) + p2copies: $ hg debugdata j 0 \x01 (esc) copy: a @@ -115,6 +116,14 @@ a -> j $ hg showcopies --config experimental.copies.read-from=filelog-only a -> j +The entries should be written to extras even if they're empty (so the client +won't have to fall back to reading from filelogs) + $ echo x >> j + $ hg ci -m 'modify j' --config experimental.copies.write-to=compatibility + $ hg changesetcopies + files: j + p1copies: + p2copies: Test writing only to filelog diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2650,6 +2650,14 @@ mn = p1.manifestnode() files = [] +if writecopiesto == 'changeset-only': +# If writing only to changeset extras, use None to indicate that +# no entry should be written. If writing to both, write an empty +# entry to prevent the reader from falling back to reading +# filelogs. +p1copies = p1copies or None +p2copies = p2copies or None + # update changelog self.ui.note(_("committing changelog\n")) self.changelog.delayupdate(tr) diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -591,11 +591,11 @@ elif branch in (".", "null", "tip"): raise error.StorageError(_('the name \'%s\' is reserved') % branch) -if (p1copies or p2copies) and extra is None: +if (p1copies is not None or p2copies is not None) and extra is None: extra = {} -if p1copies: +if p1copies is not None: extra['p1copies'] = encodecopies(p1copies) -if p2copies: +if p2copies is not None: extra['p2copies'] = encodecopies(p2copies) if extra: To: martinvonz, #hg-reviewers, indygreg, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6365: context: move contents of committablectx.markcommitted() to workingctx
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfdd4d668ceb5: context: move contents of committablectx.markcommitted() to workingctx (authored by martinvonz, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6365?vs=15059&id=15107#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6365?vs=15059&id=15107 REVISION DETAIL https://phab.mercurial-scm.org/D6365 AFFECTED FILES mercurial/context.py tests/fakedirstatewritetime.py tests/test-close-head.t CHANGE DETAILS diff --git a/tests/test-close-head.t b/tests/test-close-head.t --- a/tests/test-close-head.t +++ b/tests/test-close-head.t @@ -37,7 +37,7 @@ $ hg --config extensions.closehead= close-head -m 'Close old heads' -r 1 2 $ hg id - 340d36cac2f4 tip + $ hg bookmark @ 1:66f7d451a68b $ hg heads diff --git a/tests/fakedirstatewritetime.py b/tests/fakedirstatewritetime.py --- a/tests/fakedirstatewritetime.py +++ b/tests/fakedirstatewritetime.py @@ -74,5 +74,5 @@ def extsetup(ui): extensions.wrapfunction(context.workingctx, '_poststatusfixup', _poststatusfixup) -extensions.wrapfunction(context.committablectx, 'markcommitted', +extensions.wrapfunction(context.workingctx, 'markcommitted', markcommitted) diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1226,18 +1226,6 @@ """ -with self._repo.dirstate.parentchange(): -for f in self.modified() + self.added(): -self._repo.dirstate.normal(f) -for f in self.removed(): -self._repo.dirstate.drop(f) -self._repo.dirstate.setparents(node) - -# write changes out explicitly, because nesting wlock at -# runtime may prevent 'wlock.release()' in 'repo.commit()' -# from immediately doing so for subsequent changing files -self._repo.dirstate.write(self._repo.currenttransaction()) - def dirty(self, missing=False, merge=True, branch=True): return False @@ -1657,7 +1645,17 @@ return sorted(f for f in ds.matches(match) if ds[f] != 'r') def markcommitted(self, node): -super(workingctx, self).markcommitted(node) +with self._repo.dirstate.parentchange(): +for f in self.modified() + self.added(): +self._repo.dirstate.normal(f) +for f in self.removed(): +self._repo.dirstate.drop(f) +self._repo.dirstate.setparents(node) + +# write changes out explicitly, because nesting wlock at +# runtime may prevent 'wlock.release()' in 'repo.commit()' +# from immediately doing so for subsequent changing files +self._repo.dirstate.write(self._repo.currenttransaction()) sparse.aftercommit(self._repo, node) To: martinvonz, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6376: changelog: define changelogrevision.p[12]copies for null revision
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2a7109cc5a28: changelog: define changelogrevision.p[12]copies for null revision (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6376?vs=15086&id=15111 REVISION DETAIL https://phab.mercurial-scm.org/D6376 AFFECTED FILES mercurial/changelog.py CHANGE DETAILS diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -194,6 +194,8 @@ user = attr.ib(default='') date = attr.ib(default=(0, 0)) files = attr.ib(default=attr.Factory(list)) +p1copies = attr.ib(default=None) +p2copies = attr.ib(default=None) description = attr.ib(default='') class changelogrevision(object): 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
D6374: context: default to using branch from dirstate only in workingctx
This revision was automatically updated to reflect the committed changes. Closed by commit rHG62bb49a1d05d: context: default to using branch from dirstate only in workingctx (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6374?vs=15084&id=15109 REVISION DETAIL https://phab.mercurial-scm.org/D6374 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1119,13 +1119,7 @@ self._extra = extra.copy() if branch is not None: self._extra['branch'] = encoding.fromlocal(branch) -elif 'branch' not in self._extra: -try: -branch = encoding.fromlocal(self._repo.dirstate.branch()) -except UnicodeDecodeError: -raise error.Abort(_('branch name not in UTF-8!')) -self._extra['branch'] = branch -if self._extra['branch'] == '': +if not self._extra.get('branch'): self._extra['branch'] = 'default' def __bytes__(self): @@ -1242,7 +1236,14 @@ """ def __init__(self, repo, text="", user=None, date=None, extra=None, changes=None): -super(workingctx, self).__init__(repo, text, user, date, extra, changes) +branch = None +if not extra or 'branch' not in extra: +try: +branch = repo.dirstate.branch() +except UnicodeDecodeError: +raise error.Abort(_('branch name not in UTF-8!')) +super(workingctx, self).__init__(repo, text, user, date, extra, changes, + branch=branch) def __iter__(self): d = self._repo.dirstate 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
D6366: context: let caller pass in branch to committablectx.__init__()
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdf2f22befdc8: context: let caller pass in branch to committablectx.__init__() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6366?vs=15060&id=15108 REVISION DETAIL https://phab.mercurial-scm.org/D6366 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1102,7 +1102,7 @@ """A committablectx object provides common functionality for a context that wants the ability to commit, e.g. workingctx or memctx.""" def __init__(self, repo, text="", user=None, date=None, extra=None, - changes=None): + changes=None, branch=None): super(committablectx, self).__init__(repo) self._rev = None self._node = None @@ -1117,7 +1117,9 @@ self._extra = {} if extra: self._extra = extra.copy() -if 'branch' not in self._extra: +if branch is not None: +self._extra['branch'] = encoding.fromlocal(branch) +elif 'branch' not in self._extra: try: branch = encoding.fromlocal(self._repo.dirstate.branch()) except UnicodeDecodeError: @@ -2308,16 +2310,15 @@ def __init__(self, repo, parents, text, files, filectxfn, user=None, date=None, extra=None, branch=None, editor=False): -super(memctx, self).__init__(repo, text, user, date, extra) +super(memctx, self).__init__(repo, text, user, date, extra, + branch=branch) self._rev = None self._node = None parents = [(p or nullid) for p in parents] p1, p2 = parents self._parents = [self._repo[p] for p in (p1, p2)] files = sorted(set(files)) self._files = files -if branch is not None: -self._extra['branch'] = encoding.fromlocal(branch) self.substate = {} if isinstance(filectxfn, patch.filestore): 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
D6363: context: move walk() and match() overrides from committablectx to workingctx
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4fbfc893e6b9: context: move walk() and match() overrides from committablectx to workingctx (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6363?vs=15057&id=15105 REVISION DETAIL https://phab.mercurial-scm.org/D6363 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1209,17 +1209,6 @@ """return the "best" ancestor context of self and c2""" return self._parents[0].ancestor(c2) # punt on two parents for now -def walk(self, match): -'''Generates matching file names.''' -return sorted(self._repo.dirstate.walk(self._repo.narrowmatch(match), - subrepos=sorted(self.substate), - unknown=True, ignored=False)) - -def matches(self, match): -match = self._repo.narrowmatch(match) -ds = self._repo.dirstate -return sorted(f for f in ds.matches(match) if ds[f] != 'r') - def ancestors(self): for p in self._parents: yield p @@ -1656,6 +1645,17 @@ match.bad = bad return match +def walk(self, match): +'''Generates matching file names.''' +return sorted(self._repo.dirstate.walk(self._repo.narrowmatch(match), + subrepos=sorted(self.substate), + unknown=True, ignored=False)) + +def matches(self, match): +match = self._repo.narrowmatch(match) +ds = self._repo.dirstate +return sorted(f for f in ds.matches(match) if ds[f] != 'r') + def markcommitted(self, node): super(workingctx, self).markcommitted(node) 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
D6362: context: move flags overrides from committablectx to workingctx
This revision was automatically updated to reflect the committed changes. Closed by commit rHG491855ea9d62: context: move flags overrides from committablectx to workingctx (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6362?vs=15056&id=15104 REVISION DETAIL https://phab.mercurial-scm.org/D6362 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1136,42 +1136,6 @@ __bool__ = __nonzero__ -def _buildflagfunc(self): -# Create a fallback function for getting file flags when the -# filesystem doesn't support them - -copiesget = self._repo.dirstate.copies().get -parents = self.parents() -if len(parents) < 2: -# when we have one parent, it's easy: copy from parent -man = parents[0].manifest() -def func(f): -f = copiesget(f, f) -return man.flags(f) -else: -# merges are tricky: we try to reconstruct the unstored -# result from the merge (issue1802) -p1, p2 = parents -pa = p1.ancestor(p2) -m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() - -def func(f): -f = copiesget(f, f) # may be wrong for merges with copies -fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) -if fl1 == fl2: -return fl1 -if fl1 == fla: -return fl2 -if fl2 == fla: -return fl1 -return '' # punt for conflicts - -return func - -@propertycache -def _flagfunc(self): -return self._repo.dirstate.flagfunc(self._buildflagfunc) - @propertycache def _status(self): return self._repo.status() @@ -1241,18 +1205,6 @@ def children(self): return [] -def flags(self, path): -if r'_manifest' in self.__dict__: -try: -return self._manifest.flags(path) -except KeyError: -return '' - -try: -return self._flagfunc(path) -except OSError: -return '' - def ancestor(self, c2): """return the "best" ancestor context of self and c2""" return self._parents[0].ancestor(c2) # punt on two parents for now @@ -1339,6 +1291,54 @@ self._manifest return super(workingctx, self)._fileinfo(path) +def _buildflagfunc(self): +# Create a fallback function for getting file flags when the +# filesystem doesn't support them + +copiesget = self._repo.dirstate.copies().get +parents = self.parents() +if len(parents) < 2: +# when we have one parent, it's easy: copy from parent +man = parents[0].manifest() +def func(f): +f = copiesget(f, f) +return man.flags(f) +else: +# merges are tricky: we try to reconstruct the unstored +# result from the merge (issue1802) +p1, p2 = parents +pa = p1.ancestor(p2) +m1, m2, ma = p1.manifest(), p2.manifest(), pa.manifest() + +def func(f): +f = copiesget(f, f) # may be wrong for merges with copies +fl1, fl2, fla = m1.flags(f), m2.flags(f), ma.flags(f) +if fl1 == fl2: +return fl1 +if fl1 == fla: +return fl2 +if fl2 == fla: +return fl1 +return '' # punt for conflicts + +return func + +@propertycache +def _flagfunc(self): +return self._repo.dirstate.flagfunc(self._buildflagfunc) + +def flags(self, path): +if r'_manifest' in self.__dict__: +try: +return self._manifest.flags(path) +except KeyError: +return '' + +try: +return self._flagfunc(path) +except OSError: +return '' + def filectx(self, path, filelog=None): """get a file context from the working directory""" return workingfilectx(self._repo, path, workingctx=self, To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6364: tests: demonstrate that close-head command updates working copy
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc51b103220c7: tests: demonstrate that close-head command updates working copy (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6364?vs=15058&id=15106 REVISION DETAIL https://phab.mercurial-scm.org/D6364 AFFECTED FILES tests/test-close-head.t CHANGE DETAILS diff --git a/tests/test-close-head.t b/tests/test-close-head.t --- a/tests/test-close-head.t +++ b/tests/test-close-head.t @@ -33,7 +33,11 @@ $ hg --config extensions.closehead= close-head -m 'Not a head' -r 0 1 abort: revision is not an open head: 0 [255] + $ hg id + $ hg --config extensions.closehead= close-head -m 'Close old heads' -r 1 2 + $ hg id + 340d36cac2f4 tip $ hg bookmark @ 1:66f7d451a68b $ hg heads 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
D6219: context: reuse changectx._copies() in all but workingctx
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa13b30555ffb: context: reuse changectx._copies() in all but workingctx (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6219?vs=15055&id=15103 REVISION DETAIL https://phab.mercurial-scm.org/D6219 AFFECTED FILES mercurial/context.py tests/test-copies-in-changeset.t CHANGE DETAILS diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t --- a/tests/test-copies-in-changeset.t +++ b/tests/test-copies-in-changeset.t @@ -151,8 +151,8 @@ rebasing 2:55d0b405c1b2 "rename a to b" (tip) merging a and b to b saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/55d0b405c1b2-78df867e-rebase.hg -BROKEN: should show the rename $ hg st --change . --copies A b +a R a $ cd .. diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -272,6 +272,30 @@ except error.LookupError: return '' +@propertycache +def _copies(self): +p1copies = {} +p2copies = {} +p1 = self.p1() +p2 = self.p2() +narrowmatch = self._repo.narrowmatch() +for dst in self.files(): +if not narrowmatch(dst) or dst not in self: +continue +copied = self[dst].renamed() +if not copied: +continue +src, srcnode = copied +if src in p1 and p1[src].filenode() == srcnode: +p1copies[dst] = src +elif src in p2 and p2[src].filenode() == srcnode: +p2copies[dst] = src +return p1copies, p2copies +def p1copies(self): +return self._copies[0] +def p2copies(self): +return self._copies[1] + def sub(self, path, allowcreate=True): '''return a subrepo for the stored revision of path, never wdir()''' return subrepo.subrepo(self, path, allowcreate=allowcreate) @@ -456,27 +480,7 @@ # Otherwise (config said to read only from filelog, or we are in # compatiblity mode and there is not data in the changeset), we get # the copy metadata from the filelogs. -p1copies = {} -p2copies = {} -p1 = self.p1() -p2 = self.p2() -narrowmatch = self._repo.narrowmatch() -for dst in self.files(): -if not narrowmatch(dst) or dst not in self: -continue -copied = self[dst].renamed() -if not copied: -continue -src, srcnode = copied -if src in p1 and p1[src].filenode() == srcnode: -p1copies[dst] = src -elif src in p2 and p2[src].filenode() == srcnode: -p2copies[dst] = src -return p1copies, p2copies -def p1copies(self): -return self._copies[0] -def p2copies(self): -return self._copies[1] +return super(changectx, self)._copies def description(self): return self._changeset.description def branch(self): @@ -1206,26 +1210,6 @@ return self._status.removed def deleted(self): return self._status.deleted -@propertycache -def _copies(self): -p1copies = {} -p2copies = {} -parents = self._repo.dirstate.parents() -p1manifest = self._repo[parents[0]].manifest() -p2manifest = self._repo[parents[1]].manifest() -narrowmatch = self._repo.narrowmatch() -for dst, src in self._repo.dirstate.copies().items(): -if not narrowmatch(dst): -continue -if src in p1manifest: -p1copies[dst] = src -elif src in p2manifest: -p2copies[dst] = src -return p1copies, p2copies -def p1copies(self): -return self._copies[0] -def p2copies(self): -return self._copies[1] def branch(self): return encoding.tolocal(self._extra['branch']) def closesbranch(self): @@ -1579,6 +1563,27 @@ return s @propertycache +def _copies(self): +p1copies = {} +p2copies = {} +parents = self._repo.dirstate.parents() +p1manifest = self._repo[parents[0]].manifest() +p2manifest = self._repo[parents[1]].manifest() +narrowmatch = self._repo.narrowmatch() +for dst, src in self._repo.dirstate.copies().items(): +if not narrowmatch(dst): +continue +if src in p1manifest: +p1copies[dst] = src +elif src in p2manifest: +p2copies[dst] = src +return p1copies, p2copies +def p1copies(self): +return self._copies[0] +def p2copies(self): +return self._copies[1] + +@propertycache def _manifest(self): """generate a manifest corresponding to the values
D6361: overlayworkingctx: don't include added-then-deleted files in memctx
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe79aeb518aa1: overlayworkingctx: don't include added-then-deleted files in memctx (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6361?vs=15054&id=15102 REVISION DETAIL https://phab.mercurial-scm.org/D6361 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2055,7 +2055,7 @@ else: parents = (self._repo[parents[0]], self._repo[parents[1]]) -files = self._cache.keys() +files = self.files() def getfile(repo, memctx, path): if self._cache[path]['exists']: return memfilectx(repo, memctx, path, 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
D6358: overlaycontext: allow calling copydata() on clean context
This revision was automatically updated to reflect the committed changes. Closed by commit rHGcdcebc897529: overlaycontext: allow calling copydata() on clean context (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6358?vs=15051&id=15100 REVISION DETAIL https://phab.mercurial-scm.org/D6358 AFFECTED FILES mercurial/context.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 @@ -774,8 +774,14 @@ $ hg co -q 0 $ hg mv a b $ hg ci -qm 'rename a to b' - $ hg rebase -d 1 2>&1 | grep '** ProgrammingError' - ** ProgrammingError: copydata() called on clean context + $ hg rebase -d 1 + rebasing 2:b977edf6f839 "rename a to b" (tip) + merging a and b to b + saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg + $ hg st --copies --change . + A b +a + R a $ cd .. Test rebasing when the file we are merging in destination is empty diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1913,7 +1913,7 @@ if self.isdirty(path): return self._cache[path]['copied'] else: -raise error.ProgrammingError('copydata() called on clean context') +return None def flags(self, path): if self.isdirty(path): 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
D6360: tests: demonstrate loss of changeset copy metadata on rebase
This revision was automatically updated to reflect the committed changes. Closed by commit rHG83b225fbd788: tests: demonstrate loss of changeset copy metadata on rebase (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6360?vs=15053&id=15101 REVISION DETAIL https://phab.mercurial-scm.org/D6360 AFFECTED FILES tests/test-copies-in-changeset.t CHANGE DETAILS diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t --- a/tests/test-copies-in-changeset.t +++ b/tests/test-copies-in-changeset.t @@ -7,6 +7,8 @@ > changesetcopies = log -r . -T 'files: {files} > {extras % "{ifcontains("copies", key, "{key}: {value}\n")}"}' > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}' + > [extensions] + > rebase = > EOF Check that copies are recorded correctly @@ -133,3 +135,24 @@ a -> k $ cd .. + +Test rebasing a commit with copy information + + $ hg init rebase-rename + $ cd rebase-rename + $ echo a > a + $ hg ci -Aqm 'add a' + $ echo a2 > a + $ hg ci -m 'modify a' + $ hg co -q 0 + $ hg mv a b + $ hg ci -qm 'rename a to b' + $ hg rebase -d 1 --config rebase.experimental.inmemory=yes + rebasing 2:55d0b405c1b2 "rename a to b" (tip) + merging a and b to b + saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/55d0b405c1b2-78df867e-rebase.hg +BROKEN: should show the rename + $ hg st --change . --copies + A b + R a + $ cd .. 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
D6357: tests: demonstrate another failure with in-memory rebase and copies
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5265c7d47213: tests: demonstrate another failure with in-memory rebase and copies (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6357?vs=15050&id=15099 REVISION DETAIL https://phab.mercurial-scm.org/D6357 AFFECTED FILES tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -763,6 +763,21 @@ $ cd .. +Test rebasing a commit with copy information + + $ hg init rebase-rename + $ cd rebase-rename + $ echo a > a + $ hg ci -Aqm 'add a' + $ echo a2 > a + $ hg ci -m 'modify a' + $ hg co -q 0 + $ hg mv a b + $ hg ci -qm 'rename a to b' + $ hg rebase -d 1 2>&1 | grep '** ProgrammingError' + ** ProgrammingError: copydata() called on clean context + $ cd .. + Test rebasing when the file we are merging in destination is empty $ hg init test 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
D6365: context: move contents of committablectx.markcommitted() to workingctx
durin42 added inline comments. INLINE COMMENTS > context.py:1228 > """ > - > -with self._repo.dirstate.parentchange(): > -for f in self.modified() + self.added(): > -self._repo.dirstate.normal(f) > -for f in self.removed(): > -self._repo.dirstate.drop(f) > -self._repo.dirstate.setparents(node) > - > -# write changes out explicitly, because nesting wlock at > -# runtime may prevent 'wlock.release()' in 'repo.commit()' > -# from immediately doing so for subsequent changing files > -self._repo.dirstate.write(self._repo.currenttransaction()) > +pass > Nit: this pass isn't needed. I'll fix in flight. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6365 To: martinvonz, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6375: commit: fix a typo ("form p1" -> "from p1")
martinvonz added a comment. In https://phab.mercurial-scm.org/D6375#92739, @pulkit wrote: > Amending the following diff in flight: > > diff --git a/tests/test-graft.t b/tests/test-graft.t > --- a/tests/test-graft.t > +++ b/tests/test-graft.t > @@ -755,7 +755,7 @@ Transplants of grafts can find a destina > committing files: > b > warning: can't find ancestor for 'b' copied from 'a'! > - reusing manifest form p1 (listed files actually unchanged) > + reusing manifest from p1 (listed files actually unchanged) > committing changelog > updating the branch cache > $ hg log -r 'destination(13)' > Thanks! (and sorry I didn't notice that) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6375 To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6375: commit: fix a typo ("form p1" -> "from p1")
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8988e640a8ac: commit: fix a typo ("form p1" -> "from p1") (authored by martinvonz, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D6375?vs=15085&id=15098#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6375?vs=15085&id=15098 REVISION DETAIL https://phab.mercurial-scm.org/D6375 AFFECTED FILES mercurial/localrepo.py tests/test-graft.t tests/test-merge-no-file-change.t CHANGE DETAILS diff --git a/tests/test-merge-no-file-change.t b/tests/test-merge-no-file-change.t --- a/tests/test-merge-no-file-change.t +++ b/tests/test-merge-no-file-change.t @@ -137,7 +137,7 @@ $ hg ci --debug -m merge committing files: b - reusing manifest form p1 (listed files actually unchanged) + reusing manifest from p1 (listed files actually unchanged) committing changelog updating the branch cache committed changeset 3:c8d50407916ef8a5a97cb6e36ca9bc844a6ee13e diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -755,7 +755,7 @@ committing files: b warning: can't find ancestor for 'b' copied from 'a'! - reusing manifest form p1 (listed files actually unchanged) + reusing manifest from p1 (listed files actually unchanged) committing changelog updating the branch cache $ hg log -r 'destination(13)' diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -2642,7 +2642,7 @@ p1.manifestnode(), p2.manifestnode(), added, drop, match=self.narrowmatch()) else: -self.ui.debug('reusing manifest form p1 (listed files ' +self.ui.debug('reusing manifest from p1 (listed files ' 'actually unchanged)\n') mn = p1.manifestnode() else: To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6375: commit: fix a typo ("form p1" -> "from p1")
pulkit added a comment. Amending the following diff in flight: diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -755,7 +755,7 @@ Transplants of grafts can find a destina committing files: b warning: can't find ancestor for 'b' copied from 'a'! - reusing manifest form p1 (listed files actually unchanged) + reusing manifest from p1 (listed files actually unchanged) committing changelog updating the branch cache $ hg log -r 'destination(13)' REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6375 To: martinvonz, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Google Summer of Code '19: Add functionality to store an unresolved merge-state
On Wed, May 15, 2019 at 7:53 PM Martin von Zweigbergk via Mercurial-devel < mercurial-devel@mercurial-scm.org> wrote: > > > *From: *Navaneeth Suresh > *Date: *Wed, May 15, 2019 at 5:13 AM > *To: *Pierre-Yves David > *Cc: *mercurial-devel > > On Tue, May 14, 2019 at 5:51 PM Pierre-Yves David < >> pierre-yves.da...@ens-lyon.org> wrote: >> >>> >>> >>> On 5/12/19 8:31 PM, Navaneeth Suresh wrote: >>> > Hello everyone, >>> > >>> > I am Navaneeth Suresh, one of the GSoC '19 students with Mercurial. I >>> > wanted to discuss my project on adding functionality to store an >>> > unresolved merge-state[1] >>> > < >>> https://www.mercurial-scm.org/wiki/SummerOfCode/Ideas2019#Add_functionality_to_store_an_unresolved_merge-state> >>> with >>> >>> > the community. Having gone through past mailing list archives on >>> similar >>> > issues, I got some ideas on the implementation of the project. >>> However, >>> > there can be other alternatives and I might encounter some issues >>> which >>> > I might not aware of. So, I'm sharing my idea of implementation. >>> > >>> > As said by @marmoute, we are storing only one active unresolved >>> > merge-state. >>> >>> Yes, the active merge state exists in .hg/merge/. It is used for the >>> operation the triggered a merge (hg merge, hg rebase, etc) and will >>> exist until the merge is concluded or aborted. >>> >>> As far as I understand your project, is to offer a third alternative: >>> delaying the merge resolution until later. Right ? >>> >> >> Yes. For example, if a user wants to fix an urgent bug without losing >> their partly done enormous conflict resolution, this project will help them >> to store the conflicts and resume the resolution after fixing the bug. In >> the current scenario, they are only allowed to either fully discard or >> complete the partly done resolution to perform a new commit. >> >> >>> >>> How do you see the final user experience? What is the workflow to delay >>> and later conclude/abort a merge? (note: there are some UX details from >>> you later in this email, but it probably worth being explained >>> independently). >>> >> >> From the UI point of view, it appeared to me as shelving with conflicts. >> > > Good idea. > > >> I thought of introducing two commands `hg store-conflicts` and `hg >> restore-conflicts`. >> > > Or even reuse `hg shelve` and `hg unshelve`? > I agree. `hg shelve --unresolved`. (I am still in-process of writing a reply to whole proposal) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Google Summer of Code '19: Add functionality to store an unresolved merge-state
*From: *Navaneeth Suresh *Date: *Wed, May 15, 2019 at 5:13 AM *To: *Pierre-Yves David *Cc: *mercurial-devel On Tue, May 14, 2019 at 5:51 PM Pierre-Yves David < > pierre-yves.da...@ens-lyon.org> wrote: > >> >> >> On 5/12/19 8:31 PM, Navaneeth Suresh wrote: >> > Hello everyone, >> > >> > I am Navaneeth Suresh, one of the GSoC '19 students with Mercurial. I >> > wanted to discuss my project on adding functionality to store an >> > unresolved merge-state[1] >> > < >> https://www.mercurial-scm.org/wiki/SummerOfCode/Ideas2019#Add_functionality_to_store_an_unresolved_merge-state> >> with >> >> > the community. Having gone through past mailing list archives on >> similar >> > issues, I got some ideas on the implementation of the project. However, >> > there can be other alternatives and I might encounter some issues which >> > I might not aware of. So, I'm sharing my idea of implementation. >> > >> > As said by @marmoute, we are storing only one active unresolved >> > merge-state. >> >> Yes, the active merge state exists in .hg/merge/. It is used for the >> operation the triggered a merge (hg merge, hg rebase, etc) and will >> exist until the merge is concluded or aborted. >> >> As far as I understand your project, is to offer a third alternative: >> delaying the merge resolution until later. Right ? >> > > Yes. For example, if a user wants to fix an urgent bug without losing > their partly done enormous conflict resolution, this project will help them > to store the conflicts and resume the resolution after fixing the bug. In > the current scenario, they are only allowed to either fully discard or > complete the partly done resolution to perform a new commit. > > >> >> How do you see the final user experience? What is the workflow to delay >> and later conclude/abort a merge? (note: there are some UX details from >> you later in this email, but it probably worth being explained >> independently). >> > > From the UI point of view, it appeared to me as shelving with conflicts. > Good idea. > I thought of introducing two commands `hg store-conflicts` and `hg > restore-conflicts`. > Or even reuse `hg shelve` and `hg unshelve`? For the user, it should be pretty easy to get things done. But, as you > told, it should require much work and the internal workflow might be > complex. (in the later part of the mail) > > >> >> > I am thinking to store it as a visible commit under a >> > bookmark having the prefix `conflict/`. >> >> That seems strange. We usually don't do this "data behind a bookmark >> namespace" in Mercurial. We have a "internal" phase dedicated to commit >> that are internal by product. That would be more appropriate. >> >> However, I am not sure we actually need a special commit. We could store >> conflict directly into the commit they intend to be part once resolved. >> That would simplify the storage and the UX. (more on that later) >> > > We might require a special commit as this changeset shows properties which > are different from normal commits (not publishable nature, etc.) But, we > can make use of tools you suggested such as extra mapping. > > >> >> > This should contain metadata >> > about the files which are marked as resolved/unresolved by the user. I >> > have coded this and made this work by respecting both parents without >> > changing the default behavior of `localrepo.commit()` (adding metadata >> > about conflicts part is left.) >> >> What format do you intend to use. What do you plan to do to preserve the >> file content >> > > I had a look at the old Imerge extension's format which was used to split > a merge into pieces and it looked good to me. In my proposed method, it > shouldn't allow another merge after `hg store-conflicts` until the user > triggers `hg restore-conflicts`. So, the merge-state living at .hg/merge > can be used for `hg restore-conflicts`. (Note that my official proposal > doesn't include bookmarks and it deals with hidden commits for conflicts) > > >> >> > This conflicted state can be later >> > restored by rebasing the tip on the top of the commit just before the >> > conflict commit and stripping the conflict commit from the DAG. The >> > restoring functionality is much hypothetical at the moment and there >> are >> > things to investigate on that. >> >> Okay, the workflow is a bit clearer to me now. However it seems quite >> complicated. I would propose a slightly different approach. Let me start >> with a simple example: >> >> You are trying to do a merge but there are conflict. >> >>$ hg merge >>3 files updated, 2 files merged, 0 files removed, 2 files unresolved >> >> Some of the file can be resolved, but one of the conflict remains >> difficult and you need to delay its resolution >> >>$ hg resolve -l >>R foo >>U bar >> >> My idea would be add a flag to make it possible to commit anyway. >> Something like: >> >>$ hg commit --unresolved >> > > Interesting. > > >> >> At that point we have a "regular" merge commit but with some >>
D6356: mdiff: prepare mdiff to be used for run-tests to replace unidiff
pulkit added a comment. In https://phab.mercurial-scm.org/D6356#92695, @sangeet259 wrote: > In https://phab.mercurial-scm.org/D6356#92644, @pulkit wrote: > > > > Why do I need to split the patches into two ? > > > The reason to split what would have been a single patch into two is because > > > for the next patch to be able to use the mdiff during tests, > > > this revision has to be there in the system's mercurial installation. > > > > I didn't get the last line. Can you explain more? > > > > I think both can be folded in one and should be good. > > > @pulkit > Well the next patch imports mercurial and then calls `mdff.new_diff` . If I combine those two patches then you can not see the change as while testing https://phab.mercurial-scm.org/D6359 , if there `mdiff` doesn't already have new_diff > it will always fall back to unified_diff as happened with @durin42 , while he was trying to see the alternate path as he trying to test https://phab.mercurial-scm.org/D5514 . > > What I am trying to do here is, once https://phab.mercurial-scm.org/D6356 is has added `new_diff` to `mdiff`, you can then have this revision installed in your system or wherever one tests this, and then check https://phab.mercurial-scm.org/D6359 to see the alternate path it follows. I was trying to test it and unable to get this to work both with a single patch and two splitted patches. My understanding is that the 1st patch should be present in the mercurial installed in the system, which is what you said right? If that's correct, we can go ahead and have this whole as one patch as I don't think people usually do install system hg on patch to patch basis. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6356 To: sangeet259, #hg-reviewers Cc: durin42, pulkit, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6359: test: change test's diff generation to use mdiff for nicer output
pulkit added a comment. The commit message has diff which confuses `hg import`. You need to indent those diffs. Also, remove the pastebin links as they are not required since we have diffs. > Download this bundle : http://bit.ly/2DuJjsS This link asks me to login. So definitely not a good link to put in commit message. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6359 To: sangeet259, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6356: mdiff: prepare mdiff to be used for run-tests to replace unidiff
pulkit added a comment. > Patch 1/2 we don't add that to commit messages. INLINE COMMENTS > mdiff.py:531 > + > +def prepare_mdiff(expected, output): > +"""Prepare the inputs for the mdiff.unidiff function""" may be worth to rename it to `prepare_mdiff_input`. > mdiff.py:540 > +opts = diffopts(noprefix=True) > +return exp, date1, out, date2, opts > + We can do date = datetime.datetime.now().strftime("%a %b %d %y %H:%M:%S %Y %z") return "".join(expected), date, "".join(output), date, diffopts(noprefix=True) > mdiff.py:544 > +"""Process the output of mdiff into a list of lines, > +to be used by getdiff""" > +# the hunklines are in the hunks generator I was unable to find any `getdiff` in this file. > mdiff.py:552 > +difflines = itertools.chain.from_iterable(hunklines) > +return difflines > + nit: `return itertools.chain.from_iterable(hunklines)` > mdiff.py:557 > +The API of new_diff is designed to be same as difflib.unified_diff. > +This is done for backwards compatibility and resuing existing code. > +""" backwards compatibility with what? > mdiff.py:562 > +ref, err, binary=False, opts=opts) > +difflines = process_mdiff(uheaders, hunks) > +return difflines nit: `return process_mdiff(uheaders, hunks)` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6356 To: sangeet259, #hg-reviewers Cc: durin42, pulkit, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6319: automation: initial support for running Linux tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG65b3ef162b39: automation: initial support for running Linux tests (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6319?vs=14938&id=15097 REVISION DETAIL https://phab.mercurial-scm.org/D6319 AFFECTED FILES contrib/automation/README.rst contrib/automation/hgautomation/aws.py contrib/automation/hgautomation/cli.py contrib/automation/hgautomation/linux.py contrib/automation/hgautomation/ssh.py contrib/automation/linux-requirements-py2.txt contrib/automation/linux-requirements-py3.txt contrib/automation/linux-requirements.txt.in contrib/automation/requirements.txt contrib/automation/requirements.txt.in tests/test-check-code.t CHANGE DETAILS diff --git a/tests/test-check-code.t b/tests/test-check-code.t --- a/tests/test-check-code.t +++ b/tests/test-check-code.t @@ -15,6 +15,8 @@ Skipping contrib/automation/hgautomation/__init__.py it has no-che?k-code (glob) Skipping contrib/automation/hgautomation/aws.py it has no-che?k-code (glob) Skipping contrib/automation/hgautomation/cli.py it has no-che?k-code (glob) + Skipping contrib/automation/hgautomation/linux.py it has no-che?k-code (glob) + Skipping contrib/automation/hgautomation/ssh.py it has no-che?k-code (glob) Skipping contrib/automation/hgautomation/windows.py it has no-che?k-code (glob) Skipping contrib/automation/hgautomation/winrm.py it has no-che?k-code (glob) Skipping contrib/packaging/hgpackaging/downloads.py it has no-che?k-code (glob) diff --git a/contrib/automation/requirements.txt.in b/contrib/automation/requirements.txt.in --- a/contrib/automation/requirements.txt.in +++ b/contrib/automation/requirements.txt.in @@ -1,2 +1,3 @@ boto3 +paramiko pypsrp diff --git a/contrib/automation/requirements.txt b/contrib/automation/requirements.txt --- a/contrib/automation/requirements.txt +++ b/contrib/automation/requirements.txt @@ -8,6 +8,27 @@ --hash=sha256:2f1adbb7546ed199e3c90ef23ec95c5cf3585bac7d11fb7eb562a3fe89c64e87 \ --hash=sha256:9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49 \ # via cryptography +bcrypt==3.1.6 \ + --hash=sha256:0ba875eb67b011add6d8c5b76afbd92166e98b1f1efab9433d5dc0fafc76e203 \ + --hash=sha256:21ed446054c93e209434148ef0b362432bb82bbdaf7beef70a32c221f3e33d1c \ + --hash=sha256:28a0459381a8021f57230954b9e9a65bb5e3d569d2c253c5cac6cb181d71cf23 \ + --hash=sha256:2aed3091eb6f51c26b7c2fad08d6620d1c35839e7a362f706015b41bd991125e \ + --hash=sha256:2fa5d1e438958ea90eaedbf8082c2ceb1a684b4f6c75a3800c6ec1e18ebef96f \ + --hash=sha256:3a73f45484e9874252002793518da060fb11eaa76c30713faa12115db17d1430 \ + --hash=sha256:3e489787638a36bb466cd66780e15715494b6d6905ffdbaede94440d6d8e7dba \ + --hash=sha256:44636759d222baa62806bbceb20e96f75a015a6381690d1bc2eda91c01ec02ea \ + --hash=sha256:678c21b2fecaa72a1eded0cf12351b153615520637efcadc09ecf81b871f1596 \ + --hash=sha256:75460c2c3786977ea9768d6c9d8957ba31b5fbeb0aae67a5c0e96aab4155f18c \ + --hash=sha256:8ac06fb3e6aacb0a95b56eba735c0b64df49651c6ceb1ad1cf01ba75070d567f \ + --hash=sha256:8fdced50a8b646fff8fa0e4b1c5fd940ecc844b43d1da5a980cb07f2d1b1132f \ + --hash=sha256:9b2c5b640a2da533b0ab5f148d87fb9989bf9bcb2e61eea6a729102a6d36aef9 \ + --hash=sha256:a9083e7fa9adb1a4de5ac15f9097eb15b04e2c8f97618f1b881af40abce382e1 \ + --hash=sha256:b7e3948b8b1a81c5a99d41da5fb2dc03ddb93b5f96fcd3fd27e643f91efa33e1 \ + --hash=sha256:b998b8ca979d906085f6a5d84f7b5459e5e94a13fc27c28a3514437013b6c2f6 \ + --hash=sha256:dd08c50bc6f7be69cd7ba0769acca28c846ec46b7a8ddc2acf4b9ac6f8a7457e \ + --hash=sha256:de5badee458544ab8125e63e39afeedfcf3aef6a6e2282ac159c95ae7472d773 \ + --hash=sha256:ede2a87333d24f55a4a7338a6ccdccf3eaa9bed081d1737e0db4dbd1a4f7e6b6 \ +# via paramiko boto3==1.9.137 \ --hash=sha256:882cc4869b47b51dae4b4a900769e72171ff00e0b6bca644b2d7a7ad7378f324 \ --hash=sha256:cd503a7e7a04f1c14d2801f9727159dfa88c393b4004e98940fa4aa205d920c8 @@ -48,7 +69,7 @@ --hash=sha256:e070535507bd6aa07124258171be2ee8dfc19119c28ca94c9dfb7efd23564512 \ --hash=sha256:e1ff2748c84d97b065cc95429814cdba39bcbd77c9c85c89344b317dc0d9cbff \ --hash=sha256:ed851c75d1e0e043cbf5ca9a8e1b13c4c90f3fbd863dacb01c0808e2b5204201 \ -# via cryptography +# via bcrypt, cryptography, pynacl chardet==3.0.4 \ --hash=sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae \ --hash=sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691 \ @@ -73,7 +94,7 @@ --hash=sha256:d4afbb0840f489b60f5a580a41a1b9c3622e08ecb5eec8614d4fb4cd914c4460 \ --hash=sha256:d9ed28030797c00f4bc43c86bf819266c76a5ea61d006cd4078a93ebf7da6bfd \ --hash=sha256:e603aa7bb52e4e8ed4119a58a03b60323918467ef209e6ff9db3ac382e5cf2c6 \ -# via pypsrp +# via paramiko, pypsrp docuti
D6318: automation: move image operations to own functions
This revision was automatically updated to reflect the committed changes. Closed by commit rHG195dcc10b3d7: automation: move image operations to own functions (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6318?vs=14937&id=15096 REVISION DETAIL https://phab.mercurial-scm.org/D6318 AFFECTED FILES contrib/automation/hgautomation/aws.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -402,14 +402,14 @@ profile.add_role(RoleName=role) -def find_windows_server_2019_image(ec2resource): -"""Find the Amazon published Windows Server 2019 base image.""" +def find_image(ec2resource, owner_id, name): +"""Find an AMI by its owner ID and name.""" images = ec2resource.images.filter( Filters=[ { -'Name': 'owner-alias', -'Values': ['amazon'], +'Name': 'owner-id', +'Values': [owner_id], }, { 'Name': 'state', @@ -421,14 +421,14 @@ }, { 'Name': 'name', -'Values': ['Windows_Server-2019-English-Full-Base-2019.02.13'], +'Values': [name], }, ]) for image in images: return image -raise Exception('unable to find Windows Server 2019 image') +raise Exception('unable to find image for %s' % name) def ensure_security_groups(ec2resource, prefix='hg-'): @@ -684,6 +684,84 @@ yield instances +def resolve_fingerprint(fingerprint): +fingerprint = json.dumps(fingerprint, sort_keys=True) +return hashlib.sha256(fingerprint.encode('utf-8')).hexdigest() + + +def find_and_reconcile_image(ec2resource, name, fingerprint): +"""Attempt to find an existing EC2 AMI with a name and fingerprint. + +If an image with the specified fingerprint is found, it is returned. +Otherwise None is returned. + +Existing images for the specified name that don't have the specified +fingerprint or are missing required metadata or deleted. +""" +# Find existing AMIs with this name and delete the ones that are invalid. +# Store a reference to a good image so it can be returned one the +# image state is reconciled. +images = ec2resource.images.filter( +Filters=[{'Name': 'name', 'Values': [name]}]) + +existing_image = None + +for image in images: +if image.tags is None: +print('image %s for %s lacks required tags; removing' % ( +image.id, image.name)) +remove_ami(ec2resource, image) +else: +tags = {t['Key']: t['Value'] for t in image.tags} + +if tags.get('HGIMAGEFINGERPRINT') == fingerprint: +existing_image = image +else: +print('image %s for %s has wrong fingerprint; removing' % ( + image.id, image.name)) +remove_ami(ec2resource, image) + +return existing_image + + +def create_ami_from_instance(ec2client, instance, name, description, + fingerprint): +"""Create an AMI from a running instance. + +Returns the ``ec2resource.Image`` representing the created AMI. +""" +instance.stop() + +ec2client.get_waiter('instance_stopped').wait( +InstanceIds=[instance.id], +WaiterConfig={ +'Delay': 5, +}) +print('%s is stopped' % instance.id) + +image = instance.create_image( +Name=name, +Description=description, +) + +image.create_tags(Tags=[ +{ +'Key': 'HGIMAGEFINGERPRINT', +'Value': fingerprint, +}, +]) + +print('waiting for image %s' % image.id) + +ec2client.get_waiter('image_available').wait( +ImageIds=[image.id], +) + +print('image %s available as %s' % (image.id, image.name)) + +return image + + def ensure_windows_dev_ami(c: AWSConnection, prefix='hg-'): """Ensure Windows Development AMI is available and up-to-date. @@ -702,6 +780,10 @@ name = '%s%s' % (prefix, 'windows-dev') +image = find_image(ec2resource, + '801119661308', + 'Windows_Server-2019-English-Full-Base-2019.02.13') + config = { 'BlockDeviceMappings': [ { @@ -713,7 +795,7 @@ }, } ], -'ImageId': find_windows_server_2019_image(ec2resource).id, +'ImageId': image.id, 'InstanceInitiatedShutdownBehavior': 'stop', 'InstanceType': 't3.medium', 'KeyName': '%sautomation' % prefix, @@ -748,38 +830,14 @@ # Compute a deterministic fingerprint to determine whether image needs # to be regenerated. -fingerpr
D6316: automation: do a force push to synchronize
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5c242c427897: automation: do a force push to synchronize (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6316?vs=14935&id=15095 REVISION DETAIL https://phab.mercurial-scm.org/D6316 AFFECTED FILES contrib/automation/hgautomation/windows.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/windows.py b/contrib/automation/hgautomation/windows.py --- a/contrib/automation/hgautomation/windows.py +++ b/contrib/automation/hgautomation/windows.py @@ -176,7 +176,8 @@ 'python2.7', hg_bin, '--config', 'ui.ssh=ssh -F %s' % ssh_config, '--config', 'ui.remotecmd=c:/hgdev/venv-bootstrap/Scripts/hg.exe', -'push', '-r', full_revision, 'ssh://%s/c:/hgdev/src' % public_ip, +'push', '-f', '-r', full_revision, +'ssh://%s/c:/hgdev/src' % public_ip, ] subprocess.run(args, cwd=str(hg_repo), env=env, check=True) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6317: automation: add --version argument to build-all-windows-packages
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd137a3d5ad41: automation: add --version argument to build-all-windows-packages (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6317?vs=14936&id=15094 REVISION DETAIL https://phab.mercurial-scm.org/D6317 AFFECTED FILES contrib/automation/hgautomation/cli.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/cli.py b/contrib/automation/hgautomation/cli.py --- a/contrib/automation/hgautomation/cli.py +++ b/contrib/automation/hgautomation/cli.py @@ -73,7 +73,8 @@ windows.build_wheel(instance.winrm_client, a, DIST_PATH) -def build_all_windows_packages(hga: HGAutomation, aws_region, revision): +def build_all_windows_packages(hga: HGAutomation, aws_region, revision, + version): c = hga.aws_connection(aws_region) image = aws.ensure_windows_dev_ami(c) DIST_PATH.mkdir(exist_ok=True) @@ -89,9 +90,11 @@ windows.purge_hg(winrm_client) windows.build_wheel(winrm_client, arch, DIST_PATH) windows.purge_hg(winrm_client) -windows.build_inno_installer(winrm_client, arch, DIST_PATH) +windows.build_inno_installer(winrm_client, arch, DIST_PATH, + version=version) windows.purge_hg(winrm_client) -windows.build_wix_installer(winrm_client, arch, DIST_PATH) +windows.build_wix_installer(winrm_client, arch, DIST_PATH, +version=version) def terminate_ec2_instances(hga: HGAutomation, aws_region): @@ -149,6 +152,10 @@ help='Mercurial revision to build', default='.', ) +sp.add_argument( +'--version', +help='Mercurial version string to use', +) sp.set_defaults(func=build_all_windows_packages) sp = subparsers.add_parser( To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6286: automation: wait for instance profiles and roles
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8dc22a209420: automation: wait for instance profiles and roles (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6286?vs=14933&id=15091 REVISION DETAIL https://phab.mercurial-scm.org/D6286 AFFECTED FILES contrib/automation/hgautomation/aws.py contrib/automation/requirements.txt CHANGE DETAILS diff --git a/contrib/automation/requirements.txt b/contrib/automation/requirements.txt --- a/contrib/automation/requirements.txt +++ b/contrib/automation/requirements.txt @@ -8,46 +8,46 @@ --hash=sha256:2f1adbb7546ed199e3c90ef23ec95c5cf3585bac7d11fb7eb562a3fe89c64e87 \ --hash=sha256:9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49 \ # via cryptography -boto3==1.9.111 \ - --hash=sha256:06414c75d1f62af7d04fd652b38d1e4fd3cfd6b35bad978466af88e2aaecd00d \ - --hash=sha256:f3b77dff382374773d02411fa47ee408f4f503aeebd837fd9dc9ed8635bc5e8e -botocore==1.12.111 \ - --hash=sha256:6af473c52d5e3e7ff82de5334e9fee96b2d5ec2df5d78bc00cd9937e2573a7a8 \ - --hash=sha256:9f5123c7be704b17aeacae99b5842ab17bda1f799dd29134de8c70e0a50a45d7 \ +boto3==1.9.137 \ + --hash=sha256:882cc4869b47b51dae4b4a900769e72171ff00e0b6bca644b2d7a7ad7378f324 \ + --hash=sha256:cd503a7e7a04f1c14d2801f9727159dfa88c393b4004e98940fa4aa205d920c8 +botocore==1.12.137 \ + --hash=sha256:0d95794f6b1239c75e2c5f966221bcd4b68020fddb5676f757531eedbb612ed8 \ + --hash=sha256:3213cf48cf2ceee10fc3b93221f2cd1c38521cca7584f547d5c086213cc60f35 \ # via boto3, s3transfer certifi==2019.3.9 \ --hash=sha256:59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5 \ --hash=sha256:b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae \ # via requests -cffi==1.12.2 \ - --hash=sha256:00b97afa72c233495560a0793cdc86c2571721b4271c0667addc83c417f3d90f \ - --hash=sha256:0ba1b0c90f2124459f6966a10c03794082a2f3985cd699d7d63c4a8dae113e11 \ - --hash=sha256:0bffb69da295a4fc3349f2ec7cbe16b8ba057b0a593a92cbe8396e535244ee9d \ - --hash=sha256:21469a2b1082088d11ccd79dd84157ba42d940064abbfa59cf5f024c19cf4891 \ - --hash=sha256:2e4812f7fa984bf1ab253a40f1f4391b604f7fc424a3e21f7de542a7f8f7aedf \ - --hash=sha256:2eac2cdd07b9049dd4e68449b90d3ef1adc7c759463af5beb53a84f1db62e36c \ - --hash=sha256:2f9089979d7456c74d21303c7851f158833d48fb265876923edcb2d0194104ed \ - --hash=sha256:3dd13feff00bddb0bd2d650cdb7338f815c1789a91a6f68fdc00e5c5ed40329b \ - --hash=sha256:4065c32b52f4b142f417af6f33a5024edc1336aa845b9d5a8d86071f6fcaac5a \ - --hash=sha256:51a4ba1256e9003a3acf508e3b4f4661bebd015b8180cc31849da222426ef585 \ - --hash=sha256:59888faac06403767c0cf8cfb3f4a777b2939b1fbd9f729299b5384f097f05ea \ - --hash=sha256:59c87886640574d8b14910840327f5cd15954e26ed0bbd4e7cef95fa5aef218f \ - --hash=sha256:610fc7d6db6c56a244c2701575f6851461753c60f73f2de89c79bbf1cc807f33 \ - --hash=sha256:70aeadeecb281ea901bf4230c6222af0248c41044d6f57401a614ea59d96d145 \ - --hash=sha256:71e1296d5e66c59cd2c0f2d72dc476d42afe02aeddc833d8e05630a0551dad7a \ - --hash=sha256:8fc7a49b440ea752cfdf1d51a586fd08d395ff7a5d555dc69e84b1939f7ddee3 \ - --hash=sha256:9b5c2afd2d6e3771d516045a6cfa11a8da9a60e3d128746a7fe9ab36dfe7221f \ - --hash=sha256:9c759051ebcb244d9d55ee791259ddd158188d15adee3c152502d3b69005e6bd \ - --hash=sha256:b4d1011fec5ec12aa7cc10c05a2f2f12dfa0adfe958e56ae38dc140614035804 \ - --hash=sha256:b4f1d6332339ecc61275bebd1f7b674098a66fea11a00c84d1c58851e618dc0d \ - --hash=sha256:c030cda3dc8e62b814831faa4eb93dd9a46498af8cd1d5c178c2de856972fd92 \ - --hash=sha256:c2e1f2012e56d61390c0e668c20c4fb0ae667c44d6f6a2eeea5d7148dcd3df9f \ - --hash=sha256:c37c77d6562074452120fc6c02ad86ec928f5710fbc435a181d69334b4de1d84 \ - --hash=sha256:c8149780c60f8fd02752d0429246088c6c04e234b895c4a42e1ea9b4de8d27fb \ - --hash=sha256:cbeeef1dc3c4299bd746b774f019de9e4672f7cc666c777cd5b409f0b746dac7 \ - --hash=sha256:e113878a446c6228669144ae8a56e268c91b7f1fafae927adc4879d9849e0ea7 \ - --hash=sha256:e21162bf941b85c0cda08224dade5def9360f53b09f9f259adb85fc7dd0e7b35 \ - --hash=sha256:fb6934ef4744becbda3143d30c6604718871495a5e36c408431bf33d9c146889 \ +cffi==1.12.3 \ + --hash=sha256:041c81822e9f84b1d9c401182e174996f0bae9991f33725d059b771744290774 \ + --hash=sha256:046ef9a22f5d3eed06334d01b1e836977eeef500d9b78e9ef693f9380ad0b83d \ + --hash=sha256:066bc4c7895c91812eff46f4b1c285220947d4aa46fa0a2651ff85f2afae9c90 \ + --hash=sha256:066c7ff148ae33040c01058662d6752fd73fbc8e64787229ea8498c7d7f4041b \ + --hash=sha256:2444d0c61f03dcd26dbf7600cf64354376ee579acad77aef459e34efcb438c63 \ + --hash=sha256:300832850b8f7967e278870c5d51e3819b9aad8f0a2c8dbe39ab11f119237f45 \ + --hash=sha256:34c77afe85b6b9e967bd8154e3855e847b70ca42043db6ad17f26899a3df1b25 \ + --hash=sha256:46de5fa00f7ac09f02072
D6315: automation: add check that hg source directory is a repo
This revision was automatically updated to reflect the committed changes. Closed by commit rHG4274b1369b75: automation: add check that hg source directory is a repo (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6315?vs=14934&id=15093 REVISION DETAIL https://phab.mercurial-scm.org/D6315 AFFECTED FILES contrib/automation/hgautomation/windows.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/windows.py b/contrib/automation/hgautomation/windows.py --- a/contrib/automation/hgautomation/windows.py +++ b/contrib/automation/hgautomation/windows.py @@ -156,6 +156,10 @@ fh.write(' UserKnownHostsFile %s\n' % (ssh_dir / 'known_hosts')) fh.write(' IdentityFile %s\n' % (ssh_dir / 'id_rsa')) +if not (hg_repo / '.hg').is_dir(): +raise Exception('%s is not a Mercurial repository; ' +'synchronization not yet supported' % hg_repo) + env = dict(os.environ) env['HGPLAIN'] = '1' env['HGENCODING'] = 'utf-8' To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6288: automation: shore up rebooting behavior
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe570106beda1: automation: shore up rebooting behavior (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6288?vs=14867&id=15092 REVISION DETAIL https://phab.mercurial-scm.org/D6288 AFFECTED FILES contrib/automation/hgautomation/aws.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -808,10 +808,26 @@ ) # Reboot so all updates are fully applied. +# +# We don't use instance.reboot() here because it is asynchronous and +# we don't know when exactly the instance has rebooted. It could take +# a while to stop and we may start trying to interact with the instance +# before it has rebooted. print('rebooting instance %s' % instance.id) -ec2client.reboot_instances(InstanceIds=[instance.id]) +instance.stop() +ec2client.get_waiter('instance_stopped').wait( +InstanceIds=[instance.id], +WaiterConfig={ +'Delay': 5, +}) -time.sleep(15) +instance.start() +wait_for_ip_addresses([instance]) + +# There is a race condition here between the User Data PS script running +# and us connecting to WinRM. This can manifest as +# "AuthorizationManager check failed" failures during run_powershell(). +# TODO figure out a workaround. print('waiting for Windows Remote Management to come back...') client = wait_for_winrm(instance.public_ip_address, 'Administrator', To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6285: automation: don't create resources when deleting things
This revision was automatically updated to reflect the committed changes. Closed by commit rHGdd6a9723ae2b: automation: don't create resources when deleting things (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6285?vs=14862&id=15089 REVISION DETAIL https://phab.mercurial-scm.org/D6285 AFFECTED FILES contrib/automation/hgautomation/__init__.py contrib/automation/hgautomation/aws.py contrib/automation/hgautomation/cli.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/cli.py b/contrib/automation/hgautomation/cli.py --- a/contrib/automation/hgautomation/cli.py +++ b/contrib/automation/hgautomation/cli.py @@ -95,12 +95,12 @@ def terminate_ec2_instances(hga: HGAutomation, aws_region): -c = hga.aws_connection(aws_region) +c = hga.aws_connection(aws_region, ensure_ec2_state=False) aws.terminate_ec2_instances(c.ec2resource) def purge_ec2_resources(hga: HGAutomation, aws_region): -c = hga.aws_connection(aws_region) +c = hga.aws_connection(aws_region, ensure_ec2_state=False) aws.remove_resources(c) diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -180,7 +180,7 @@ class AWSConnection: """Manages the state of a connection with AWS.""" -def __init__(self, automation, region: str): +def __init__(self, automation, region: str, ensure_ec2_state: bool=True): self.automation = automation self.local_state_path = automation.state_path @@ -191,11 +191,12 @@ self.ec2resource = self.session.resource('ec2') self.iamclient = self.session.client('iam') self.iamresource = self.session.resource('iam') - -ensure_key_pairs(automation.state_path, self.ec2resource) +self.security_groups = {} -self.security_groups = ensure_security_groups(self.ec2resource) -ensure_iam_state(self.iamresource) +if ensure_ec2_state: +ensure_key_pairs(automation.state_path, self.ec2resource) +self.security_groups = ensure_security_groups(self.ec2resource) +ensure_iam_state(self.iamresource) def key_pair_path_private(self, name): """Path to a key pair private key file.""" diff --git a/contrib/automation/hgautomation/__init__.py b/contrib/automation/hgautomation/__init__.py --- a/contrib/automation/hgautomation/__init__.py +++ b/contrib/automation/hgautomation/__init__.py @@ -53,7 +53,7 @@ return password -def aws_connection(self, region: str): +def aws_connection(self, region: str, ensure_ec2_state: bool=True): """Obtain an AWSConnection instance bound to a specific region.""" -return AWSConnection(self, region) +return AWSConnection(self, region, ensure_ec2_state=ensure_ec2_state) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6287: automation: wait longer for WinRM connection
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf30184484dd1: automation: wait longer for WinRM connection (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6287?vs=14866&id=15090 REVISION DETAIL https://phab.mercurial-scm.org/D6287 AFFECTED FILES contrib/automation/hgautomation/winrm.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/winrm.py b/contrib/automation/hgautomation/winrm.py --- a/contrib/automation/hgautomation/winrm.py +++ b/contrib/automation/hgautomation/winrm.py @@ -25,7 +25,7 @@ logger = logging.getLogger(__name__) -def wait_for_winrm(host, username, password, timeout=120, ssl=False): +def wait_for_winrm(host, username, password, timeout=180, ssl=False): """Wait for the Windows Remoting (WinRM) service to become available. Returns a ``psrpclient.Client`` instance. To: indygreg, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6284: automation: detach policies before deleting role
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfcb97cb91ff8: automation: detach policies before deleting role (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6284?vs=14861&id=15088 REVISION DETAIL https://phab.mercurial-scm.org/D6284 AFFECTED FILES contrib/automation/hgautomation/aws.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -505,6 +505,10 @@ for role in iamresource.roles.all(): if role.name.startswith(prefix): +for p in role.attached_policies.all(): +print('detaching policy %s from %s' % (p.arn, role.name)) +role.detach_policy(PolicyArn=p.arn) + print('removing role %s' % role.name) role.delete() To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6283: automation: only iterate over our AMIs
This revision was automatically updated to reflect the committed changes. Closed by commit rHG730edbd836d8: automation: only iterate over our AMIs (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D6283?vs=14860&id=15087 REVISION DETAIL https://phab.mercurial-scm.org/D6283 AFFECTED FILES contrib/automation/hgautomation/aws.py CHANGE DETAILS diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py --- a/contrib/automation/hgautomation/aws.py +++ b/contrib/automation/hgautomation/aws.py @@ -490,7 +490,7 @@ terminate_ec2_instances(ec2resource, prefix=prefix) -for image in ec2resource.images.all(): +for image in ec2resource.images.filter(Owners=['self']): if image.name.startswith(prefix): remove_ami(ec2resource, image) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D6287: automation: wait longer for WinRM connection
martinvonz accepted this revision. martinvonz added a comment. This revision is now accepted and ready to land. I think I asked on #mercurial a while ago if anyone knew enough about Windows packaging to review this. No one said anything. So I can't see any reason *not* to queue this series. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6287 To: indygreg, #hg-reviewers, martinvonz Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Google Summer of Code '19: Add functionality to store an unresolved merge-state
On Tue, May 14, 2019 at 5:51 PM Pierre-Yves David < pierre-yves.da...@ens-lyon.org> wrote: > > > On 5/12/19 8:31 PM, Navaneeth Suresh wrote: > > Hello everyone, > > > > I am Navaneeth Suresh, one of the GSoC '19 students with Mercurial. I > > wanted to discuss my project on adding functionality to store an > > unresolved merge-state[1] > > < > https://www.mercurial-scm.org/wiki/SummerOfCode/Ideas2019#Add_functionality_to_store_an_unresolved_merge-state> > with > > > the community. Having gone through past mailing list archives on similar > > issues, I got some ideas on the implementation of the project. However, > > there can be other alternatives and I might encounter some issues which > > I might not aware of. So, I'm sharing my idea of implementation. > > > > As said by @marmoute, we are storing only one active unresolved > > merge-state. > > Yes, the active merge state exists in .hg/merge/. It is used for the > operation the triggered a merge (hg merge, hg rebase, etc) and will > exist until the merge is concluded or aborted. > > As far as I understand your project, is to offer a third alternative: > delaying the merge resolution until later. Right ? > Yes. For example, if a user wants to fix an urgent bug without losing their partly done enormous conflict resolution, this project will help them to store the conflicts and resume the resolution after fixing the bug. In the current scenario, they are only allowed to either fully discard or complete the partly done resolution to perform a new commit. > > How do you see the final user experience? What is the workflow to delay > and later conclude/abort a merge? (note: there are some UX details from > you later in this email, but it probably worth being explained > independently). > >From the UI point of view, it appeared to me as shelving with conflicts. I thought of introducing two commands `hg store-conflicts` and `hg restore-conflicts`. For the user, it should be pretty easy to get things done. But, as you told, it should require much work and the internal workflow might be complex. (in the later part of the mail) > > > I am thinking to store it as a visible commit under a > > bookmark having the prefix `conflict/`. > > That seems strange. We usually don't do this "data behind a bookmark > namespace" in Mercurial. We have a "internal" phase dedicated to commit > that are internal by product. That would be more appropriate. > > However, I am not sure we actually need a special commit. We could store > conflict directly into the commit they intend to be part once resolved. > That would simplify the storage and the UX. (more on that later) > We might require a special commit as this changeset shows properties which are different from normal commits (not publishable nature, etc.) But, we can make use of tools you suggested such as extra mapping. > > > This should contain metadata > > about the files which are marked as resolved/unresolved by the user. I > > have coded this and made this work by respecting both parents without > > changing the default behavior of `localrepo.commit()` (adding metadata > > about conflicts part is left.) > > What format do you intend to use. What do you plan to do to preserve the > file content > I had a look at the old Imerge extension's format which was used to split a merge into pieces and it looked good to me. In my proposed method, it shouldn't allow another merge after `hg store-conflicts` until the user triggers `hg restore-conflicts`. So, the merge-state living at .hg/merge can be used for `hg restore-conflicts`. (Note that my official proposal doesn't include bookmarks and it deals with hidden commits for conflicts) > > > This conflicted state can be later > > restored by rebasing the tip on the top of the commit just before the > > conflict commit and stripping the conflict commit from the DAG. The > > restoring functionality is much hypothetical at the moment and there are > > things to investigate on that. > > Okay, the workflow is a bit clearer to me now. However it seems quite > complicated. I would propose a slightly different approach. Let me start > with a simple example: > > You are trying to do a merge but there are conflict. > >$ hg merge >3 files updated, 2 files merged, 0 files removed, 2 files unresolved > > Some of the file can be resolved, but one of the conflict remains > difficult and you need to delay its resolution > >$ hg resolve -l >R foo >U bar > > My idea would be add a flag to make it possible to commit anyway. > Something like: > >$ hg commit --unresolved > Interesting. > > At that point we have a "regular" merge commit but with some > "unresolved" flag. And the related data can also be stored there. > > At that point, this "unresolved" commit cannot move to the public phase. > >$ hg phase --public > IIRC, @pulkit told me that the new changeset by the user after committing the unresolved files shouldn't come as a child of the "unresolved" commit. T
D6356: mdiff: prepare mdiff to be used for run-tests to replace unidiff
sangeet259 added a subscriber: durin42. sangeet259 added a comment. In https://phab.mercurial-scm.org/D6356#92644, @pulkit wrote: > > Why do I need to split the patches into two ? > > The reason to split what would have been a single patch into two is because > > for the next patch to be able to use the mdiff during tests, > > this revision has to be there in the system's mercurial installation. > > I didn't get the last line. Can you explain more? > > I think both can be folded in one and should be good. @pulkit Well the next patch imports mercurial and then calls `mdff.new_diff` . If I combine those two patches then you can not see the change as while testing https://phab.mercurial-scm.org/D6359 , if there `mdiff` doesn't already have new_diff it will always fall back to unified_diff as happened with @durin42 , while he was trying to see the alternate path as he trying to test https://phab.mercurial-scm.org/D5514 . What I am trying to do here is, once https://phab.mercurial-scm.org/D6356 is has added `new_diff` to `mdiff`, you can then have this revision installed in your system or wherever one tests this, and then check https://phab.mercurial-scm.org/D6359 to see the alternate path it follows. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D6356 To: sangeet259, #hg-reviewers Cc: durin42, pulkit, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel