D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd80380ba8e7d: changegroup: use any node, not min(), in treemanifests generatemanifests (authored by spectral, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1351?vs=3388=3389 REVISION DETAIL https://phab.mercurial-scm.org/D1351 AFFECTED FILES mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -692,7 +692,7 @@ # Callback for the manifest, used to collect linkrevs for filelog # revisions. # Returns the linkrev node (collected in lookupcl). -def makelookupmflinknode(dir): +def makelookupmflinknode(dir, nodes): if fastpathlinkrev: assert not dir return mfs.__getitem__ @@ -713,7 +713,7 @@ the client before you can trust the list of files and treemanifests to send. """ -clnode = tmfnodes[dir][x] +clnode = nodes[x] mdata = mfl.get(dir, x).readfast(shallow=True) for p, n, fl in mdata.iterentries(): if fl == 't': # subdirectory manifest @@ -733,15 +733,13 @@ size = 0 while tmfnodes: -dir = min(tmfnodes) -nodes = tmfnodes[dir] +dir, nodes = tmfnodes.popitem() prunednodes = self.prune(dirlog(dir), nodes, commonrevs) if not dir or prunednodes: for x in self._packmanifests(dir, prunednodes, - makelookupmflinknode(dir)): + makelookupmflinknode(dir, nodes)): size += len(x) yield x -del tmfnodes[dir] self._verbosenote(_('%8.i (manifests)\n') % size) yield self._manifestsdone() To: spectral, #hg-reviewers, indygreg Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
spectral marked 4 inline comments as done. spectral added a comment. run-tests.py found no issues with this version, my manual testing (using PYTHONHASHSEED to adjust the ordering) also encountered no issues INLINE COMMENTS > indygreg wrote in changegroup.py:738 > Can we use ``dict.popitem()`` instead? That will pop a random key-value pair. > I just don't know if the key needs to remain in the dict until later in the > function... profiling seems to indicate this is a little faster as well as being a bit cleaner, so thanks for making me check :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1351 To: spectral, #hg-reviewers Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
spectral updated this revision to Diff 3388. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1351?vs=3358=3388 REVISION DETAIL https://phab.mercurial-scm.org/D1351 AFFECTED FILES mercurial/changegroup.py CHANGE DETAILS diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -692,7 +692,7 @@ # Callback for the manifest, used to collect linkrevs for filelog # revisions. # Returns the linkrev node (collected in lookupcl). -def makelookupmflinknode(dir): +def makelookupmflinknode(dir, nodes): if fastpathlinkrev: assert not dir return mfs.__getitem__ @@ -713,7 +713,7 @@ the client before you can trust the list of files and treemanifests to send. """ -clnode = tmfnodes[dir][x] +clnode = nodes[x] mdata = mfl.get(dir, x).readfast(shallow=True) for p, n, fl in mdata.iterentries(): if fl == 't': # subdirectory manifest @@ -733,15 +733,13 @@ size = 0 while tmfnodes: -dir = min(tmfnodes) -nodes = tmfnodes[dir] +dir, nodes = tmfnodes.popitem() prunednodes = self.prune(dirlog(dir), nodes, commonrevs) if not dir or prunednodes: for x in self._packmanifests(dir, prunednodes, - makelookupmflinknode(dir)): + makelookupmflinknode(dir, nodes)): size += len(x) yield x -del tmfnodes[dir] self._verbosenote(_('%8.i (manifests)\n') % size) yield self._manifestsdone() To: spectral, #hg-reviewers Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
martinvonz added inline comments. INLINE COMMENTS > spectral wrote in changegroup.py:738 > I think that it needs to remain, makelookupmflinknode(dir) relies on it > (L716). I haven't attempted to popitem and pass that to makelookupmflinknode > instead, let me try that out now... Oh, yuck. Can perhaps pass "nodes" into makelookupmflinknode() along with "dir"? It will still update it on line 721, but at least one of those unclear sideeffects go away. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1351 To: spectral, #hg-reviewers Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
spectral added inline comments. INLINE COMMENTS > indygreg wrote in changegroup.py:738 > Can we use ``dict.popitem()`` instead? That will pop a random key-value pair. > I just don't know if the key needs to remain in the dict until later in the > function... I think that it needs to remain, makelookupmflinknode(dir) relies on it (L716). I haven't attempted to popitem and pass that to makelookupmflinknode instead, let me try that out now... REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1351 To: spectral, #hg-reviewers Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
martinvonz added a comment. In https://phab.mercurial-scm.org/D1351#22473, @indygreg wrote: > Should I be concerned about the lack of test fallout? This new behavior is non-deterministic. Do we not have testing for this code or is existing testing not low-level enough to uncover behavior changes resulting from this change? I'm not worried about it. It only makes a difference for treemanifests, and the change is just about the order in changegroup and (therefore) the order in which we write revlogs. We don't have much testing of treemanifests and we rarely check the exact format in a changegroup. We do print out a debug message on line 482 that could be used to see a difference before and after this patch, but I just checked that test-treemanifest.t doesn't pass --verbose. Still, I wouldn't mind if some Facebooker tried to run their treemanifest tests (in hgexperimental) against a version with this patch applied. INLINE COMMENTS > indygreg wrote in changegroup.py:738 > Can we use ``dict.popitem()`` instead? That will pop a random key-value pair. > I just don't know if the key needs to remain in the dict until later in the > function... Good idea. I'm pretty sure that should be safe (but perhaps tests will prove me wrong). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1351 To: spectral, #hg-reviewers Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1329: bundle: allow bundlerepo to support alternative manifest implementations
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa2dfc723b6b5: bundle: allow bundlerepo to support alternative manifest implementations (authored by durham, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1329?vs=3314=3385 REVISION DETAIL https://phab.mercurial-scm.org/D1329 AFFECTED FILES mercurial/bundlerepo.py CHANGE DETAILS diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -352,14 +352,31 @@ self.filestart = self.bundle.tell() return m +def _consumemanifest(self): +"""Consumes the manifest portion of the bundle, setting filestart so the +file portion can be read.""" +self.bundle.seek(self.manstart) +self.bundle.manifestheader() +for delta in self.bundle.deltaiter(): +pass +self.filestart = self.bundle.tell() + @localrepo.unfilteredpropertycache def manstart(self): self.changelog return self.manstart @localrepo.unfilteredpropertycache def filestart(self): self.manifestlog + +# If filestart was not set by self.manifestlog, that means the +# manifestlog implementation did not consume the manifests from the +# changegroup (ex: it might be consuming trees from a separate bundle2 +# part instead). So we need to manually consume it. +if 'filestart' not in self.__dict__: +self._consumemanifest() + return self.filestart def url(self): To: durham, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1329: bundle: allow bundlerepo to support alternative manifest implementations
indygreg accepted this revision. indygreg added a comment. This revision is now accepted and ready to land. bundlerepo is a pile of hacks and this seems par for the course. FWIW, I've been looking at rewriting bundle2's I/O layer in order to address issue 5691. If you anticipate making significant changes to bundlerepo or bundle2 in the near future, please let me know so we don't step on each other's toes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1329 To: durham, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1351: changegroup: use any node, not min(), in treemanifest's generatemanifests
indygreg added a comment. Should I be concerned about the lack of test fallout? This new behavior is non-deterministic. Do we not have testing for this code or is existing testing not low-level enough to uncover behavior changes resulting from this change? INLINE COMMENTS > changegroup.py:738 > +# element. > +dir = next(iter(tmfnodes)) > nodes = tmfnodes[dir] Can we use ``dict.popitem()`` instead? That will pop a random key-value pair. I just don't know if the key needs to remain in the dict until later in the function... REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1351 To: spectral, #hg-reviewers Cc: indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1339: dirstate: don't remove normallookup files from nonnormalset
indygreg added a comment. I was going to review this series. But I fear my dirstate knowledge is not good enough to understand the implications of all the changes. So I don't plan to look at it unless another reviewer can't be found. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1339 To: mbthomas, #hg-reviewers Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1337: util: add util.clearcachedproperty
indygreg accepted this revision. indygreg added inline comments. This revision is now accepted and ready to land. INLINE COMMENTS > util.py:936-937 > +'''clear a cached property value, if one has been set''' > +if prop in obj.__dict__: > +del obj.__dict__[prop] > + This pattern is commonly implemented using a ``try..except KeyError`` around the ``del``. This avoids the double key lookup and I /think/ is faster. But since this is a super small function and won't be called with high frequency (I assume), it shouldn't be a problem. If a loop were so tight that it mattered, execution time would be dominated by Python function call overhead, not the low-level primitives inside the function. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1337 To: mbthomas, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1336: HG: hg rm -A option prints the message of every file in the repo
mharbison72 added a comment. @mitrandir Oh, sorry, I see what you mean now. I wonder if the nice thing for people used to the current behavior is to terse the directories that don't have deleted files. That way the message is still there, but the sheer volume is lower. If an entire subtree is excluded, only the highest directory level is mentioned. not removing dirname/: no deleted files not removing dirname2/: no deleted files not removing dirname3/subdir/filename: file still exists ... But for just the 'still exists' warnings, I guess I don't feel that strongly. Status can always be checked. I do think the first added ui.verbose check is wrong though. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1336 To: pavanpc, #hg-reviewers Cc: mitrandir, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1354: dirstate: change all writes to dirstatemap._map to go through one method.
mbolin created this revision. mbolin added reviewers: mbthomas, durham. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This separates some concerns that were introduced in https://phab.mercurial-scm.org/D1341. In particular, this makes it easier for `eden_dirstate` to provide its own implementation, which incidentally, does not use `dirstatetuple`. TEST PLAN Ran this against a complementary change in Eden and verified that all of Eden's integration tests pass. REPOSITORY rHG Mercurial BRANCH default REVISION DETAIL https://phab.mercurial-scm.org/D1354 AFFECTED FILES mercurial/dirstate.py CHANGE DETAILS diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -1235,7 +1235,7 @@ self._dirs.addpath(f) if oldstate == "?" and "_alldirs" in self.__dict__: self._alldirs.addpath(f) -self._map[f] = dirstatetuple(state, mode, size, mtime) +self._insert_tuple(f, state, mode, size, mtime) if state != 'n' or mtime == -1: self.nonnormalset.add(f) if size == -2: @@ -1256,7 +1256,7 @@ if "filefoldmap" in self.__dict__: normed = util.normcase(f) self.filefoldmap.pop(normed, None) -self._map[f] = dirstatetuple('r', 0, size, 0) +self._insert_tuple(f, 'r', 0, size, 0) self.nonnormalset.add(f) def dropfile(self, f, oldstate): @@ -1281,9 +1281,12 @@ for f in files: e = self.get(f) if e is not None and e[0] == 'n' and e[3] == now: -self._map[f] = dirstatetuple(e[0], e[1], e[2], -1) +self._insert_tuple(f, e[0], e[1], e[2], -1) self.nonnormalset.add(f) +def _insert_tuple(self, f, state, mode, size, mtime): +self._map[f] = dirstatetuple(state, mode, size, mtime) + def nonnormalentries(self): '''Compute the nonnormal dirstate entries from the dmap''' try: To: mbolin, mbthomas, durham, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1345: dirstate: add explicit methods for querying directories
mbolin added inline comments. INLINE COMMENTS > dirstate.py:393 > scmutil.checkfilename(f) > -if f in self._map.dirs: > +if self._map.hastrackeddir(f): > raise error.Abort(_('directory %r already in dirstate') % f) Can you just use `hasdir` here instead so there's only one thing to override? > dirstate.py:397 > for d in util.finddirs(f): > -if d in self._map.dirs: > +if self._map.hastrackeddir(d): > break Here too? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1345 To: mbthomas, #hg-reviewers Cc: mbolin, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1341: dirstate: move management of nonnormal sets into dirstate map
mbolin added inline comments. INLINE COMMENTS > dirstate.py:1247 > self._map[f] = dirstatetuple(state, mode, size, mtime) > +if state != 'n' or mtime == -1: > +self.nonnormalset.add(f) I would prefer to see all mutations to `self._map` go through a common code path so that we can override this behavior easier in Eden. As it stands, when this logic is conflated, it makes it much harder for us to safely subclass `dirstatemap` in Eden. For reference, here's what we're doing today: https://github.com/facebookexperimental/eden-hg/blob/master/eden/hg/eden/eden_dirstate_map.py REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1341 To: mbthomas, #hg-reviewers Cc: mbolin, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1340: dirstate: add explicit methods for modifying dirstate
mbolin added inline comments. INLINE COMMENTS > dirstate.py:1275 > +""" > +exists = f in self._map > +if exists: To avoid doing two lookups in `self._map`: try: self._map.pop(f) return True except KeyError: return False REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1340 To: mbthomas, #hg-reviewers Cc: mbolin, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1063: rebase: enable multidest by default
martinvonz added a comment. In https://phab.mercurial-scm.org/D1063#22439, @quark wrote: > Since the freeze is over. I'd like to know how to move forward. Does that mean FB has now rewritten "hg restack" to use multi-destination rebase and used that in production for a while? I want to test it out in production for us too and see if it works for us, but I won't bother until I've heard that you guys have. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1063 To: quark, #hg-reviewers, durin42 Cc: dlax, martinvonz, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1285: localrepo: add a new attribute _visibilityexceptions and related API
quark added a comment. I think `localrepo` object is usually for unfiltered access therefore the visibility exception API looks strange to me. INLINE COMMENTS > localrepo.py:516 > +def addvisibilityexceptions(self, exceptions): > +""" adds hidden revs which should be visible to set of exceptions """ > +self._visibilityexceptions.update(exceptions) nit: do not need a space around `"""` REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1285 To: pulkit, #hg-reviewers Cc: quark, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1063: rebase: enable multidest by default
quark requested review of this revision. quark added a comment. Since the freeze is over. I'd like to know how to move forward. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1063 To: quark, #hg-reviewers, durin42 Cc: dlax, martinvonz, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1047: tweakdefaults: add restack command
quark abandoned this revision. quark added a comment. This does not belong to tweakdefaults, which is for BC purpose. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1047 To: quark, #hg-reviewers Cc: durin42, martinvonz, lothiraldan, dlax, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@35007: 11 new changesets
11 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/0c9ba2ac60a8 changeset: 34997:0c9ba2ac60a8 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:03:08 2017 +0530 summary: py3: handle keyword arguments in hgext/graphlog.py https://www.mercurial-scm.org/repo/hg/rev/fc0e6d298cd4 changeset: 34998:fc0e6d298cd4 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:03:27 2017 +0530 summary: py3: handle keyword arguments in hgext/hgk.py https://www.mercurial-scm.org/repo/hg/rev/c4b769bc86da changeset: 34999:c4b769bc86da user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:03:54 2017 +0530 summary: py3: handle keyword arguments in hgext/histedit.py https://www.mercurial-scm.org/repo/hg/rev/135edf120d76 changeset: 35000:135edf120d76 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:04:12 2017 +0530 summary: py3: handle keyword arguments in hgext/journal.py https://www.mercurial-scm.org/repo/hg/rev/3fbc30f7b9f0 changeset: 35001:3fbc30f7b9f0 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:04:30 2017 +0530 summary: py3: handle keyword arguments in hgext/keyword.py https://www.mercurial-scm.org/repo/hg/rev/1a07f9187831 changeset: 35002:1a07f9187831 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:04:47 2017 +0530 summary: py3: handle keyword arguments in hgext/rebase.py https://www.mercurial-scm.org/repo/hg/rev/e68dd1909af3 changeset: 35003:e68dd1909af3 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:05:04 2017 +0530 summary: py3: handle keyword arguments in hgext/releasenotes.py https://www.mercurial-scm.org/repo/hg/rev/3ebae3ec4664 changeset: 35004:3ebae3ec4664 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:06:23 2017 +0530 summary: py3: handle keyword arguments in hgext/uncommit.py https://www.mercurial-scm.org/repo/hg/rev/aad6b9fdfc75 changeset: 35005:aad6b9fdfc75 user:Pulkit Goyal <7895pul...@gmail.com> date:Mon Oct 23 00:06:49 2017 +0530 summary: py3: handle keyword arguments in hgext/shelve.py https://www.mercurial-scm.org/repo/hg/rev/8154119ed236 changeset: 35006:8154119ed236 user:Ryan McElroydate:Tue Nov 07 13:46:15 2017 -0800 summary: cat: test output path behvaior when target path does not exist https://www.mercurial-scm.org/repo/hg/rev/407ec7f3ff02 changeset: 35007:407ec7f3ff02 bookmark:@ tag: tip user:Ryan McElroy date:Tue Nov 07 13:48:33 2017 -0800 summary: cmdutil: create dirs for templated cat file output -- 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
D974: py3: handle keyword arguments correctly in hgext/patchbomb.py
pulkit updated this revision to Diff 3376. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D974?vs=3231=3376 REVISION DETAIL https://phab.mercurial-scm.org/D974 AFFECTED FILES hgext/patchbomb.py CHANGE DETAILS diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py --- a/hgext/patchbomb.py +++ b/hgext/patchbomb.py @@ -89,6 +89,7 @@ mail, node as nodemod, patch, +pycompat, registrar, repair, scmutil, @@ -318,7 +319,7 @@ tmpfn = os.path.join(tmpdir, 'bundle') btype = ui.config('patchbomb', 'bundletype') if btype: -opts['type'] = btype +opts[r'type'] = btype try: commands.bundle(ui, repo, tmpfn, dest, **opts) return util.readfile(tmpfn) @@ -338,8 +339,8 @@ the user through the editor. """ ui = repo.ui -if opts.get('desc'): -body = open(opts.get('desc')).read() +if opts.get(r'desc'): +body = open(opts.get(r'desc')).read() else: ui.write(_('\nWrite the introductory message for the ' 'patch series.\n\n')) @@ -359,21 +360,21 @@ """ ui = repo.ui _charsets = mail._charsets(ui) -subj = (opts.get('subject') +subj = (opts.get(r'subject') or prompt(ui, 'Subject:', 'A bundle for your repository')) body = _getdescription(repo, '', sender, **opts) msg = emailmod.MIMEMultipart.MIMEMultipart() if body: -msg.attach(mail.mimeencode(ui, body, _charsets, opts.get('test'))) +msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(r'test'))) datapart = emailmod.MIMEBase.MIMEBase('application', 'x-mercurial-bundle') datapart.set_payload(bundle) -bundlename = '%s.hg' % opts.get('bundlename', 'bundle') +bundlename = '%s.hg' % opts.get(r'bundlename', 'bundle') datapart.add_header('Content-Disposition', 'attachment', filename=bundlename) emailmod.Encoders.encode_base64(datapart) msg.attach(datapart) -msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get('test')) +msg['Subject'] = mail.headencode(ui, subj, _charsets, opts.get(r'test')) return [(msg, subj, None)] def _makeintro(repo, sender, revs, patches, **opts): @@ -384,27 +385,27 @@ _charsets = mail._charsets(ui) # use the last revision which is likely to be a bookmarked head -prefix = _formatprefix(ui, repo, revs.last(), opts.get('flag'), +prefix = _formatprefix(ui, repo, revs.last(), opts.get(r'flag'), 0, len(patches), numbered=True) -subj = (opts.get('subject') or +subj = (opts.get(r'subject') or prompt(ui, '(optional) Subject: ', rest=prefix, default='')) if not subj: return None # skip intro if the user doesn't bother subj = prefix + ' ' + subj body = '' -if opts.get('diffstat'): +if opts.get(r'diffstat'): # generate a cumulative diffstat of the whole patch series diffstat = patch.diffstat(sum(patches, [])) body = '\n' + diffstat else: diffstat = None body = _getdescription(repo, body, sender, **opts) -msg = mail.mimeencode(ui, body, _charsets, opts.get('test')) +msg = mail.mimeencode(ui, body, _charsets, opts.get(r'test')) msg['Subject'] = mail.headencode(ui, subj, _charsets, - opts.get('test')) + opts.get(r'test')) return (msg, subj, diffstat) def _getpatchmsgs(repo, sender, revs, patchnames=None, **opts): @@ -414,6 +415,7 @@ This function returns a list of "email" tuples (subject, content, None). """ +bytesopts = pycompat.byteskwargs(opts) ui = repo.ui _charsets = mail._charsets(ui) patches = list(_getpatches(repo, revs, **opts)) @@ -423,7 +425,7 @@ % len(patches)) # build the intro message, or skip it if the user declines -if introwanted(ui, opts, len(patches)): +if introwanted(ui, bytesopts, len(patches)): msg = _makeintro(repo, sender, revs, patches, **opts) if msg: msgs.append(msg) @@ -437,8 +439,8 @@ for i, (r, p) in enumerate(zip(revs, patches)): if patchnames: name = patchnames[i] -msg = makepatch(ui, repo, r, p, opts, _charsets, i + 1, -len(patches), numbered, name) +msg = makepatch(ui, repo, r, p, bytesopts, _charsets, +i + 1, len(patches), numbered, name) msgs.append(msg) return msgs @@ -579,6 +581,7 @@ Before using this command, you will need to enable email in your hgrc. See the [email] section in hgrc(5) for details. ''' +opts = pycompat.byteskwargs(opts) _charsets = mail._charsets(ui) @@ -672,12 +675,13 @@ prompt(ui, 'From', ui.username())) if bundle: -bundledata = _getbundle(repo, dest, **opts) -
D1332: cmdutil: create dirs for templated cat file output
This revision was automatically updated to reflect the committed changes. Closed by commit rHG407ec7f3ff02: cmdutil: create dirs for templated cat file output (authored by ryanmce, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1332?vs=3326=3373 REVISION DETAIL https://phab.mercurial-scm.org/D1332 AFFECTED FILES mercurial/cmdutil.py tests/test-cat.t CHANGE DETAILS diff --git a/tests/test-cat.t b/tests/test-cat.t --- a/tests/test-cat.t +++ b/tests/test-cat.t @@ -126,7 +126,6 @@ $ echo a > foo/a $ hg add foo/a $ hg commit -qm "add foo/a" - $ mkdir output $ hg cat --output "output/%p" foo/a - abort: No such file or directory: output/foo/a - [255] + $ cat output/foo/a + a diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3029,6 +3029,11 @@ if fntemplate: filename = makefilename(repo, fntemplate, ctx.node(), pathname=os.path.join(prefix, path)) +# attempt to create the directory if it does not already exist +try: +os.makedirs(os.path.dirname(filename)) +except OSError: +pass with formatter.maybereopen(basefm, filename, opts) as fm: data = ctx[path].data() if opts.get('decode'): To: ryanmce, #hg-reviewers, mbthomas, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1331: cat: test output path behvaior when target path does not exist
This revision was automatically updated to reflect the committed changes. Closed by commit rHG8154119ed236: cat: test output path behvaior when target path does not exist (authored by ryanmce, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1331?vs=3325=3372 REVISION DETAIL https://phab.mercurial-scm.org/D1331 AFFECTED FILES tests/test-cat.t CHANGE DETAILS diff --git a/tests/test-cat.t b/tests/test-cat.t --- a/tests/test-cat.t +++ b/tests/test-cat.t @@ -119,3 +119,14 @@ $ PATTERN='t4' hg log -r '.' -T "{envvars % '{key} -> {value}\n'}" \ > --config "experimental.exportableenviron=PATTERN" PATTERN -> t4 + +Test behavior of output when directory structure does not already exist + + $ mkdir foo + $ echo a > foo/a + $ hg add foo/a + $ hg commit -qm "add foo/a" + $ mkdir output + $ hg cat --output "output/%p" foo/a + abort: No such file or directory: output/foo/a + [255] To: ryanmce, #hg-reviewers, mbthomas, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1311: scmutil: don't try to delete origbackup symlinks to directories (issue5731)
This revision was automatically updated to reflect the committed changes. Closed by commit rHG99ab7bc944d2: scmutil: dont try to delete origbackup symlinks to directories (issue5731) (authored by mbthomas, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1311?vs=3265=3370 REVISION DETAIL https://phab.mercurial-scm.org/D1311 AFFECTED FILES mercurial/scmutil.py tests/test-origbackup-conflict.t CHANGE DETAILS diff --git a/tests/test-origbackup-conflict.t b/tests/test-origbackup-conflict.t --- a/tests/test-origbackup-conflict.t +++ b/tests/test-origbackup-conflict.t @@ -110,18 +110,12 @@ creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) getting d - removing conflicting directory: $TESTTMP/repo/.hg/origbackups/d (glob) - abort: None - [255] - -Workaround issue by deleting d: - - $ rm d - $ hg up c1 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark c1) $ cat .hg/origbackups/b/c c4 + $ cat .hg/origbackups/d + d3 $ ls ../sym-link-target Incorrectly configure origbackuppath to be under a file diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -610,7 +610,7 @@ origvfs.makedirs(origbackupdir) -if origvfs.isdir(filepathfromroot): +if origvfs.isdir(filepathfromroot) and not origvfs.islink(filepathfromroot): ui.note(_('removing conflicting directory: %s\n') % origvfs.join(filepathfromroot)) origvfs.rmtree(filepathfromroot, forcibly=True) To: mbthomas, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1310: tests: add a test demonstrating issue5731
This revision was automatically updated to reflect the committed changes. Closed by commit rHGad671b4cb9fc: tests: add a test demonstrating issue5731 (authored by mbthomas, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1310?vs=3264=3369 REVISION DETAIL https://phab.mercurial-scm.org/D1310 AFFECTED FILES tests/test-origbackup-conflict.t CHANGE DETAILS diff --git a/tests/test-origbackup-conflict.t b/tests/test-origbackup-conflict.t --- a/tests/test-origbackup-conflict.t +++ b/tests/test-origbackup-conflict.t @@ -12,11 +12,12 @@ $ hg add base $ hg commit -m "base" -Make a dir named b that contains a file +Make a dir named b that contains a file, and a file named d $ mkdir -p b $ echo c1 > b/c - $ hg add b/c + $ echo d1 > d + $ hg add b/c d $ hg commit -m "c1" $ hg bookmark c1 @@ -30,15 +31,17 @@ b/c: replacing untracked file getting b/c creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting d + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark c1) $ test -f .hg/origbackups/b/c -Make a file named b +Make files named b and d $ hg up -q 0 $ echo b1 > b - $ hg add b + $ echo d2 > d + $ hg add b d $ hg commit -m b1 created new head $ hg bookmark b1 @@ -52,7 +55,8 @@ b: replacing untracked file getting b removing conflicting directory: $TESTTMP/repo/.hg/origbackups/b (glob) - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting d + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark b1) $ test -f .hg/origbackups/b @@ -67,40 +71,54 @@ getting b/c creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting d + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark c1) $ test -d .hg/origbackups/b -Cause a symlink to be backed up that points to a valid location from the backup dir +Cause two symlinks to be backed up that points to a valid location from the backup dir $ hg up -q 0 $ mkdir ../sym-link-target #if symlink $ ln -s ../../../sym-link-target b + $ ln -s ../../../sym-link-target d #else - $ touch b + $ touch b d #endif $ hg up b1 b: replacing untracked file - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + d: replacing untracked file + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark b1) #if symlink $ readlink.py .hg/origbackups/b .hg/origbackups/b -> ../../../sym-link-target #endif -Perform an update that causes b/c to be backed up again - it should not go into the target dir +Perform an update that causes b/c and d to be backed up again - b/c should not go into the target dir $ hg up -q 0 $ mkdir b $ echo c4 > b/c + $ echo d3 > d $ hg up --verbose c1 resolving manifests b/c: replacing untracked file + d: replacing untracked file getting b/c creating directory: $TESTTMP/repo/.hg/origbackups/b (glob) removing conflicting file: $TESTTMP/repo/.hg/origbackups/b (glob) - 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + getting d + removing conflicting directory: $TESTTMP/repo/.hg/origbackups/d (glob) + abort: None + [255] + +Workaround issue by deleting d: + + $ rm d + $ hg up c1 + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved (activating bookmark c1) $ cat .hg/origbackups/b/c c4 To: mbthomas, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1321: py3: handle keyword arguments in hgext/rebase.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1a07f9187831: py3: handle keyword arguments in hgext/rebase.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1321?vs=3284=3365 REVISION DETAIL https://phab.mercurial-scm.org/D1321 AFFECTED FILES hgext/rebase.py CHANGE DETAILS diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -43,6 +43,7 @@ obsutil, patch, phases, +pycompat, registrar, repair, revset, @@ -698,6 +699,7 @@ unresolved conflicts. """ +opts = pycompat.byteskwargs(opts) rbsrt = rebaseruntime(repo, ui, opts) with repo.wlock(), repo.lock(): @@ -1552,15 +1554,15 @@ def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' ret = None -if opts.get('rebase'): +if opts.get(r'rebase'): if ui.configbool('commands', 'rebase.requiredest'): msg = _('rebase destination required by configuration') hint = _('use hg pull followed by hg rebase -d DEST') raise error.Abort(msg, hint=hint) with repo.wlock(), repo.lock(): -if opts.get('update'): -del opts['update'] +if opts.get(r'update'): +del opts[r'update'] ui.debug('--update and --rebase are not compatible, ignoring ' 'the update flag\n') @@ -1581,15 +1583,15 @@ if revspostpull > revsprepull: # --rev option from pull conflict with rebase own --rev # dropping it -if 'rev' in opts: -del opts['rev'] +if r'rev' in opts: +del opts[r'rev'] # positional argument from pull conflicts with rebase's own # --source. -if 'source' in opts: -del opts['source'] +if r'source' in opts: +del opts[r'source'] # revsprepull is the len of the repo, not revnum of tip. destspace = list(repo.changelog.revs(start=revsprepull)) -opts['_destspace'] = destspace +opts[r'_destspace'] = destspace try: rebase(ui, repo, **opts) except error.NoMergeDestAbort: @@ -1603,7 +1605,7 @@ # with warning and trumpets commands.update(ui, repo) else: -if opts.get('tool'): +if opts.get(r'tool'): raise error.Abort(_('--tool can only be used with --rebase')) ret = orig(ui, repo, *args, **opts) To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1324: py3: handle keyword arguments in hgext/shelve.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaad6b9fdfc75: py3: handle keyword arguments in hgext/shelve.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1324?vs=3287=3368 REVISION DETAIL https://phab.mercurial-scm.org/D1324 AFFECTED FILES hgext/shelve.py CHANGE DETAILS diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -43,6 +43,7 @@ node as nodemod, patch, phases, +pycompat, registrar, repair, scmutil, @@ -380,15 +381,16 @@ editor_ = False if editor: editor_ = cmdutil.getcommiteditor(editform='shelve.shelve', - **opts) + **pycompat.strkwargs(opts)) with repo.ui.configoverride(overrides): return repo.commit(message, shelveuser, opts.get('date'), match, editor=editor_, extra=extra) finally: if hasmq: repo.mq.checkapplied = saved def interactivecommitfunc(ui, repo, *pats, **opts): +opts = pycompat.byteskwargs(opts) match = scmutil.match(repo['.'], pats, {}) message = opts['message'] return commitfunc(ui, repo, message, match, opts) @@ -465,7 +467,7 @@ else: node = cmdutil.dorecord(ui, repo, commitfunc, None, False, cmdutil.recordfilter, *pats, -**opts) +**pycompat.strkwargs(opts)) if not node: _nothingtoshelvemessaging(ui, repo, pats, opts) return 1 @@ -852,6 +854,7 @@ return _dounshelve(ui, repo, *shelved, **opts) def _dounshelve(ui, repo, *shelved, **opts): +opts = pycompat.byteskwargs(opts) abortf = opts.get('abort') continuef = opts.get('continue') if not abortf and not continuef: @@ -1010,6 +1013,7 @@ To delete specific shelved changes, use ``--delete``. To delete all shelved changes, use ``--cleanup``. ''' +opts = pycompat.byteskwargs(opts) allowables = [ ('addremove', {'create'}), # 'create' is pseudo action ('unknown', {'create'}), To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1320: py3: handle keyword arguments in hgext/keyword.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3fbc30f7b9f0: py3: handle keyword arguments in hgext/keyword.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1320?vs=3283=3364 REVISION DETAIL https://phab.mercurial-scm.org/D1320 AFFECTED FILES hgext/keyword.py CHANGE DETAILS diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -104,6 +104,7 @@ match, patch, pathutil, +pycompat, registrar, scmutil, templatefilters, @@ -380,6 +381,7 @@ '''Bails out if [keyword] configuration is not active. Returns status of working directory.''' if kwt: +opts = pycompat.byteskwargs(opts) return repo.status(match=scmutil.match(wctx, pats, opts), clean=True, unknown=opts.get('unknown') or opts.get('all')) if ui.configitems('keyword'): @@ -436,24 +438,24 @@ ui.setconfig('keywordset', 'svn', svn, 'keyword') uikwmaps = ui.configitems('keywordmaps') -if args or opts.get('rcfile'): +if args or opts.get(r'rcfile'): ui.status(_('\n\tconfiguration using custom keyword template maps\n')) if uikwmaps: ui.status(_('\textending current template maps\n')) -if opts.get('default') or not uikwmaps: +if opts.get(r'default') or not uikwmaps: if svn: ui.status(_('\toverriding default svn keywordset\n')) else: ui.status(_('\toverriding default cvs keywordset\n')) -if opts.get('rcfile'): +if opts.get(r'rcfile'): ui.readconfig(opts.get('rcfile')) if args: # simulate hgrc parsing rcmaps = '[keywordmaps]\n%s\n' % '\n'.join(args) repo.vfs.write('hgrc', rcmaps) ui.readconfig(repo.vfs.join('hgrc')) kwmaps = dict(ui.configitems('keywordmaps')) -elif opts.get('default'): +elif opts.get(r'default'): if svn: ui.status(_('\n\tconfiguration using default svn keywordset\n')) else: @@ -543,6 +545,7 @@ else: cwd = '' files = [] +opts = pycompat.byteskwargs(opts) if not opts.get('unknown') or opts.get('all'): files = sorted(status.modified + status.added + status.clean) kwfiles = kwt.iskwfile(files, wctx) To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1322: py3: handle keyword arguments in hgext/releasenotes.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe68dd1909af3: py3: handle keyword arguments in hgext/releasenotes.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1322?vs=3285=3366 REVISION DETAIL https://phab.mercurial-scm.org/D1322 AFFECTED FILES hgext/releasenotes.py CHANGE DETAILS diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -25,6 +25,7 @@ error, minirst, node, +pycompat, registrar, scmutil, util, @@ -570,6 +571,8 @@ admonitions along with their title. This also includes the custom admonitions (if any). """ + +opts = pycompat.byteskwargs(opts) sections = releasenotessections(ui, repo) listflag = opts.get('list') To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1323: py3: handle keyword arguments in hgext/uncommit.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG3ebae3ec4664: py3: handle keyword arguments in hgext/uncommit.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1323?vs=3286=3367 REVISION DETAIL https://phab.mercurial-scm.org/D1323 AFFECTED FILES hgext/uncommit.py CHANGE DETAILS diff --git a/hgext/uncommit.py b/hgext/uncommit.py --- a/hgext/uncommit.py +++ b/hgext/uncommit.py @@ -29,6 +29,7 @@ error, node, obsolete, +pycompat, registrar, scmutil, ) @@ -152,6 +153,7 @@ deleted in the changeset will be left unchanged, and so will remain modified in the working directory. """ +opts = pycompat.byteskwargs(opts) with repo.wlock(), repo.lock(): wctx = repo[None] To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1318: py3: handle keyword arguments in hgext/histedit.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc4b769bc86da: py3: handle keyword arguments in hgext/histedit.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1318?vs=3281=3362 REVISION DETAIL https://phab.mercurial-scm.org/D1318 AFFECTED FILES hgext/histedit.py CHANGE DETAILS diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -203,6 +203,7 @@ mergeutil, node, obsolete, +pycompat, registrar, repair, scmutil, @@ -541,9 +542,9 @@ def commitfunc(**kwargs): overrides = {('phases', 'new-commit'): phasemin} with repo.ui.configoverride(overrides, 'histedit'): -extra = kwargs.get('extra', {}).copy() +extra = kwargs.get(r'extra', {}).copy() extra['histedit_source'] = src.hex() -kwargs['extra'] = extra +kwargs[r'extra'] = extra return repo.commit(**kwargs) return commitfunc @@ -1093,6 +1094,7 @@ _('histedit requires exactly one ancestor revision')) def _histedit(ui, repo, state, *freeargs, **opts): +opts = pycompat.byteskwargs(opts) goal = _getgoal(opts) revs = opts.get('rev', []) rules = opts.get('commands', '') To: pulkit, durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1317: py3: handle keyword arguments in hgext/hgk.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfc0e6d298cd4: py3: handle keyword arguments in hgext/hgk.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1317?vs=3280=3361 REVISION DETAIL https://phab.mercurial-scm.org/D1317 AFFECTED FILES hgext/hgk.py CHANGE DETAILS diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -48,6 +48,7 @@ commands, obsolete, patch, +pycompat, registrar, scmutil, util, @@ -79,6 +80,7 @@ inferrepo=True) def difftree(ui, repo, node1=None, node2=None, *files, **opts): """diff trees from two commits""" + def __difftree(repo, node1, node2, files=None): assert node2 is not None if files is None: @@ -102,7 +104,7 @@ ## while True: -if opts['stdin']: +if opts[r'stdin']: try: line = util.bytesinput(ui.fin, ui.fout).split(' ') node1 = line[0] @@ -118,8 +120,8 @@ else: node2 = node1 node1 = repo.changelog.parents(node1)[0] -if opts['patch']: -if opts['pretty']: +if opts[r'patch']: +if opts[r'pretty']: catcommit(ui, repo, node2, "") m = scmutil.match(repo[node1], files) diffopts = patch.difffeatureopts(ui) @@ -130,7 +132,7 @@ ui.write(chunk) else: __difftree(repo, node1, node2, files=files) -if not opts['stdin']: +if not opts[r'stdin']: break def catcommit(ui, repo, n, prefix, ctx=None): @@ -183,7 +185,7 @@ # strings # prefix = "" -if opts['stdin']: +if opts[r'stdin']: try: (type, r) = util.bytesinput(ui.fin, ui.fout).split(' ') prefix = "" @@ -201,7 +203,7 @@ return 1 n = repo.lookup(r) catcommit(ui, repo, n, prefix) -if opts['stdin']: +if opts[r'stdin']: try: (type, r) = util.bytesinput(ui.fin, ui.fout).split(' ') except EOFError: @@ -340,14 +342,15 @@ else: full = None copy = [x for x in revs] -revtree(ui, copy, repo, full, opts['max_count'], opts['parents']) +revtree(ui, copy, repo, full, opts[r'max_count'], opts[r'parents']) @command('view', [('l', 'limit', '', _('limit number of changes displayed'), _('NUM'))], _('[-l LIMIT] [REVRANGE]')) def view(ui, repo, *etc, **opts): "start interactive history viewer" +opts = pycompat.byteskwargs(opts) os.chdir(repo.root) optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v]) if repo.filtername is None: To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1316: py3: handle keyword arguments in hgext/graphlog.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0c9ba2ac60a8: py3: handle keyword arguments in hgext/graphlog.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1316?vs=3279=3360 REVISION DETAIL https://phab.mercurial-scm.org/D1316 AFFECTED FILES hgext/graphlog.py CHANGE DETAILS diff --git a/hgext/graphlog.py b/hgext/graphlog.py --- a/hgext/graphlog.py +++ b/hgext/graphlog.py @@ -66,5 +66,5 @@ This is an alias to :hg:`log -G`. """ -opts['graph'] = True +opts[r'graph'] = True return commands.log(ui, repo, *pats, **opts) To: pulkit, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] debuglocks: allow setting a lock
On Wed, 08 Nov 2017 21:16:55 +0100, Paul Morelle wrote: > # HG changeset patch > # User Paul Morelle> # Date 1510071568 -3600 > # Tue Nov 07 17:19:28 2017 +0100 > # Node ID 5300b33397d0651eb2457502204969585d492cc5 > # Parent 602c168c0207c443ac61f7a7c727b31cfb0b86ad > # EXP-Topic debugsetlocks > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 5300b33397d0 > debuglocks: allow setting a lock > def debuglocks(ui, repo, **opts): > """show or modify state of locks > @@ -1192,6 +1195,10 @@ > instance, on a shared filesystem). Removing locks may also be > blocked by filesystem permissions. > > +Setting a lock will prevent other commands from changing the data. > +The command will wait until an interruption (SIGINT, SIGTERM, ...) > occurs. > +The set lock(s) is (are) removed when the command exits. Nit: I think we generally use plural form instead of singular/plural pairs. > +locks = [] > +if opts.get(r'set_wlock'): > +try: > +locks.append(repo.wlock(False)) > +except error.LockHeld: > +raise error.Abort(_('wlock is already held')) > +if opts.get(r'set_lock'): > +try: > +locks.append(repo.lock(False)) > +except error.LockHeld: > +raise error.Abort(_('lock is already held')) This should be wrapped by try-finally. Otherwise locks wouldn't be released depending on when Ctrl-C is triggered. > +if len(locks): > +try: > +while True: > +time.sleep(60) > +except: Naked except: block is discouraged. > +for lock in locks: > +lock.release() > +raise Perhaps this should be moved to finally block. And you can use lockmod.release() helper. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] debugdeltachain: output information about sparse read if enabled
On Wed, 08 Nov 2017 21:12:57 +0100, Paul Morelle wrote: > # HG changeset patch > # User Paul Morelle> # Date 1509002829 -7200 > # Thu Oct 26 09:27:09 2017 +0200 > # Node ID 13a6c881be35e7651a12f8c3442abfade2b77c88 > # Parent 602c168c0207c443ac61f7a7c727b31cfb0b86ad > # EXP-Topic debugdeltachain > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 13a6c881be35 > debugdeltachain: output information about sparse read if enabled Looks good, but check-code failed. And can you add some tests? > +fmargs = (rev, chainid, len(chain), prevrev, deltatype, comp, > + uncomp, chainsize, chainratio, lineardist, extradist, > + extraratio) > +fmkwargs = dict(rev=rev, chainid=chainid, chainlen=len(chain), > +prevrev=prevrev, deltatype=deltatype, compsize=comp, > +uncompsize=uncomp, chainsize=chainsize, > +chainratio=chainratio, lindist=lineardist, > +extradist=extradist, extraratio=extraratio) test-check-code.t says hi. + mercurial/debugcommands.py:675: + > fmkwargs = dict(rev=rev, chainid=chainid, chainlen=len(chain), + dict() is different in Py2 and 3 and is slower than {} FWIW, I don't know what's the purpose of this fmkwargs dict. > +if withsparseread: > +readsize = 0 > +largestblock = 0 > +for revschunk in revlog._slicechunk(r, chain): > +blkend = start(revschunk[-1]) + length(revschunk[-1]) > +blksize = blkend - start(revschunk[0]) > + > +readsize += blksize > +if largestblock < blksize: > +largestblock = blksize > + > +readdensity = float(chainsize) / float(readsize) > + > +fmargs += (readsize, largestblock, readdensity) > +fmkwargs.update(readsize=readsize, largestblock=largestblock, > +readdensity=readdensity) > + > fm.startitem() > -fm.write('rev chainid chainlen prevrev deltatype compsize ' > - 'uncompsize chainsize chainratio lindist extradist ' > - 'extraratio', > - '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n', > - rev, chainid, len(chain), prevrev, deltatype, comp, > - uncomp, chainsize, chainratio, lineardist, extradist, > - extraratio, > - rev=rev, chainid=chainid, chainlen=len(chain), > - prevrev=prevrev, deltatype=deltatype, compsize=comp, > - uncompsize=uncomp, chainsize=chainsize, > - chainratio=chainratio, lindist=lineardist, > - extradist=extradist, extraratio=extraratio) > +fm.write(fmfields, fmformats + '\n', *fmargs, **fmkwargs) Alternatively, this could be split to two write() calls. fm.write(...) if withsparseread: fm.write(...) fm.plain('\n') ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1270: help: adding a topic on flags
rdamazio marked 4 inline comments as done. rdamazio added inline comments. INLINE COMMENTS > martinvonz wrote in flags.txt:67 > Do we recommend overriding the command like this or should the left side be > called something else (maybe "icommit")? I really don't know what we > recommend here, so don't take my question to imply that you shouldn't do it > the way you have done it. That's my interpretation of what "hg help commit" says, but if you want me to change it let me know. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1270 To: rdamazio, #hg-reviewers Cc: av6, dlax, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1336: HG: hg rm -A option prints the message of every file in the repo
mitrandir added a comment. @mharbison72: the problem is that `hg rm -A` prints a line for every file in the repo even if you didn't touch anything. With a clean working directory in a repo with 10k files, 10k lines will be printed. The lines look like: not removing : file still exists REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1336 To: pavanpc, #hg-reviewers Cc: mitrandir, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1270: help: adding a topic on flags
rdamazio updated this revision to Diff 3359. rdamazio marked 4 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D1270?vs=3334=3359 REVISION DETAIL https://phab.mercurial-scm.org/D1270 AFFECTED FILES contrib/wix/help.wxs mercurial/help.py mercurial/help/flags.txt tests/test-globalopts.t tests/test-help.t tests/test-hgweb-json.t CHANGE DETAILS diff --git a/tests/test-hgweb-json.t b/tests/test-hgweb-json.t --- a/tests/test-hgweb-json.t +++ b/tests/test-hgweb-json.t @@ -1581,6 +1581,10 @@ "topic": "filesets" }, { +"summary": "Command-line flags", +"topic": "flags" + }, + { "summary": "Glossary", "topic": "glossary" }, diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -110,6 +110,7 @@ environment Environment Variables extensionsUsing Additional Features filesets Specifying File Sets + flags Command-line flags glossary Glossary hgignore Syntax for Mercurial Ignore Files hgweb Configuring hgweb @@ -188,6 +189,7 @@ environment Environment Variables extensionsUsing Additional Features filesets Specifying File Sets + flags Command-line flags glossary Glossary hgignore Syntax for Mercurial Ignore Files hgweb Configuring hgweb @@ -865,6 +867,7 @@ environment Environment Variables extensionsUsing Additional Features filesets Specifying File Sets + flags Command-line flags glossary Glossary hgignore Syntax for Mercurial Ignore Files hgweb Configuring hgweb @@ -2013,6 +2016,13 @@ Specifying File Sets + + flags + + + Command-line flags + + glossary diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -355,6 +355,7 @@ environment Environment Variables extensionsUsing Additional Features filesets Specifying File Sets + flags Command-line flags glossary Glossary hgignore Syntax for Mercurial Ignore Files hgweb Configuring hgweb @@ -439,6 +440,7 @@ environment Environment Variables extensionsUsing Additional Features filesets Specifying File Sets + flags Command-line flags glossary Glossary hgignore Syntax for Mercurial Ignore Files hgweb Configuring hgweb diff --git a/mercurial/help/flags.txt b/mercurial/help/flags.txt new file mode 100644 --- /dev/null +++ b/mercurial/help/flags.txt @@ -0,0 +1,107 @@ +Most Mercurial commands accept various flags. + +Flag names +== + +Flags for each command are listed in :hg:`help` for that command. +Additionally, some flags, such as --repository, are global and can be used with +any command - those are seen in :hg:`help -v`, and can be specified before or +after the command. + +Every flag has at least a long name, such as --repository. Some flags may also +have a short one-letter name, such as the equivalent -R. Using the short or long +name is equivalent and has the same effect. + +Flags that have a short name can also be bundled together - for instance, to +specify both --edit (short -e) and --interactive (short -i), one could use:: + +hg commit -ei + +If any of the bundled flags takes a value (i.e. is not a boolean), it must be +last, followed by the value:: + +hg commit -im 'Message' + +Flag types +== + +Mercurial command-line flags can be strings, numbers, booleans, or lists of +strings. + +Specifying flag values +== + +The following syntaxes are allowed, assuming a flag 'flagname' with short name +'f':: + +--flagname=foo +--flagname foo +-f=foo +-f foo +-ffoo + +This syntax applies to all non-boolean flags (strings, numbers or lists). + +Specifying boolean flags + + +Boolean flags do not take a value parameter. To specify a boolean, use the flag +name to set it to true, or the same name prefixed with 'no-' to set it to +false:: + +hg commit --interactive +hg commit --no-interactive + +Specifying list flags += + +List flags take multiple values. To specify them, pass the flag multiple times:: + +hg files --include mercurial --include tests + +Setting flag defaults += + +In order to set a default value for a flag in an hgrc file, it is recommended to +use aliases:: + +[alias] +commit = commit --interactive + +For more information on hgrc files, see :hg:`help config`. + +Overriding flags on the command line + + +If the same non-list flag is specified multiple times on the command line, the +latest specification is used:: + +hg commit -m "Ignored value" -m "Used value" + +This