Commits

Dan Villiom Podlaski Christiansen committed 6266ba3

Create patch to make normal output much less verbose…

Comments (0)

Files changed (3)

             converted = False
             while not converted and tries < 3:
                 try:
-                    ui.status('converting %s\n' % r)
+                    ui.status(util.describe_revision(r))
                     if have_replay:
                         try:
                             replay_convert_rev(hg_editor, svn, r)
         files_to_grab = set()
         rootpath = svn.subdir and svn.subdir[1:] or ''
         for p in hg_editor.missing_plaintexts:
-            hg_editor.ui.status('.')
+            hg_editor.ui.note('.')
             hg_editor.ui.flush()
             if p[-1] == '/':
                 dirpath = p[len(rootpath):]
                                       if k == 'f'])
             else:
                 files_to_grab.add(p[len(rootpath):])
-        hg_editor.ui.status('\nFetching files...\n')
+        hg_editor.ui.note('\nFetching files...\n')
         for p in files_to_grab:
-            hg_editor.ui.status('.')
+            hg_editor.ui.note('.')
             hg_editor.ui.flush()
             cleanup_file_handles(svn, i)
             i += 1
             data, mode = svn.get_file(p, r.revnum)
             hg_editor.set_file(p, data, 'x' in mode, 'l' in mode)
         hg_editor.missing_plaintexts = set()
-        hg_editor.ui.status('\n')
+        hg_editor.ui.note('\n')
     hg_editor.commit_current_delta()
 
 
             # full fetch on files that had problems.
             raise BadPatchApply('patching failed')
         for x in files_data.iterkeys():
-            ui.status('M  %s\n' % x)
+            ui.note('M  %s\n' % x)
         # if this patch didn't apply right, fall back to exporting the
         # entire rev.
         if patch_st == -1:
                     assert f[0] != '/'
             current_ctx = context.memctx(hg_editor.repo,
                                          [parentctx.node(), revlog.nullid],
-                                         r.message or '...',
+                                         r.message or util.default_commit_msg,
                                          files_touched,
                                          filectxfn,
                                          hg_editor.authorforsvnauthor(r.author),
             ha = hg_editor.repo.commitctx(current_ctx)
             hg_editor.add_to_revmap(r.revnum, b, ha)
             hg_editor._save_metadata()
-            ui.status('committed as %s on branch %s\n' %
-                      (node.hex(ha),  b or 'default'))
+            ui.status(util.describe_commit(ha, b))
     # These are branches which would have an 'R' status in svn log. This means they were
     # replaced by some other branch, so we need to verify they get marked as closed.
     for branch in check_deleted_branches:
         parents = (parent, closed)
         current_ctx = context.memctx(hg_editor.repo,
                                      parents,
-                                     r.message or '...',
+                                     r.message or util.default_commit_msg,
                                      files_touched,
                                      filectxfn,
                                      hg_editor.authorforsvnauthor(r.author),

hg_delta_editor.py

         self.current_files[path] = ''
         self.current_files_exec[path] = False
         self.current_files_symlink[path] = False
-        self.ui.status('D %s\n' % path)
+        self.ui.note('D %s\n' % path)
 
     def _normalize_path(self, path):
         '''Normalize a path to strip of leading slashes and our subdir if we
                                          date,
                                          extra)
             new_hash = self.repo.commitctx(current_ctx)
-            self.ui.status('committed as %s on branch %s\n' %
-                           (node.hex(new_hash), (branch or 'default')))
+
+            self.ui.status(our_util.describe_commit(new_hash, branch))
             if (rev.revnum, branch) not in self.revmap:
                 self.add_to_revmap(rev.revnum, branch, new_hash)
         # now we handle branches that need to be committed without any files
                                          date,
                                          extra)
             new_hash = self.repo.commitctx(current_ctx)
-            self.ui.status('committed as %s on branch %s\n' %
-                           (node.hex(new_hash), (branch or 'default')))
+            self.ui.status(our_util.describe_commit(new_hash, branch))
             if (rev.revnum, branch) not in self.revmap:
                 self.add_to_revmap(rev.revnum, branch, new_hash)
         self.clear_current_info()
         return '%s%s' %(author, self.author_host)
 
     def readauthors(self, authorfile):
-        self.ui.status(
-            ('Reading authormap %s\n')
-            % authorfile)
+        self.ui.note(('Reading authormap from %s\n') % authorfile)
         f = open(authorfile, 'r')
         for line in f:
             if not line.strip():
                 srcauth = srcauth.strip()
                 dstauth = dstauth.strip()
                 if srcauth in self.authors and dstauth != self.authors[srcauth]:
-                    self.ui.status(
-                        ('Overriding mapping for author %s, was %s, now %s\n')
-                        % (srcauth, self.authors[srcauth], dstauth))
+                    self.ui.status(('Overriding author mapping for "%s" ' +
+                                    'from "%s" to "%s"\n')
+                                   % (srcauth, self.authors[srcauth], dstauth))
                 else:
-                    self.ui.debug(('Mapping author %s to %s\n')
-                        % (srcauth, dstauth))
+                    self.ui.debug(('Mapping author "%s" to "%s"\n')
+                                  % (srcauth, dstauth))
                     self.authors[srcauth] = dstauth
             except IndexError:
                 self.ui.warn(
         f.close()
 
     def writeauthors(self):
+        self.ui.debug(('Writing author map to %s\n') % self.authors_file)
         f = open(self.authors_file, 'w+')
-        self.ui.status(
-            ('Writing author map file %s\n')
-            % self.authors_file)
         for author in self.authors:
             f.write("%s=%s\n" % (author, self.authors[author]))
         f.close()
 
     def readfilemap(self, filemapfile):
-        self.ui.status(
-            ('Reading filemap %s\n')
+        self.ui.note(
+            ('Reading file map from %s\n')
             % filemapfile)
         def addpathtomap(path, mapping, mapname):
             if path in mapping:
-                self.ui.warn(
-                    ('%d alreading in %s list\n')
-                    % (path, mapname))
+                self.ui.warn(('Duplicate %s entry in %s: "%d"\n') %
+                             (mapname, filemapfile, path))
             else:
+                self.ui.debug(('%sing %s\n') %
+                              (mapname.capitalize().strip('e'), path))
                 mapping[path] = path
-        
+
         f = open(filemapfile, 'r')
         for line in f:
-            if line.strip() == '':
+            if line.strip() == '' or line.strip()[0] == '#':
                 continue
             try:
                 cmd, path = line.split(' ', 1)
         fpath, branch = self._path_and_branch_for_path(path)
         if fpath:
             self.current_file = path
-            self.ui.status('M %s\n' % path)
+            self.ui.note('M %s\n' % path)
             if base_revision != -1:
                 self.base_revision = base_revision
             else:
         self.current_file = path
         self.should_edit_most_recent_plaintext = False
         if not copyfrom_path:
-            self.ui.status('A %s\n' % path)
+            self.ui.note('A %s\n' % path)
             return
-        self.ui.status('A+ %s\n' % path)
+        self.ui.note('A+ %s\n' % path)
         (from_file,
          from_branch) = self._path_and_branch_for_path(copyfrom_path)
         if not from_file:
 
 def is_svn_repo(repo):
     return os.path.exists(os.path.join(repo.path, 'svn'))
+
+default_commit_msg = '*** empty log message ***'
+
+def describe_revision(r):
+    try:
+        msg = [s for s in map(str.strip, r.message.splitlines()) if s][0]
+    except:
+        msg = default_commit_msg
+
+    return ('[r%d] %s: %s' % (r.revnum, r.author, msg))[:80] + '\n'
+
+def describe_commit(h, b):
+    return ' committed to "%s" as %s\n' % ((b or 'default'), node.short(h))