MCPcopy Create free account
hub / github.com/libgit2/pygit2 / MyCheckoutCallbacks

Class MyCheckoutCallbacks

test/test_repository.py:114–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 ref_i18n = testrepo.lookup_reference('refs/heads/i18n')
113
114 class MyCheckoutCallbacks(pygit2.CheckoutCallbacks):
115 def __init__(self) -> None:
116 super().__init__()
117 self.conflicting_paths: set[str] = set()
118 self.updated_paths: set[str] = set()
119 self.completed_steps = -1
120 self.total_steps = -1
121
122 def checkout_notify_flags(self) -> CheckoutNotify:
123 return CheckoutNotify.CONFLICT | CheckoutNotify.UPDATED
124
125 def checkout_notify(
126 self,
127 why: CheckoutNotify,
128 path: str,
129 baseline: Optional[DiffFile],
130 target: Optional[DiffFile],
131 workdir: Optional[DiffFile],
132 ) -> None:
133 if why == CheckoutNotify.CONFLICT:
134 self.conflicting_paths.add(path)
135 elif why == CheckoutNotify.UPDATED:
136 self.updated_paths.add(path)
137
138 def checkout_progress(
139 self, path: str, completed_steps: int, total_steps: int
140 ) -> None:
141 self.completed_steps = completed_steps
142 self.total_steps = total_steps
143
144 # checkout i18n with conflicts and default strategy should not be possible
145 callbacks = MyCheckoutCallbacks()

Callers 2

test_checkout_callbacksFunction · 0.85

Calls

no outgoing calls

Tested by 2

test_checkout_callbacksFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…