D6390: commit: move sorting of added and removed files list to lower level

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

REVISION SUMMARY
  localrepo.commitctx() has lists of all changed files, as well as lists
  of added and removed files. The list of all files is unsorted and
  changelog.add() will sort it. Let's also sort the lists of added and
  removed files at a lower level (manifestrevlog.add()) for
  consistency. I don't think this will be a performance problem (someone
  should have fixed the sorting in changelog.add() if it were).

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/manifest.py

CHANGE DETAILS

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1486,8 +1486,8 @@
 
 _checkforbidden(added)
 # combine the changed lists into one sorted iterator
-work = heapq.merge([(x, False) for x in added],
-   [(x, True) for x in removed])
+work = heapq.merge([(x, False) for x in sorted(added)],
+   [(x, True) for x in sorted(removed)])
 
 arraytext, deltatext = m.fastdelta(self.fulltextcache[p1], work)
 cachedelta = self._revlog.rev(p1), deltatext
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2615,8 +2615,8 @@
 raise
 
 # update manifest
-removed = [f for f in sorted(removed) if f in m1 or f in m2]
-drop = [f for f in removed if f in m]
+removed = [f for f in removed if f in m1 or f in m2]
+drop = sorted([f for f in removed if f in m])
 for f in drop:
 del m[f]
 files = changed + removed



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


D6390: commit: move sorting of added and removed files list to lower level

2019-05-16 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  The changes looks okay but I can't think why you want to do that. Can you add 
some details about the motivation for this change to commit message?

REPOSITORY
  rHG Mercurial

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

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


D6390: commit: move sorting of added and removed files list to lower level

2019-05-16 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D6390#92963, @pulkit wrote:
  
  > The changes looks okay but I can't think why you want to do that. Can you 
add some details about the motivation for this change to commit message?
  
  
  It was mostly just consistency, but I'll add a bit more

REPOSITORY
  rHG Mercurial

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

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


D6390: commit: move sorting of added and removed files list to lower level

2019-05-20 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6310180662f5: commit: move sorting of added and removed 
files list to lower level (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6390?vs=15150&id=15199

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

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/manifest.py

CHANGE DETAILS

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1486,8 +1486,8 @@
 
 _checkforbidden(added)
 # combine the changed lists into one sorted iterator
-work = heapq.merge([(x, False) for x in added],
-   [(x, True) for x in removed])
+work = heapq.merge([(x, False) for x in sorted(added)],
+   [(x, True) for x in sorted(removed)])
 
 arraytext, deltatext = m.fastdelta(self.fulltextcache[p1], work)
 cachedelta = self._revlog.rev(p1), deltatext
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2641,8 +2641,8 @@
 raise
 
 # update manifest
-removed = [f for f in sorted(removed) if f in m1 or f in m2]
-drop = [f for f in removed if f in m]
+removed = [f for f in removed if f in m1 or f in m2]
+drop = sorted([f for f in removed if f in m])
 for f in drop:
 del m[f]
 files = changed + removed



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