D7764: revset: drop some unused code in the `remote` revset

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  PyCharm flagged the `revs = [..]` as an unused assignment.  But then neither
  `revs` nor `checkout` is used, and I can't see where `hg.addbranchrevs()` has
  external side effects.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7764

AFFECTED FILES
  mercurial/revset.py

CHANGE DETAILS

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2025,9 +2025,7 @@
 dest = getstring(l[1], _(b"remote requires a repository path"))
 dest = repo.ui.expandpath(dest or b'default')
 dest, branches = hg.parseurl(dest)
-revs, checkout = hg.addbranchrevs(repo, repo, branches, [])
-if revs:
-revs = [repo.lookup(rev) for rev in revs]
+
 other = hg.peer(repo, {}, dest)
 n = other.lookup(q)
 if n in repo:



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7762: histedit: avoid using a list comprehension to fill a list with fixed values

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm as an unused assignment for the variable in the list.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7762

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
@@ -308,7 +308,7 @@
 if len(a.verbs):
 v = b', '.join(sorted(a.verbs, key=lambda v: len(v)))
 actions.append(b" %s = %s" % (v, lines[0]))
-actions.extend([b'  %s' for l in lines[1:]])
+actions.extend([b'  %s'] * (len(lines) - 1))
 
 for v in (
 sorted(primaryactions)



To: mharbison72, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7763: tests: avoid using a list comprehension to fill a list with fixed values

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm as an unused assignment for the variable in the list.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7763

AFFECTED FILES
  tests/test-cbor.py

CHANGE DETAILS

diff --git a/tests/test-cbor.py b/tests/test-cbor.py
--- a/tests/test-cbor.py
+++ b/tests/test-cbor.py
@@ -1230,7 +1230,7 @@
 True,
 False,
 None,
-[None for i in range(128)],
+[None] * 128,
 ]
 
 encoded = b''.join(cborutil.streamencode(source))



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7753: annotate: avoid using a list comprehension to fill a list with fixed values

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm as an unused assignment for the variable in the list.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7753

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
@@ -559,7 +559,7 @@
 ml = max(sizes)
 formats.append([sep + b' ' * (ml - w) + b'%s' for w in sizes])
 else:
-formats.append([b'%s' for x in l])
+formats.append([b'%s'] * len(l))
 pieces.append(l)
 
 for f, p, n in zip(zip(*formats), zip(*pieces), lines):



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7755: mq: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm.  This variable is the index of a `for` loop below.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7755

AFFECTED FILES
  hgext/mq.py

CHANGE DETAILS

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -2256,7 +2256,6 @@
 def restore(self, repo, rev, delete=None, qupdate=None):
 desc = repo[rev].description().strip()
 lines = desc.splitlines()
-i = 0
 datastart = None
 series = []
 applied = []



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7759: ui: delete local variables instead of setting to `None`

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The previous code was flagged by PyCharm as an unused variable assignment.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7759

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -2032,7 +2032,10 @@
 self.log(
 b'develwarn', b'%s at: %s:%d (%s)\n', msg, fname, lineno, fmsg
 )
-curframe = calframe = None  # avoid cycles
+
+# avoid cycles
+del curframe
+del calframe
 
 def deprecwarn(self, msg, version, stacklevel=2):
 """issue a deprecation warning



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7761: hgweb: delete a local variable instead of setting to `None`

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The previous code was flagged by PyCharm as an unused variable assignment.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7761

AFFECTED FILES
  mercurial/hgweb/wsgicgi.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/wsgicgi.py b/mercurial/hgweb/wsgicgi.py
--- a/mercurial/hgweb/wsgicgi.py
+++ b/mercurial/hgweb/wsgicgi.py
@@ -77,7 +77,7 @@
 # Re-raise original exception if headers sent
 raise exc_info[0](exc_info[1], exc_info[2])
 finally:
-exc_info = None  # avoid dangling circular ref
+del exc_info  # avoid dangling circular ref
 elif headers_set:
 raise AssertionError(b"Headers already set!")
 



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7760: tests: drop unused local variable assignments in linelog

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7760

AFFECTED FILES
  tests/test-linelog.py

CHANGE DETAILS

diff --git a/tests/test-linelog.py b/tests/test-linelog.py
--- a/tests/test-linelog.py
+++ b/tests/test-linelog.py
@@ -172,7 +172,7 @@
 ll.replacelines_vec(rev, a1, a2, blines)
 else:
 ll.replacelines(rev, a1, a2, b1, b2)
-ar = ll.annotate(rev)
+ll.annotate(rev)
 self.assertEqual(ll.annotateresult, lines)
 # Verify we can get back these states by annotating each rev
 for lines, rev, a1, a2, b1, b2, blines, usevec in _genedits(



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7758: tests: drop unused local variable assignments in remotefilelog

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7758

AFFECTED FILES
  tests/test-remotefilelog-datapack.py
  tests/test-remotefilelog-histpack.py

CHANGE DETAILS

diff --git a/tests/test-remotefilelog-histpack.py 
b/tests/test-remotefilelog-histpack.py
--- a/tests/test-remotefilelog-histpack.py
+++ b/tests/test-remotefilelog-histpack.py
@@ -252,7 +252,7 @@
 f.write(raw)
 
 try:
-pack = historypack.historypack(pack.path)
+historypack.historypack(pack.path)
 self.assertTrue(False, "bad version number should have thrown")
 except RuntimeError:
 pass
diff --git a/tests/test-remotefilelog-datapack.py 
b/tests/test-remotefilelog-datapack.py
--- a/tests/test-remotefilelog-datapack.py
+++ b/tests/test-remotefilelog-datapack.py
@@ -237,7 +237,7 @@
 f.write(raw)
 
 try:
-pack = self.datapackreader(pack.path)
+self.datapackreader(pack.path)
 self.assertTrue(False, "bad version number should have thrown")
 except RuntimeError:
 pass



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7757: fastannotate: drop unused local variable assignments

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7757

AFFECTED FILES
  hgext/fastannotate/support.py

CHANGE DETAILS

diff --git a/hgext/fastannotate/support.py b/hgext/fastannotate/support.py
--- a/hgext/fastannotate/support.py
+++ b/hgext/fastannotate/support.py
@@ -74,7 +74,6 @@
 may raise Exception, and always return line numbers.
 """
 master = _getmaster(fctx)
-annotated = contents = None
 
 with context.fctxannotatecontext(fctx, follow, diffopts) as ac:
 try:



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7756: fsmonitor: drop an unused local variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7756

AFFECTED FILES
  hgext/fsmonitor/pywatchman/pybser.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/pywatchman/pybser.py 
b/hgext/fsmonitor/pywatchman/pybser.py
--- a/hgext/fsmonitor/pywatchman/pybser.py
+++ b/hgext/fsmonitor/pywatchman/pybser.py
@@ -506,7 +506,6 @@
 
 
 def _pdu_info_helper(buf):
-bser_version = -1
 if buf[0:2] == EMPTY_HEADER[0:2]:
 bser_version = 1
 bser_capabilities = 0



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7754: hgweb: delete local variable instead of setting it to `None`

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The previous code was flagged by PyCharm as an unused variable assignment.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7754

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -486,7 +486,7 @@
 )
 return res.sendresponse()
 finally:
-tmpl = None
+del tmpl
 
 def makeindex(self, req, res, tmpl, subdir=b""):
 self.refresh()



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7751: absorb: avoid using a list comprehension to fill a list with fixed values

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm as an unused assignment for the variable in the list.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7751

AFFECTED FILES
  hgext/absorb.py

CHANGE DETAILS

diff --git a/hgext/absorb.py b/hgext/absorb.py
--- a/hgext/absorb.py
+++ b/hgext/absorb.py
@@ -511,7 +511,7 @@
 if not editedtext:
 raise error.Abort(_(b'empty editor text'))
 # parse edited result
-contents = [b'' for i in self.fctxs]
+contents = [b''] * len(self.fctxs)
 leftpadpos = 4
 colonpos = leftpadpos + len(visiblefctxs) + 1
 for l in mdiff.splitnewlines(editedtext):



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7752: fsmonitor: drop an unused local variable

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Flagged by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7752

AFFECTED FILES
  hgext/fsmonitor/pywatchman/capabilities.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/pywatchman/capabilities.py 
b/hgext/fsmonitor/pywatchman/capabilities.py
--- a/hgext/fsmonitor/pywatchman/capabilities.py
+++ b/hgext/fsmonitor/pywatchman/capabilities.py
@@ -62,7 +62,7 @@
 vers["capabilities"] = {}
 for name in opts["optional"]:
 vers["capabilities"][name] = check(parsed_version, name)
-failed = False  # noqa: F841 T25377293 Grandfathered in
+
 for name in opts["required"]:
 have = check(parsed_version, name)
 vers["capabilities"][name] = have



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7705: phases: make the working directory consistently a draft

2019-12-27 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  In D7705#113845 , @marmoute 
wrote:
  
  > I simply sent this. If am I following your changeset right, we should have 
`wdir()` match `draft()` or `secret()` according to the projected phase (config 
+ parent)
  
  I don't understand what you're asking me to do here, can you clarify?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7705/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7705

To: rdamazio, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7716: rust-discovery: partial switch to typestate pattern

2019-12-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7716#114043 , @gracinet 
wrote:
  
  > @martinvonz yes, I've thinked of it after I made this one, but somehow I 
thought this was enough for a first try.
  
  It seems like it would be a lot of churn to take this patch and then a 
follow-up that rewrites it. I'd be much happier to take a patch that cleaner 
version right away (and it sounds like we both think it would be cleaner).
  
  > Yes, we could have `PartialDiscovery`,  and 
`PartialDiscovery`, with  `Start` being a pure marker,  and 
`Computed` actually holding the undecided set and the children cache 
(anticipating on a later changeset), that would be more elegant and it would 
better organize the boiler plate.
  > Don't hesitate if you come up with better namings.
  
  I haven't even reviewed in enough detail to know what the states represent, 
so I don't have any suggestions yet :)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7716/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7716

To: gracinet, #hg-reviewers, martinvonz
Cc: martinvonz, Alphare, durin42, kevincox, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7716: rust-discovery: partial switch to typestate pattern

2019-12-27 Thread gracinet (Georges Racinet)
gracinet added a comment.


  @martinvonz yes, I've thinked of it after I made this one, but somehow I 
thought this was enough for a first try.
  
  Yes, we could have `PartialDiscovery`,  and 
`PartialDiscovery`, with  `Start` being a pure marker,  and 
`Computed` actually holding the undecided set and the children cache 
(anticipating on a later changeset), that would be more elegant and it would 
better organize the boiler plate.
  
  Don't hesitate if you come up with better namings.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7716/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7716

To: gracinet, #hg-reviewers, martinvonz
Cc: martinvonz, Alphare, durin42, kevincox, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7750: run-tests: ensure the script exits when it fails to change directories

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm as an unused variable assignment.  This regressed in
  c496e8c14b9e 
.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7750

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1839,7 +1839,7 @@
 cmd = rawcmd.split()
 toggletrace(rawcmd)
 if len(cmd) == 2 and cmd[0] == b'cd':
-l = b'  $ cd %s || exit 1\n' % cmd[1]
+rawcmd = b'cd %s || exit 1\n' % cmd[1]
 script.append(rawcmd)
 elif l.startswith(b'  > '):  # continuations
 after.setdefault(prepos, []).append(l)



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7749: shelve: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.  This stopped being used in a3b285882724 
.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7749

AFFECTED FILES
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -557,8 +557,6 @@
 match = scmutil.matchfiles(repo, repo[node].files())
 _shelvecreatedcommit(repo, node, name, match)
 
-if ui.formatted():
-desc = stringutil.ellipsis(desc, ui.termwidth())
 ui.status(_(b'shelved as %s\n') % name)
 if opts[b'keep']:
 with repo.dirstate.parentchange():



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7747: revlog: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHGbdb357161d7a: revlog: drop an unused variable assignment 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7747?vs=18963=18978

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7747/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7747

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1772,10 +1772,8 @@
 if node == nullid:
 return b"", {}
 
-# The text as stored inside the revlog. Might be the revision or might
-# need to be processed to retrieve the revision.
-rawtext = None
-
+# ``rawtext`` is the text as stored inside the revlog. Might be the
+# revision or might need to be processed to retrieve the revision.
 rev, rawtext, validated = self._rawtext(node, rev, _df=_df)
 
 if raw and validated:



To: mharbison72, indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7746: rebase: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHGbd88407edc0e: rebase: drop an unused variable assignment 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7746?vs=18962=18977

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7746/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7746

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
@@ -787,7 +787,6 @@
 cleanup = False
 
 if cleanup:
-shouldupdate = False
 if rebased:
 strippoints = [
 c.node() for c in repo.set(b'roots(%ld)', rebased)



To: mharbison72, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7748: hgweb: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG3e4294aa7944: hgweb: drop an unused variable assignment 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7748?vs=18964=18979

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7748/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7748

AFFECTED FILES
  mercurial/hgweb/webcommands.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1268,7 +1268,6 @@
 name = b"%s-%s" % (reponame, arch_version)
 
 ctx = webutil.changectx(web.repo, web.req)
-pats = []
 match = scmutil.match(ctx, [])
 file = web.req.qsparams.get(b'file')
 if file:



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7745: polib: drop an unused local function

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG04e0e0e73892: polib: drop an unused local function 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7745?vs=18961=18976

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7745/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7745

AFFECTED FILES
  i18n/polib.py

CHANGE DETAILS

diff --git a/i18n/polib.py b/i18n/polib.py
--- a/i18n/polib.py
+++ b/i18n/polib.py
@@ -551,18 +551,6 @@
 offsets = []
 entries = self.translated_entries()
 
-# the keys are sorted in the .mo file
-def cmp(_self, other):
-# msgfmt compares entries with msgctxt if it exists
-self_msgid = _self.msgctxt and _self.msgctxt or _self.msgid
-other_msgid = other.msgctxt and other.msgctxt or other.msgid
-if self_msgid > other_msgid:
-return 1
-elif self_msgid < other_msgid:
-return -1
-else:
-return 0
-
 # add metadata entry
 entries.sort(key=lambda o: o.msgctxt or o.msgid)
 mentry = self.metadata_as_entry()



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7744: perf: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG943e34522b37: perf: drop an unused variable assignment 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7744?vs=18960=18975

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7744/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7744

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2220,9 +2220,6 @@
 
 fm.end()
 if dostats:
-# use a second formatter because the data are quite different, not sure
-# how it flies with the templater.
-fm = ui.formatter(b'perf', opts)
 entries = [
 ('nbrevs', 'number of revision covered'),
 ('nbmissingfiles', 'number of missing files at head'),



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7743: perf: drop an unnecessary `pass`

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG2bbb2f556ecf: perf: drop an unnecessary `pass` (authored by 
mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7743?vs=18959=18974

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7743/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7743

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1878,7 +1878,6 @@
 
 
 def _displaystats(ui, opts, entries, data):
-pass
 # use a second formatter because the data are quite different, not sure
 # how it flies with the templater.
 fm = ui.formatter(b'perf-stats', opts)



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7742: perf: fix the time measurement for pathcopies relative to p2

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHGa2ad5aeedfdf: perf: fix the time measurement for pathcopies 
relative to p2 (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7742?vs=18958=18973

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7742/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7742

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2048,8 +2048,8 @@
 data['p1.time'] = end - begin
 begin = util.timer()
 p2renames = copies.pathcopies(b, p2)
+end = util.timer()
 data['p2.time'] = end - begin
-end = util.timer()
 data['p1.renamedfiles'] = len(p1renames)
 data['p2.renamedfiles'] = len(p2renames)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7740: debug: drop unused variable assignments

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG7a2c49a3cbae: debug: drop unused variable assignments 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7740?vs=18956=18971

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7740/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7740

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -331,9 +331,9 @@
 )
 )
 
-chunkdata = gen.changelogheader()
+gen.changelogheader()
 showchunks(b"changelog")
-chunkdata = gen.manifestheader()
+gen.manifestheader()
 showchunks(b"manifest")
 for chunkdata in iter(gen.filelogheader, {}):
 fname = chunkdata[b'filename']
@@ -341,7 +341,7 @@
 else:
 if isinstance(gen, bundle2.unbundle20):
 raise error.Abort(_(b'use debugbundle2 for this file'))
-chunkdata = gen.changelogheader()
+gen.changelogheader()
 for deltadata in gen.deltaiter():
 node, p1, p2, cs, deltabase, delta, flags = deltadata
 ui.write(b"%s%s\n" % (indent_string, hex(node)))



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7741: githelp: drop unused variable assignments

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHGca5bd34c597b: githelp: drop unused variable assignments 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7741?vs=18957=18972

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7741/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7741

AFFECTED FILES
  hgext/githelp.py

CHANGE DETAILS

diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -209,7 +209,7 @@
 
 def am(ui, repo, *args, **kwargs):
 cmdoptions = []
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 cmd = Command(b'import')
 ui.status(bytes(cmd), b"\n")
 
@@ -1139,7 +1139,7 @@
 
 def svndcommit(ui, repo, *args, **kwargs):
 cmdoptions = []
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 
 cmd = Command(b'push')
 
@@ -1148,7 +1148,7 @@
 
 def svnfetch(ui, repo, *args, **kwargs):
 cmdoptions = []
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 
 cmd = Command(b'pull')
 cmd.append(b'default-push')
@@ -1173,7 +1173,7 @@
 cmdoptions = [
 (b'l', b'local', None, b''),
 ]
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 
 pullcmd = Command(b'pull')
 pullcmd.append(b'default-push')



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7739: changegroup: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG6d2b5c4efdae: changegroup: drop an unused variable 
assignment (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7739?vs=18955=18970

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7739/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7739

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
@@ -287,8 +287,6 @@
 def revmap(x):
 return cl.rev(x)
 
-changesets = 0
-
 try:
 # The transaction may already carry source information. In this
 # case we use the top level data. We overwrite the argument



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7738: bugzilla: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG3194cc8c8de0: bugzilla: drop an unused variable assignment 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7738?vs=18954=18969

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7738/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7738

AFFECTED FILES
  hgext/bugzilla.py

CHANGE DETAILS

diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py
--- a/hgext/bugzilla.py
+++ b/hgext/bugzilla.py
@@ -1099,7 +1099,6 @@
 the given changeset in their comments.
 '''
 start = 0
-hours = 0.0
 bugs = {}
 bugmatch = self.bug_re.search(ctx.description(), start)
 fixmatch = self.fix_re.search(ctx.description(), start)



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7737: ancestor: drop another unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG68b09ebf1c13: ancestor: drop another unused variable 
assignment (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7737?vs=18953=18968

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7737/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7737

AFFECTED FILES
  mercurial/ancestor.py

CHANGE DETAILS

diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -108,12 +108,12 @@
 if p == nullrev:
 continue
 dp = depth[p]
-nsp = sp = seen[p]
+sp = seen[p]
 if dp <= dv:
 depth[p] = dv + 1
 if sp != sv:
 interesting[sv] += 1
-nsp = seen[p] = sv
+seen[p] = sv
 if sp:
 interesting[sp] -= 1
 if interesting[sp] == 0:



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7736: ancestor: drop an unused local variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG5ce6daa67658: ancestor: drop an unused local variable 
assignment (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7736?vs=18952=18967

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7736/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7736

AFFECTED FILES
  mercurial/ancestor.py

CHANGE DETAILS

diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -331,7 +331,7 @@
 
 Result does not include the null revision."""
 self._parentrevs = pfunc
-self._initrevs = revs = [r for r in revs if r >= stoprev]
+self._initrevs = [r for r in revs if r >= stoprev]
 self._stoprev = stoprev
 self._inclusive = inclusive
 



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7735: cleanup: drop unused import from pywatchman

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG6c201f0d17b1: cleanup: drop unused import from pywatchman 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7735?vs=18951=18966

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7735/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7735

AFFECTED FILES
  hgext/fsmonitor/pywatchman/capabilities.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/pywatchman/capabilities.py 
b/hgext/fsmonitor/pywatchman/capabilities.py
--- a/hgext/fsmonitor/pywatchman/capabilities.py
+++ b/hgext/fsmonitor/pywatchman/capabilities.py
@@ -29,8 +29,6 @@
 # no unicode literals
 from __future__ import absolute_import, division, print_function
 
-import re
-
 
 def parse_version(vstr):
 res = 0



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7734: narrow: move `testedwith` after module imports

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHGf91834ecfdfd: narrow: move `testedwith` after module 
imports (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7734?vs=18950=18965

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7734/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7734

AFFECTED FILES
  hgext/narrow/__init__.py

CHANGE DETAILS

diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -8,12 +8,6 @@
 
 from __future__ import absolute_import
 
-# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
-# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
-# be specifying the version(s) of Mercurial they are tested with, or
-# leave the attribute unspecified.
-testedwith = b'ships-with-hg-core'
-
 from mercurial import (
 localrepo,
 registrar,
@@ -29,6 +23,12 @@
 narrowwirepeer,
 )
 
+# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
+# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
+# be specifying the version(s) of Mercurial they are tested with, or
+# leave the attribute unspecified.
+testedwith = b'ships-with-hg-core'
+
 configtable = {}
 configitem = registrar.configitem(configtable)
 # Narrowhg *has* support for serving ellipsis nodes (which are used at



To: mharbison72, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7747: revlog: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7747

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1772,10 +1772,8 @@
 if node == nullid:
 return b"", {}
 
-# The text as stored inside the revlog. Might be the revision or might
-# need to be processed to retrieve the revision.
-rawtext = None
-
+# ``rawtext`` is the text as stored inside the revlog. Might be the
+# revision or might need to be processed to retrieve the revision.
 rev, rawtext, validated = self._rawtext(node, rev, _df=_df)
 
 if raw and validated:



To: mharbison72, indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7748: hgweb: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7748

AFFECTED FILES
  mercurial/hgweb/webcommands.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1268,7 +1268,6 @@
 name = b"%s-%s" % (reponame, arch_version)
 
 ctx = webutil.changectx(web.repo, web.req)
-pats = []
 match = scmutil.match(ctx, [])
 file = web.req.qsparams.get(b'file')
 if file:



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7746: rebase: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7746

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
@@ -787,7 +787,6 @@
 cleanup = False
 
 if cleanup:
-shouldupdate = False
 if rebased:
 strippoints = [
 c.node() for c in repo.set(b'roots(%ld)', rebased)



To: mharbison72, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7745: polib: drop an unused local function

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7745

AFFECTED FILES
  i18n/polib.py

CHANGE DETAILS

diff --git a/i18n/polib.py b/i18n/polib.py
--- a/i18n/polib.py
+++ b/i18n/polib.py
@@ -551,18 +551,6 @@
 offsets = []
 entries = self.translated_entries()
 
-# the keys are sorted in the .mo file
-def cmp(_self, other):
-# msgfmt compares entries with msgctxt if it exists
-self_msgid = _self.msgctxt and _self.msgctxt or _self.msgid
-other_msgid = other.msgctxt and other.msgctxt or other.msgid
-if self_msgid > other_msgid:
-return 1
-elif self_msgid < other_msgid:
-return -1
-else:
-return 0
-
 # add metadata entry
 entries.sort(key=lambda o: o.msgctxt or o.msgid)
 mentry = self.metadata_as_entry()



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7744: perf: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.  A different formatter is created below in 
`_displaystats()`.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7744

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2220,9 +2220,6 @@
 
 fm.end()
 if dostats:
-# use a second formatter because the data are quite different, not sure
-# how it flies with the templater.
-fm = ui.formatter(b'perf', opts)
 entries = [
 ('nbrevs', 'number of revision covered'),
 ('nbmissingfiles', 'number of missing files at head'),



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7743: perf: drop an unnecessary `pass`

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 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/D7743

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1878,7 +1878,6 @@
 
 
 def _displaystats(ui, opts, entries, data):
-pass
 # use a second formatter because the data are quite different, not sure
 # how it flies with the templater.
 fm = ui.formatter(b'perf-stats', opts)



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7742: perf: fix the time measurement for pathcopies relative to p2

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  PyCharm flagged this as unused.  But it seems more likely that it was intended
  to reset the time for the p2 path.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7742

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -2048,8 +2048,8 @@
 data['p1.time'] = end - begin
 begin = util.timer()
 p2renames = copies.pathcopies(b, p2)
+end = util.timer()
 data['p2.time'] = end - begin
-end = util.timer()
 data['p1.renamedfiles'] = len(p1renames)
 data['p2.renamedfiles'] = len(p2renames)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7740: debug: drop unused variable assignments

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7740

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -331,9 +331,9 @@
 )
 )
 
-chunkdata = gen.changelogheader()
+gen.changelogheader()
 showchunks(b"changelog")
-chunkdata = gen.manifestheader()
+gen.manifestheader()
 showchunks(b"manifest")
 for chunkdata in iter(gen.filelogheader, {}):
 fname = chunkdata[b'filename']
@@ -341,7 +341,7 @@
 else:
 if isinstance(gen, bundle2.unbundle20):
 raise error.Abort(_(b'use debugbundle2 for this file'))
-chunkdata = gen.changelogheader()
+gen.changelogheader()
 for deltadata in gen.deltaiter():
 node, p1, p2, cs, deltabase, delta, flags = deltadata
 ui.write(b"%s%s\n" % (indent_string, hex(node)))



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7741: githelp: drop unused variable assignments

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7741

AFFECTED FILES
  hgext/githelp.py

CHANGE DETAILS

diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -209,7 +209,7 @@
 
 def am(ui, repo, *args, **kwargs):
 cmdoptions = []
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 cmd = Command(b'import')
 ui.status(bytes(cmd), b"\n")
 
@@ -1139,7 +1139,7 @@
 
 def svndcommit(ui, repo, *args, **kwargs):
 cmdoptions = []
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 
 cmd = Command(b'push')
 
@@ -1148,7 +1148,7 @@
 
 def svnfetch(ui, repo, *args, **kwargs):
 cmdoptions = []
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 
 cmd = Command(b'pull')
 cmd.append(b'default-push')
@@ -1173,7 +1173,7 @@
 cmdoptions = [
 (b'l', b'local', None, b''),
 ]
-args, opts = parseoptions(ui, cmdoptions, args)
+parseoptions(ui, cmdoptions, args)
 
 pullcmd = Command(b'pull')
 pullcmd.append(b'default-push')



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7739: changegroup: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.  The variable is assigned again below before it is used.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7739

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
@@ -287,8 +287,6 @@
 def revmap(x):
 return cl.rev(x)
 
-changesets = 0
-
 try:
 # The transaction may already carry source information. In this
 # case we use the top level data. We overwrite the argument



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7738: bugzilla: drop an unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7738

AFFECTED FILES
  hgext/bugzilla.py

CHANGE DETAILS

diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py
--- a/hgext/bugzilla.py
+++ b/hgext/bugzilla.py
@@ -1099,7 +1099,6 @@
 the given changeset in their comments.
 '''
 start = 0
-hours = 0.0
 bugs = {}
 bugmatch = self.bug_re.search(ctx.description(), start)
 fixmatch = self.fix_re.search(ctx.description(), start)



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7737: ancestor: drop another unused variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Also caught by PyCharm.  The only time this is used is immediately after 
another
  assignment below this.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7737

AFFECTED FILES
  mercurial/ancestor.py

CHANGE DETAILS

diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -108,12 +108,12 @@
 if p == nullrev:
 continue
 dp = depth[p]
-nsp = sp = seen[p]
+sp = seen[p]
 if dp <= dv:
 depth[p] = dv + 1
 if sp != sv:
 interesting[sv] += 1
-nsp = seen[p] = sv
+seen[p] = sv
 if sp:
 interesting[sp] -= 1
 if interesting[sp] == 0:



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7736: ancestor: drop an unused local variable assignment

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7736

AFFECTED FILES
  mercurial/ancestor.py

CHANGE DETAILS

diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py
--- a/mercurial/ancestor.py
+++ b/mercurial/ancestor.py
@@ -331,7 +331,7 @@
 
 Result does not include the null revision."""
 self._parentrevs = pfunc
-self._initrevs = revs = [r for r in revs if r >= stoprev]
+self._initrevs = [r for r in revs if r >= stoprev]
 self._stoprev = stoprev
 self._inclusive = inclusive
 



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7735: cleanup: drop unused import from pywatchman

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by PyCharm.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7735

AFFECTED FILES
  hgext/fsmonitor/pywatchman/capabilities.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/pywatchman/capabilities.py 
b/hgext/fsmonitor/pywatchman/capabilities.py
--- a/hgext/fsmonitor/pywatchman/capabilities.py
+++ b/hgext/fsmonitor/pywatchman/capabilities.py
@@ -29,8 +29,6 @@
 # no unicode literals
 from __future__ import absolute_import, division, print_function
 
-import re
-
 
 def parse_version(vstr):
 res = 0



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7734: narrow: move `testedwith` after module imports

2019-12-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  PyCharm flagged this as a PEP 8 violation, for module level imports not being 
at
  the top of the file.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7734

AFFECTED FILES
  hgext/narrow/__init__.py

CHANGE DETAILS

diff --git a/hgext/narrow/__init__.py b/hgext/narrow/__init__.py
--- a/hgext/narrow/__init__.py
+++ b/hgext/narrow/__init__.py
@@ -8,12 +8,6 @@
 
 from __future__ import absolute_import
 
-# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
-# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
-# be specifying the version(s) of Mercurial they are tested with, or
-# leave the attribute unspecified.
-testedwith = b'ships-with-hg-core'
-
 from mercurial import (
 localrepo,
 registrar,
@@ -29,6 +23,12 @@
 narrowwirepeer,
 )
 
+# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
+# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
+# be specifying the version(s) of Mercurial they are tested with, or
+# leave the attribute unspecified.
+testedwith = b'ships-with-hg-core'
+
 configtable = {}
 configitem = registrar.configitem(configtable)
 # Narrowhg *has* support for serving ellipsis nodes (which are used at



To: mharbison72, durin42, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7705: phases: make the working directory consistently a draft

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  I simply sent this. If am I following your changeset right, we should have 
`wdir()` match `draft()` or `secret()` according to the projected phase (config 
+ parent)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7705/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7705

To: rdamazio, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7705: phases: make the working directory consistently a draft

2019-12-27 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  > commitablectx code seems wrong here. I am sending a patch.
  
  Sure. Let me know if your patch is going to somehow cover the use case I'm 
trying to address here, or what else you'd like me to do with this patch (is it 
just a matter of adding more tests here to account for the config option mix as 
well, once you add that?).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7705/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7705

To: rdamazio, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7733: hgext: initial version of fastexport extension

2019-12-27 Thread joerg.sonnenberger (Joerg Sonnenberger)
joerg.sonnenberger created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7733

AFFECTED FILES
  hgext/fastexport.py
  tests/test-fastexport.t
  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
@@ -364,6 +364,7 @@
eol   automatically manage newlines in repository files
extdiff   command to allow external programs to compare revisions
factotum  http authentication with factotum
+   fastexportexport repositories as git fast-import stream
githelp   try mapping git commands to Mercurial commands
gpg   commands to sign and verify changesets
hgk   browse the repository in a graphical way
diff --git a/tests/test-fastexport.t b/tests/test-fastexport.t
new file mode 100644
--- /dev/null
+++ b/tests/test-fastexport.t
@@ -0,0 +1,709 @@
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > fastexport=
+  > EOF
+
+  $ hg init
+
+  $ hg debugbuilddag -mon '+2:tbase @name1 +3:thead1  fastexport.blob
+  $ cat fastexport.blob
+  blob
+  mark :1
+  data 65
+  0 r0
+  1
+  2
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :2
+  data 3
+  r0
+  
+  commit refs/heads/default
+  mark :3
+  committer "debugbuilddag"  0 -
+  data 2
+  r0
+  M 644 :1 mf
+  M 644 :2 nf0
+  M 644 :2 of
+  
+  blob
+  mark :4
+  data 68
+  0 r0
+  1
+  2 r1
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :5
+  data 3
+  r1
+  
+  blob
+  mark :6
+  data 3
+  r1
+  
+  commit refs/heads/default
+  mark :7
+  committer "debugbuilddag"  1 -
+  data 2
+  r1
+  from :3
+  M 644 :4 mf
+  M 644 :5 nf1
+  M 644 :6 of
+  
+  blob
+  mark :8
+  data 71
+  0 r0
+  1
+  2 r1
+  3
+  4 r2
+  5
+  6
+  7
+  8
+  9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :9
+  data 3
+  r2
+  
+  blob
+  mark :10
+  data 3
+  r2
+  
+  commit refs/heads/name1
+  mark :11
+  committer "debugbuilddag"  2 -
+  data 2
+  r2
+  from :7
+  M 644 :8 mf
+  M 644 :9 nf2
+  M 644 :10 of
+  
+  blob
+  mark :12
+  data 74
+  0 r0
+  1
+  2 r1
+  3
+  4 r2
+  5
+  6 r3
+  7
+  8
+  9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :13
+  data 3
+  r3
+  
+  blob
+  mark :14
+  data 3
+  r3
+  
+  commit refs/heads/name1
+  mark :15
+  committer "debugbuilddag"  3 -
+  data 2
+  r3
+  from :11
+  M 644 :12 mf
+  M 644 :13 nf3
+  M 644 :14 of
+  
+  blob
+  mark :16
+  data 77
+  0 r0
+  1
+  2 r1
+  3
+  4 r2
+  5
+  6 r3
+  7
+  8 r4
+  9
+  10
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :17
+  data 3
+  r4
+  
+  blob
+  mark :18
+  data 3
+  r4
+  
+  commit refs/heads/name1
+  mark :19
+  committer "debugbuilddag"  4 -
+  data 2
+  r4
+  from :15
+  M 644 :16 mf
+  M 644 :17 nf4
+  M 644 :18 of
+  
+  blob
+  mark :20
+  data 71
+  0 r0
+  1
+  2 r1
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10 r5
+  11
+  12
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :21
+  data 3
+  r5
+  
+  blob
+  mark :22
+  data 3
+  r5
+  
+  commit refs/heads/name2
+  mark :23
+  committer "debugbuilddag"  5 -
+  data 2
+  r5
+  from :7
+  M 644 :20 mf
+  M 644 :21 nf5
+  M 644 :22 of
+  
+  blob
+  mark :24
+  data 74
+  0 r0
+  1
+  2 r1
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10 r5
+  11
+  12 r6
+  13
+  14
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :25
+  data 3
+  r6
+  
+  blob
+  mark :26
+  data 3
+  r6
+  
+  commit refs/heads/name2
+  mark :27
+  committer "debugbuilddag"  6 -
+  data 2
+  r6
+  from :23
+  M 644 :24 mf
+  M 644 :25 nf6
+  M 644 :26 of
+  
+  blob
+  mark :28
+  data 77
+  0 r0
+  1
+  2 r1
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10 r5
+  11
+  12 r6
+  13
+  14 r7
+  15
+  16
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :29
+  data 3
+  r7
+  
+  blob
+  mark :30
+  data 3
+  r7
+  
+  commit refs/heads/name2
+  mark :31
+  committer "debugbuilddag"  7 -
+  data 2
+  r7
+  from :27
+  M 644 :28 mf
+  M 644 :29 nf7
+  M 644 :30 of
+  
+  blob
+  mark :32
+  data 80
+  0 r0
+  1
+  2 r1
+  3
+  4
+  5
+  6
+  7
+  8
+  9
+  10 r5
+  11
+  12 r6
+  13
+  14 r7
+  15
+  16 r8
+  17
+  18
+  19
+  20
+  21
+  22
+  23
+  
+  blob
+  mark :33
+  data 3
+  r8
+  
+  blob
+  mark :34
+  data 3
+  r8
+  
+  commit refs/heads/name2
+  mark :35
+  committer "debugbuilddag"  8 -
+  data 2
+  r8
+  from :31
+  M 644 :32 mf
+  M 644 :33 nf8
+  M 644 :34 of
+  
+  blob
+  mark :36
+  data 92
+  0 r0
+  1
+  2 

D7732: convert: refactor authormap into separate function for outside use

2019-12-27 Thread joerg.sonnenberger (Joerg Sonnenberger)
joerg.sonnenberger created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7732

AFFECTED FILES
  hgext/convert/convcmd.py

CHANGE DETAILS

diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -55,6 +55,34 @@
 
 orig_encoding = b'ascii'
 
+def readauthormap(ui, authorfile):
+authors = {}
+
+with open(authorfile, b'rb') as afile:
+for line in afile:
+
+line = line.strip()
+if not line or line.startswith(b'#'):
+continue
+
+try:
+srcauthor, dstauthor = line.split(b'=', 1)
+except ValueError:
+msg = _(b'ignoring bad line in author map file %s: %s\n')
+ui.warn(msg % (authorfile, line.rstrip()))
+continue
+
+srcauthor = srcauthor.strip()
+dstauthor = dstauthor.strip()
+if authors.get(srcauthor) in (None, dstauthor):
+msg = _(b'mapping author %s to %s\n')
+ui.debug(msg % (srcauthor, dstauthor))
+authors[srcauthor] = dstauthor
+continue
+
+m = _(b'overriding mapping for author %s, was %s, will be %s\n')
+ui.status(m % (srcauthor, authors[srcauthor], dstauthor))
+return authors
 
 def recode(s):
 if isinstance(s, pycompat.unicode):
@@ -448,32 +476,7 @@
 ofile.close()
 
 def readauthormap(self, authorfile):
-afile = open(authorfile, b'rb')
-for line in afile:
-
-line = line.strip()
-if not line or line.startswith(b'#'):
-continue
-
-try:
-srcauthor, dstauthor = line.split(b'=', 1)
-except ValueError:
-msg = _(b'ignoring bad line in author map file %s: %s\n')
-self.ui.warn(msg % (authorfile, line.rstrip()))
-continue
-
-srcauthor = srcauthor.strip()
-dstauthor = dstauthor.strip()
-if self.authors.get(srcauthor) in (None, dstauthor):
-msg = _(b'mapping author %s to %s\n')
-self.ui.debug(msg % (srcauthor, dstauthor))
-self.authors[srcauthor] = dstauthor
-continue
-
-m = _(b'overriding mapping for author %s, was %s, will be %s\n')
-self.ui.status(m % (srcauthor, self.authors[srcauthor], dstauthor))
-
-afile.close()
+self.authors = readauthormap(self.ui, authorfile)
 
 def cachecommit(self, rev):
 commit = self.source.getcommit(rev)



To: joerg.sonnenberger, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7731: tests: fix failing doctest in match.py by adding dummy auditor

2019-12-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It was failing with "OSError: [Errno 13] Permission denied:
  '/root/sub'". It has been failing since 8b1a9ba375e5 
 
(match: make sure
  `root` argument is always an absolute path (API), 2019-12-13). I don't
  know why I didn't notice it before sending that patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7731

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -945,7 +945,7 @@
 The paths are remapped to remove/insert the path as needed:
 
 >>> from . import pycompat
->>> m1 = match(util.localpath(b'/root'), b'', [b'a.txt', b'sub/b.txt'])
+>>> m1 = match(util.localpath(b'/root'), b'', [b'a.txt', b'sub/b.txt'], 
auditor=lambda name: None)
 >>> m2 = subdirmatcher(b'sub', m1)
 >>> m2(b'a.txt')
 False



To: martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7724: tests: convert the `root` arg of matchmod.match() to local path separators

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG8f67735344ae: tests: convert the `root` arg of 
matchmod.match() to local path separators (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7724?vs=18933=18945

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7724/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7724

AFFECTED FILES
  mercurial/match.py
  tests/test-manifest.py
  tests/test-match.py

CHANGE DETAILS

diff --git a/tests/test-match.py b/tests/test-match.py
--- a/tests/test-match.py
+++ b/tests/test-match.py
@@ -66,7 +66,9 @@
 
 class PatternMatcherTests(unittest.TestCase):
 def testVisitdirPrefix(self):
-m = matchmod.match(b'/repo', b'', patterns=[b'path:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', patterns=[b'path:dir/subdir']
+)
 assert isinstance(m, matchmod.patternmatcher)
 self.assertTrue(m.visitdir(b''))
 self.assertTrue(m.visitdir(b'dir'))
@@ -76,7 +78,9 @@
 self.assertFalse(m.visitdir(b'folder'))
 
 def testVisitchildrensetPrefix(self):
-m = matchmod.match(b'/repo', b'', patterns=[b'path:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', patterns=[b'path:dir/subdir']
+)
 assert isinstance(m, matchmod.patternmatcher)
 self.assertEqual(m.visitchildrenset(b''), b'this')
 self.assertEqual(m.visitchildrenset(b'dir'), b'this')
@@ -86,7 +90,9 @@
 self.assertEqual(m.visitchildrenset(b'folder'), set())
 
 def testVisitdirRootfilesin(self):
-m = matchmod.match(b'/repo', b'', patterns=[b'rootfilesin:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', 
patterns=[b'rootfilesin:dir/subdir'],
+)
 assert isinstance(m, matchmod.patternmatcher)
 self.assertFalse(m.visitdir(b'dir/subdir/x'))
 self.assertFalse(m.visitdir(b'folder'))
@@ -96,7 +102,9 @@
 self.assertFalse(m.visitdir(b'dir/subdir'))
 
 def testVisitchildrensetRootfilesin(self):
-m = matchmod.match(b'/repo', b'', patterns=[b'rootfilesin:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', 
patterns=[b'rootfilesin:dir/subdir'],
+)
 assert isinstance(m, matchmod.patternmatcher)
 self.assertEqual(m.visitchildrenset(b'dir/subdir/x'), set())
 self.assertEqual(m.visitchildrenset(b'folder'), set())
@@ -107,7 +115,9 @@
 self.assertEqual(m.visitchildrenset(b'dir/subdir'), set())
 
 def testVisitdirGlob(self):
-m = matchmod.match(b'/repo', b'', patterns=[b'glob:dir/z*'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', patterns=[b'glob:dir/z*']
+)
 assert isinstance(m, matchmod.patternmatcher)
 self.assertTrue(m.visitdir(b''))
 self.assertTrue(m.visitdir(b'dir'))
@@ -117,7 +127,9 @@
 self.assertTrue(m.visitdir(b'dir/subdir/x'))
 
 def testVisitchildrensetGlob(self):
-m = matchmod.match(b'/repo', b'', patterns=[b'glob:dir/z*'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', patterns=[b'glob:dir/z*']
+)
 assert isinstance(m, matchmod.patternmatcher)
 self.assertEqual(m.visitchildrenset(b''), b'this')
 self.assertEqual(m.visitchildrenset(b'folder'), set())
@@ -129,7 +141,9 @@
 
 class IncludeMatcherTests(unittest.TestCase):
 def testVisitdirPrefix(self):
-m = matchmod.match(b'/repo', b'', include=[b'path:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', include=[b'path:dir/subdir']
+)
 assert isinstance(m, matchmod.includematcher)
 self.assertTrue(m.visitdir(b''))
 self.assertTrue(m.visitdir(b'dir'))
@@ -139,7 +153,9 @@
 self.assertFalse(m.visitdir(b'folder'))
 
 def testVisitchildrensetPrefix(self):
-m = matchmod.match(b'/repo', b'', include=[b'path:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', include=[b'path:dir/subdir']
+)
 assert isinstance(m, matchmod.includematcher)
 self.assertEqual(m.visitchildrenset(b''), {b'dir'})
 self.assertEqual(m.visitchildrenset(b'dir'), {b'subdir'})
@@ -149,7 +165,9 @@
 self.assertEqual(m.visitchildrenset(b'folder'), set())
 
 def testVisitdirRootfilesin(self):
-m = matchmod.match(b'/repo', b'', include=[b'rootfilesin:dir/subdir'])
+m = matchmod.match(
+util.localpath(b'/repo'), b'', include=[b'rootfilesin:dir/subdir']
+)
 assert isinstance(m, matchmod.includematcher)
 self.assertTrue(m.visitdir(b''))
 self.assertTrue(m.visitdir(b'dir'))
@@ -158,7 +176,9 @@
 

D7725: match: don't util.normpath() cwd

2019-12-27 Thread mharbison72 (Matt Harbison)
Closed by commit rHG8a81fa44f7bb: match: dont util.normpath() cwd 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7725?vs=18934=18946

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7725/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7725

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -232,7 +232,7 @@
 False
 """
 assert os.path.isabs(root)
-cwd = util.normpath(os.path.join(root, cwd))
+cwd = os.path.join(root, util.localpath(cwd))
 normalize = _donormalize
 if icasefs:
 dirstate = ctx.repo().dirstate



To: mharbison72, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7716: rust-discovery: partial switch to typestate pattern

2019-12-27 Thread martinvonz (Martin von Zweigbergk)
This revision now requires changes to proceed.
martinvonz added a comment.
martinvonz requested changes to this revision.


  Did you consider encoding the state in a type parameter to 
`PartialDiscovery`? I think that would make the call sites simpler. See the 
last variation on http://cliffle.com/blog/rust-typestate/ for what I mean.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7716/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7716

To: gracinet, #hg-reviewers, martinvonz
Cc: martinvonz, Alphare, durin42, kevincox, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7726: commitablectx: fix the default phase

2019-12-27 Thread marmoute (Pierre-Yves David)
Closed by commit rHGbbcf78c4ff90: commitablectx: fix the default phase 
(authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7726?vs=18935=18944

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7726/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7726

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
@@ -1439,7 +1439,7 @@
 return b
 
 def phase(self):
-phase = phases.draft  # default phase to draft
+phase = phases.newcommitphase(self._repo.ui)
 for p in self.parents():
 phase = max(phase, p.phase())
 return phase



To: marmoute, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7660: rust-index: add a `experimental.rust.index` option to use the wrapper

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18943.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7660?vs=18706=18943

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7660/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7660

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -106,6 +106,7 @@
 parsers = policy.importmod('parsers')
 rustancestor = policy.importrust('ancestor')
 rustdagop = policy.importrust('dagop')
+rustrevlog = policy.importrust('revlog')
 
 # Aliased for performance.
 _zlibdecompress = zlib.decompress
@@ -351,6 +352,12 @@
 return p
 
 
+class rustrevlogio(revlogio):
+def parseindex(self, data, inline):
+index, cache = super(rustrevlogio, self).parseindex(data, inline)
+return rustrevlog.MixedIndex(index), cache
+
+
 class revlog(object):
 """
 the underlying revision storage object
@@ -585,6 +592,8 @@
 self._storedeltachains = True
 
 self._io = revlogio()
+if rustrevlog is not None and self.opener.options.get('rust.index'):
+self._io = rustrevlogio()
 if self.version == REVLOGV0:
 self._io = revlogoldio()
 try:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -927,6 +927,9 @@
 if repository.NARROW_REQUIREMENT in requirements:
 options[b'enableellipsis'] = True
 
+if ui.configbool('experimental', 'rust.index'):
+options[b'rust.index'] = True
+
 return options
 
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -657,6 +657,9 @@
 b'experimental', b'revisions.disambiguatewithin', default=None,
 )
 coreconfigitem(
+b'experimental', b'rust.index', default=False,
+)
+coreconfigitem(
 b'experimental', b'server.filesdata.recommended-batch-size', default=5,
 )
 coreconfigitem(



To: marmoute, indygreg, #hg-reviewers, Alphare
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7658: rust-index: expose a method to retrieve the C index

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18942.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7658?vs=18891=18942

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7658/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7658

AFFECTED FILES
  rust/hg-cpython/src/revlog.rs
  tests/test-rust-revlog.py

CHANGE DETAILS

diff --git a/tests/test-rust-revlog.py b/tests/test-rust-revlog.py
--- a/tests/test-rust-revlog.py
+++ b/tests/test-rust-revlog.py
@@ -25,6 +25,13 @@
 rustidx = revlog.MixedIndex(idx)
 self.assertEqual(rustidx.headrevs(), idx.headrevs())
 
+def test_get_cindex(self):
+# drop me once we no longer need the method for shortest node
+idx = self.parseindex()
+rustidx = revlog.MixedIndex(idx)
+cidx = rustidx.get_cindex()
+self.assertTrue(idx is cidx)
+
 def test_len(self):
 idx = self.parseindex()
 rustidx = revlog.MixedIndex(idx)
diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -29,6 +29,17 @@
 cindex::Index::new(py, cindex)?))
 }
 
+/// Compatibility layer used for Python consumers needing access to the C 
index
+///
+/// Only use case so far is `scmutil.shortesthexnodeidprefix`,
+/// that may need to build a custom `nodetree`, based on a specified 
revset.
+/// With a Rust implementation of the nodemap, we will be able to get rid 
of
+/// this, by exposing our own standalone nodemap class,
+/// ready to accept `MixedIndex`.
+def get_cindex() -> PyResult {
+Ok(self.cindex(py).borrow().inner().clone_ref(py))
+}
+
 
 // Reforwarded C index API
 



To: marmoute, #hg-reviewers, Alphare
Cc: durin42, kevincox, mjpieters, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7656: rust-index: make it possible to clone the struct referencing the C index

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18940.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7656?vs=18889=18940

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7656/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7656

AFFECTED FILES
  rust/hg-cpython/src/cindex.rs
  rust/hg-cpython/src/revlog.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -7,17 +7,14 @@
 
 use crate::cindex;
 use cpython::{
-ObjectProtocol, PyDict, PyModule, PyObject, PyResult, PyTuple, Python,
-PythonObject, ToPyObject,
+ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, PyTuple, 
Python, PythonObject,
+ToPyObject,
 };
 use hg::Revision;
 use std::cell::RefCell;
 
 /// Return a Struct implementing the Graph trait
-pub(crate) fn pyindex_to_graph(
-py: Python,
-index: PyObject,
-) -> PyResult {
+pub(crate) fn pyindex_to_graph(py: Python, index: PyObject) -> 
PyResult {
 cindex::Index::new(py, index)
 }
 
@@ -198,6 +195,10 @@
 .inner()
 .call_method(py, name, args, kwargs)
 }
+
+pub fn clone_cindex(, py: Python) -> cindex::Index {
+self.cindex(py).borrow().clone_ref(py)
+}
 }
 
 /// Create the module, with __package__ given from parent
diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs
--- a/rust/hg-cpython/src/cindex.rs
+++ b/rust/hg-cpython/src/cindex.rs
@@ -88,6 +88,15 @@
 }
 }
 
+impl PyClone for Index {
+fn clone_ref(, py: Python) -> Self {
+Index {
+index: self.index.clone_ref(py),
+capi: self.capi,
+}
+}
+}
+
 impl Graph for Index {
 /// wrap a call to the C extern parents function
 fn parents(, rev: Revision) -> Result<[Revision; 2], GraphError> {



To: marmoute, #hg-reviewers, Alphare, indygreg
Cc: durin42, kevincox, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7657: rust-index: handle `MixedIndex` in `pyindex_to_graph`

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18941.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7657?vs=18890=18941

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7657/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7657

AFFECTED FILES
  rust/hg-cpython/src/revlog.rs
  tests/test-rust-revlog.py

CHANGE DETAILS

diff --git a/tests/test-rust-revlog.py b/tests/test-rust-revlog.py
--- a/tests/test-rust-revlog.py
+++ b/tests/test-rust-revlog.py
@@ -10,6 +10,9 @@
 else:
 from mercurial.rustext import revlog
 
+# this would fail already without appropriate ancestor.__package__
+from mercurial.rustext.ancestor import LazyAncestors
+
 from mercurial.testing import revlog as revlogtesting
 
 
@@ -27,6 +30,22 @@
 rustidx = revlog.MixedIndex(idx)
 self.assertEqual(len(rustidx), len(idx))
 
+def test_ancestors(self):
+idx = self.parseindex()
+rustidx = revlog.MixedIndex(idx)
+lazy = LazyAncestors(rustidx, [3], 0, True)
+# we have two more references to the index:
+# - in its inner iterator for __contains__ and __bool__
+# - in the LazyAncestors instance itself (to spawn new iterators)
+self.assertTrue(2 in lazy)
+self.assertTrue(bool(lazy))
+self.assertEqual(list(lazy), [3, 2, 1, 0])
+# a second time to validate that we spawn new iterators
+self.assertEqual(list(lazy), [3, 2, 1, 0])
+
+# let's check bool for an empty one
+self.assertFalse(LazyAncestors(idx, [0], 0, False))
+
 
 if __name__ == '__main__':
 import silenttestrunner
diff --git a/rust/hg-cpython/src/revlog.rs b/rust/hg-cpython/src/revlog.rs
--- a/rust/hg-cpython/src/revlog.rs
+++ b/rust/hg-cpython/src/revlog.rs
@@ -15,7 +15,10 @@
 
 /// Return a Struct implementing the Graph trait
 pub(crate) fn pyindex_to_graph(py: Python, index: PyObject) -> 
PyResult {
-cindex::Index::new(py, index)
+match index.extract::(py) {
+Ok(midx) => Ok(midx.clone_cindex(py)),
+Err(_) => cindex::Index::new(py, index),
+}
 }
 
 py_class!(pub class MixedIndex |py| {



To: marmoute, #hg-reviewers, Alphare
Cc: durin42, kevincox, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7730: rebase: make sure pruning does not confuse rebase (issue6180)

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch, if a user is rebasing a stack of commits and
  hit a conflict in between and decided to drop that commit (the commit
  which is being rebased but hit conflict) and pruned it, now what
  `hg rebase --continue` does is: skip that dropped commit and move
  on to rebase the next commit and gets confused here because wdir
  has two parents which is because while we skipped that dropped
  commit wdir had two parents and we didn't update that to one parent.
  
  Changes in test file demonstrate the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7730

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -478,14 +478,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-XXX: it should have rebased revision 3 since it made changes unrelated to
-destination, so no reason to say "its destination already has all its changes"
   $ hg rebase -c
   note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
   rebasing 3:aea370672fd7 "add b" (tip)
-  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
   $ hg tglog
-  @  1:draft 'edit a'
+  @  4:draft 'add b'
+  |
+  o  1:draft 'edit a'
   |
   o  0:draft 'add a'
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -594,6 +594,10 @@
 adjustdest(repo, rev, self.destmap, self.state, self.skipped)
 )
 self.state[rev] = dest
+# since we are done, make sure wdir has one parent (issue6180)
+if len(repo[None].parents()) == 2:
+p1 = repo[None].p1().node()
+repo.setparents(p1)
 elif self.state[rev] == revtodo:
 ui.status(_(b'rebasing %s\n') % desc)
 progressfn(ctx)



To: khanchi97, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7727: rebase: make sure pruning does not confuse rebase (issue6180)

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.
khanchi97 abandoned this revision.


  abandoing because I phabsent them in reverse order and it got messed up 
saying 'Graph cycle detected'

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7727/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7727

To: khanchi97, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7729: py3: new attempt at fixing logging of traceback in remotefilelog

2019-12-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  D7598  tried and seems to have failed 
because traceback.format_stack()
  returns a list, not a string.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7729

AFFECTED FILES
  hgext/remotefilelog/fileserverclient.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/fileserverclient.py 
b/hgext/remotefilelog/fileserverclient.py
--- a/hgext/remotefilelog/fileserverclient.py
+++ b/hgext/remotefilelog/fileserverclient.py
@@ -663,5 +663,5 @@
 self.ui.log(
 b'remotefilelog',
 b'excess remotefilelog fetching:\n%s\n',
-b''.join(pycompat.sysbytes(traceback.format_stack())),
+b''.join(map(pycompat.sysbytes, traceback.format_stack())),
 )



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


D7728: rebase: add test to demonstrate issue6180

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It will be fixed in next patch.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7728

AFFECTED FILES
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -429,3 +429,63 @@
   |/
   o  0:draft 'A'
   
+Test to make sure that pruning while rebasing doesn't confuse rebase 
(issue6180)
+  $ cat >> $HGRCPATH < [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
+  > [alias]
+  > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
+  > EOF
+
+The test case below starts a rebase of 2 commits and runs into conflicts on
+the first one. We then decide we don't want the changes from that commit, so
+we revert the changes and also prune the original commit.
+Now what we expect from `hg rebase --continue` is that it skip rebasing first
+one (since it's pruned) but don't skip second one.
+
+  $ hg init issue6180
+  $ cd issue6180
+  $ echo 0 > a
+  $ hg ci -Aqm 'add a'
+  $ echo 1 > a
+  $ hg ci -m 'edit a'
+  $ hg co -q 0
+  $ echo 2 > a
+  $ hg ci -qm 'conflict in a'
+  $ echo 3 > b
+  $ hg ci -Aqm 'add b'
+  $ hg tglog
+  @  3:draft 'add b'
+  |
+  o  2:draft 'conflict in a'
+  |
+  | o  1:draft 'edit a'
+  |/
+  o  0:draft 'add a'
+  
+  $ hg rebase -d 1
+  rebasing 2:06a50ac6b5ab "conflict in a"
+  merging a
+  warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+  $ echo 1 > a
+  $ hg debugobsolete $(hg id -ir 2 --debug)
+  1 new obsolescence markers
+  obsoleted 1 changesets
+  1 new orphan changesets
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+XXX: it should have rebased revision 3 since it made changes unrelated to
+destination, so no reason to say "its destination already has all its changes"
+  $ hg rebase -c
+  note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
+  rebasing 3:aea370672fd7 "add b" (tip)
+  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
+  $ hg tglog
+  @  1:draft 'edit a'
+  |
+  o  0:draft 'add a'
+  



To: khanchi97, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7727: rebase: make sure pruning does not confuse rebase (issue6180)

2019-12-27 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a reviewer: martinvonz.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch, if a user is rebasing a stack of commits and
  hit a conflict in between and decided to drop that commit (the commit
  which is being rebased but hit conflict) and pruned it, now what
  `hg rebase --continue` does is: skip that dropped commit and move
  on to rebase the next commit and gets confused here because wdir
  has two parents which is because while we skipped that dropped
  commit wdir had two parents and we didn't update that to one parent.
  
  Changes in test file demonstrate the fixed behavior.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7727

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-conflicts.t

CHANGE DETAILS

diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -478,14 +478,13 @@
   $ hg resolve -m
   (no more unresolved files)
   continue: hg rebase --continue
-XXX: it should have rebased revision 3 since it made changes unrelated to
-destination, so no reason to say "its destination already has all its changes"
   $ hg rebase -c
   note: not rebasing 2:06a50ac6b5ab "conflict in a", it has no successor
   rebasing 3:aea370672fd7 "add b" (tip)
-  note: not rebasing 3:aea370672fd7 "add b" (tip), its destination already has 
all its changes
   $ hg tglog
-  @  1:draft 'edit a'
+  @  4:draft 'add b'
+  |
+  o  1:draft 'edit a'
   |
   o  0:draft 'add a'
   
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -594,6 +594,10 @@
 adjustdest(repo, rev, self.destmap, self.state, self.skipped)
 )
 self.state[rev] = dest
+# since we are done, make sure wdir has one parent (issue6180)
+if len(repo[None].parents()) == 2:
+p1 = repo[None].p1().node()
+repo.setparents(p1)
 elif self.state[rev] == revtodo:
 ui.status(_(b'rebasing %s\n') % desc)
 progressfn(ctx)



To: khanchi97, martinvonz, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7705: phases: make the working directory consistently a draft

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  In D7705#113667 , @rdamazio 
wrote:
  
  > In D7705#113383 , @marmoute 
wrote:
  >
  >> The working copy is not necessarly draft phase. For example, it will be 
secret is the working copy parent is secret. One can also control it using the 
`phases.new-commit` config.
  >> The `mercurial.phases.newcommitphase(ui)` function can help you there.
  >
  > Thanks.
  > About `newcommitphase` - that only accounts for the config option, and it 
seems that the working directory doesn't change phase based on that in other 
parts of the code (e.g. in `commitablectx`), so I kept that consistent here.
  
  `commitablectx` code seems wrong here. I am sending a patch.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7705/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7705

To: rdamazio, #hg-reviewers, marmoute
Cc: marmoute, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7726: commitablectx: fix the default phase

2019-12-27 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The code was ignoring the config option. Since the config option will control
  the actual phase of the committed result, we better take it in account early.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D7726

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
@@ -1439,7 +1439,7 @@
 return b
 
 def phase(self):
-phase = phases.draft  # default phase to draft
+phase = phases.newcommitphase(self._repo.ui)
 for p in self.parents():
 phase = max(phase, p.phase())
 return phase



To: marmoute, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel