D291: repair: refactor broken linkrev collection

2017-08-09 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6626d12e7a85: repair: refactor broken linkrev collection 
(authored by durham).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D291?vs=661&id=692

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

AFFECTED FILES
  mercurial/repair.py

CHANGE DETAILS

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -67,16 +67,20 @@
 
 return sorted(files)
 
+def _collectrevlog(revlog, striprev):
+_, brokenset = revlog.getstrippoint(striprev)
+return [revlog.linkrev(r) for r in brokenset]
+
+def _collectmanifest(repo, striprev):
+return _collectrevlog(repo.manifestlog._revlog, striprev)
+
 def _collectbrokencsets(repo, files, striprev):
 """return the changesets which will be broken by the truncation"""
 s = set()
-def collectone(revlog):
-_, brokenset = revlog.getstrippoint(striprev)
-s.update([revlog.linkrev(r) for r in brokenset])
 
-collectone(repo.manifestlog._revlog)
+s.update(_collectmanifest(repo, striprev))
 for fname in files:
-collectone(repo.file(fname))
+s.update(_collectrevlog(repo.file(fname), striprev))
 
 return s
 



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


D291: repair: refactor broken linkrev collection

2017-08-09 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  LGTM

REPOSITORY
  rHG Mercurial

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

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


D291: repair: refactor broken linkrev collection

2017-08-08 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This refactors broken linkrev collection such that manifest collection is in a
  separate function. This allows extensions to replace the manifest collection
  with a non-revlog oriented version.
  
  I considered moving the collect changes function onto the manifestlog itself, 
so
  it would be behind the abstraction, but since the store we're building doesn't
  even have the concept of strip, embeding that concept in the manifestlog api
  seemed odd.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/repair.py

CHANGE DETAILS

diff --git a/mercurial/repair.py b/mercurial/repair.py
--- a/mercurial/repair.py
+++ b/mercurial/repair.py
@@ -67,16 +67,20 @@
 
 return sorted(files)
 
+def _collectrevlog(revlog, striprev):
+_, brokenset = revlog.getstrippoint(striprev)
+return [revlog.linkrev(r) for r in brokenset]
+
+def _collectmanifest(repo, striprev):
+return _collectrevlog(repo.manifestlog._revlog, striprev)
+
 def _collectbrokencsets(repo, files, striprev):
 """return the changesets which will be broken by the truncation"""
 s = set()
-def collectone(revlog):
-_, brokenset = revlog.getstrippoint(striprev)
-s.update([revlog.linkrev(r) for r in brokenset])
 
-collectone(repo.manifestlog._revlog)
+s.update(_collectmanifest(repo, striprev))
 for fname in files:
-collectone(repo.file(fname))
+s.update(_collectrevlog(repo.file(fname), striprev))
 
 return s
 



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