Patchwork [2,of,9] obsolete: add an explicit '_succs.copy()' method

login
register
mail settings
Submitter Boris Feld
Date July 6, 2017, 9:50 p.m.
Message ID <f1e0955f8dda31eef2a6.1499377810@FB>
Download mbox | patch
Permalink /patch/22044/
State Changes Requested, archived
Headers show

Comments

Boris Feld - July 6, 2017, 9:50 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1499044397 -7200
#      Mon Jul 03 03:13:17 2017 +0200
# Node ID f1e0955f8dda31eef2a65380ea97c35cb637810e
# Parent  105c150648b0c43c240b27047d0be89359932d10
# EXP-Topic obsfatetemplate
obsolete: add an explicit '_succs.copy()' method

Mimic the standard API for copying in the _succs class, it makes the code
slightly cleaner and will be needed later for copying markers at the same time
than copying the list content.

Patch

diff -r 105c150648b0 -r f1e0955f8dda mercurial/obsutil.py
--- a/mercurial/obsutil.py	Mon Jul 03 00:53:55 2017 +0200
+++ b/mercurial/obsutil.py	Mon Jul 03 03:13:17 2017 +0200
@@ -314,6 +314,9 @@ 
 class _succs(list):
     """small class to represent a successors with some metadata about it"""
 
+    def copy(self):
+        return _succs(self)
+
 def successorssets(repo, initialnode, closest=False, cache=None):
     """Return set of all latest successors of initial nodes
 
@@ -514,7 +517,7 @@ 
                         productresult = []
                         for prefix in markss:
                             for suffix in cache[suc]:
-                                newss = _succs(prefix)
+                                newss = prefix.copy()
                                 for part in suffix:
                                     # do not duplicated entry in successors set
                                     # first entry wins.