Skip to content

Commit c9a57dd

Browse files
committed
Remove unused "check merged" code path
The common.push_patches() function no longer has any callers that use the check_merged argument. Code exclusive to this path is now eliminated. Signed-off-by: Peter Grayson <[email protected]>
1 parent 5a3469b commit c9a57dd

File tree

2 files changed

+8
-57
lines changed

2 files changed

+8
-57
lines changed

stgit/commands/common.py

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def print_crt_patch(crt_series, branch=None):
194194
out.info('No patches applied')
195195

196196

197-
def push_patches(crt_series, patches, check_merged=False):
197+
def push_patches(crt_series, patches):
198198
"""Push multiple patches onto the stack. This function is shared
199199
between the push and pull commands
200200
"""
@@ -207,31 +207,17 @@ def push_patches(crt_series, patches, check_merged=False):
207207

208208
names = patches[forwarded:]
209209

210-
# check for patches merged upstream
211-
if names and check_merged:
212-
out.start('Checking for patches merged upstream')
213-
214-
merged = crt_series.merged_patches(names)
215-
216-
out.done('%d found' % len(merged))
217-
else:
218-
merged = []
219-
220210
for p in names:
221211
out.start('Pushing patch "%s"' % p)
222212

223-
if p in merged:
224-
crt_series.push_empty_patch(p)
225-
out.done('merged upstream')
226-
else:
227-
modified = crt_series.push_patch(p)
213+
modified = crt_series.push_patch(p)
228214

229-
if crt_series.empty_patch(p):
230-
out.done('empty patch')
231-
elif modified:
232-
out.done('modified')
233-
else:
234-
out.done()
215+
if crt_series.empty_patch(p):
216+
out.done('empty patch')
217+
elif modified:
218+
out.done('modified')
219+
else:
220+
out.done()
235221

236222

237223
def pop_patches(crt_series, patches, keep=False):

stgit/stack.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -989,41 +989,6 @@ def forward_patches(self, names):
989989

990990
return forwarded
991991

992-
def merged_patches(self, names):
993-
"""Test which patches were merged upstream by reverse-applying
994-
them in reverse order. The function returns the list of
995-
patches detected to have been applied. The state of the tree
996-
is restored to the original one
997-
"""
998-
patches = [self.get_patch(name) for name in names]
999-
patches.reverse()
1000-
1001-
merged = []
1002-
for p in patches:
1003-
if git.apply_diff(p.get_top(), p.get_bottom()):
1004-
merged.append(p.name)
1005-
merged.reverse()
1006-
1007-
git.reset()
1008-
1009-
return merged
1010-
1011-
def push_empty_patch(self, name):
1012-
"""Pushes an empty patch on the stack
1013-
"""
1014-
unapplied = self.get_unapplied()
1015-
assert(name in unapplied)
1016-
1017-
# patch = self.get_patch(name)
1018-
head = git.get_head()
1019-
1020-
append_string(self._applied_file, name)
1021-
1022-
unapplied.remove(name)
1023-
write_strings(self._unapplied_file, unapplied)
1024-
1025-
self.refresh_patch(bottom=head, cache_update=False, log='push(m)')
1026-
1027992
def push_patch(self, name):
1028993
"""Pushes a patch on the stack
1029994
"""

0 commit comments

Comments
 (0)