The callers mostly have context objects, so let's avoid looking up the
same context objects inside duplicatecopies().
I also renamed the function to graftcopies() since I think that
better matches its purpose. I did it in the same commit so it's easier
for extensions to switch between the functions.