@@ -99,6 +99,8 @@ def __init__(self):
99
99
super ().__init__ ()
100
100
self .conflicting_paths = set ()
101
101
self .updated_paths = set ()
102
+ self .completed_steps = - 1
103
+ self .total_steps = - 1
102
104
103
105
def checkout_notify_flags (self ) -> CheckoutNotify :
104
106
return CheckoutNotify .CONFLICT | CheckoutNotify .UPDATED
@@ -109,12 +111,17 @@ def checkout_notify(self, why, path, baseline, target, workdir):
109
111
elif why == CheckoutNotify .UPDATED :
110
112
self .updated_paths .add (path )
111
113
114
+ def checkout_progress (self , path : str , completed_steps : int , total_steps : int ):
115
+ self .completed_steps = completed_steps
116
+ self .total_steps = total_steps
117
+
112
118
# checkout i18n with conflicts and default strategy should not be possible
113
119
callbacks = MyCheckoutCallbacks ()
114
120
with pytest .raises (pygit2 .GitError ):
115
121
testrepo .checkout (ref_i18n , callbacks = callbacks )
116
122
# make sure the callbacks caught that
117
123
assert {'bye.txt' } == callbacks .conflicting_paths
124
+ assert - 1 == callbacks .completed_steps # shouldn't have done anything
118
125
119
126
# checkout i18n with GIT_CHECKOUT_FORCE
120
127
head = testrepo .head
@@ -125,6 +132,8 @@ def checkout_notify(self, why, path, baseline, target, workdir):
125
132
# make sure the callbacks caught the files affected by the checkout
126
133
assert set () == callbacks .conflicting_paths
127
134
assert {'bye.txt' , 'new' } == callbacks .updated_paths
135
+ assert callbacks .completed_steps > 0
136
+ assert callbacks .completed_steps == callbacks .total_steps
128
137
129
138
130
139
def test_checkout_aborted_from_callbacks (testrepo ):
0 commit comments