##// END OF EJS Templates
cleanupnodes: trust caller when "moves" is not None...
Martin von Zweigbergk -
r40890:b7823bd5 default
parent child Browse files
Show More
@@ -901,32 +901,33 b' def cleanupnodes(repo, replacements, ope'
901 901 repls[key] = value
902 902 replacements = repls
903 903
904 # Unfiltered repo is needed since nodes in replacements might be hidden.
905 unfi = repo.unfiltered()
906
904 907 # Calculate bookmark movements
905 908 if moves is None:
906 909 moves = {}
907 # Unfiltered repo is needed since nodes in replacements might be hidden.
908 unfi = repo.unfiltered()
909 for oldnodes, newnodes in replacements.items():
910 for oldnode in oldnodes:
911 if oldnode in moves:
912 continue
913 if len(newnodes) > 1:
914 # usually a split, take the one with biggest rev number
915 newnode = next(unfi.set('max(%ln)', newnodes)).node()
916 elif len(newnodes) == 0:
917 # move bookmark backwards
918 allreplaced = []
919 for rep in replacements:
920 allreplaced.extend(rep)
921 roots = list(unfi.set('max((::%n) - %ln)', oldnode,
922 allreplaced))
923 if roots:
924 newnode = roots[0].node()
910 for oldnodes, newnodes in replacements.items():
911 for oldnode in oldnodes:
912 if oldnode in moves:
913 continue
914 if len(newnodes) > 1:
915 # usually a split, take the one with biggest rev number
916 newnode = next(unfi.set('max(%ln)', newnodes)).node()
917 elif len(newnodes) == 0:
918 # move bookmark backwards
919 allreplaced = []
920 for rep in replacements:
921 allreplaced.extend(rep)
922 roots = list(unfi.set('max((::%n) - %ln)', oldnode,
923 allreplaced))
924 if roots:
925 newnode = roots[0].node()
926 else:
927 newnode = nullid
925 928 else:
926 newnode = nullid
927 else:
928 newnode = newnodes[0]
929 moves[oldnode] = newnode
929 newnode = newnodes[0]
930 moves[oldnode] = newnode
930 931
931 932 allnewnodes = [n for ns in replacements.values() for n in ns]
932 933 toretract = {}
General Comments 0
You need to be logged in to leave comments. Login now