Refactor message printing
[stgit] / stgit / commands / assimilate.py
index 0821024..e5ebb55 100644 (file)
@@ -42,7 +42,7 @@ def func(parser, options, args):
     """
 
     def nothing_to_do():
-        print 'No commits to assimilate'
+        out.info('No commits to assimilate')
 
     top_patch = crt_series.get_current_patch()
     if not top_patch:
@@ -73,21 +73,14 @@ def func(parser, options, args):
         return name in name2patch or crt_series.patch_exists(name)
 
     for victim in victims:
-        patchname = make_patch_name(victim.get_log())
-        if not patchname:
-            patchname = 'patch'
-        if name_taken(patchname):
-            suffix = 0
-            while name_taken('%s-%d' % (patchname, suffix)):
-                suffix += 1
-            patchname = '%s-%d' % (patchname, suffix)
+        patchname = make_patch_name(victim.get_log(), name_taken)
         patch2name[victim] = patchname
         name2patch[patchname] = victim
 
     victims.reverse()
     for victim in victims:
-        print ('Creating patch "%s" from commit %s'
-               % (patch2name[victim], victim))
+        out.info('Creating patch "%s" from commit %s'
+                 % (patch2name[victim], victim))
         aname, amail, adate = name_email_date(victim.get_author())
         cname, cmail, cdate = name_email_date(victim.get_committer())
         crt_series.new_patch(