Undo a previously injected patch

undo_patch(pkg, names = NULL)

Arguments

pkg

Package name or environment.

names

Character vector of patched object names to restore. If NULL, restore all stored backups for pkg.

Value

Invisibly TRUE on success.

Examples

# First inject a patch
inject_patch(
  pkg = "hotpatchR",
  patch_list = list(dummy_child_func = function(x) {
    paste("I am PATCHED! Input:", x)
  })
)

# Call with patched function
patched <- dummy_parent_func("test")
print(patched)
#> [1] "Parent output -> I am PATCHED! Input: test"

# Restore the original function
undo_patch(pkg = "hotpatchR", names = "dummy_child_func")

# Now it's back to the original
restored <- dummy_parent_func("test")
print(restored)
#> [1] "Parent output -> I am the BROKEN child. Input: test"