i18n: mark strings for translation in convert extension
authorMartin Geisler <mg@daimi.au.dk>
Sun, 31 Aug 2008 16:12:02 +0200
changeset 6956 12472a240398
parent 6955 a9411e29773f
child 6957 bd979854a388
i18n: mark strings for translation in convert extension
hgext/convert/common.py
hgext/convert/convcmd.py
hgext/convert/cvs.py
hgext/convert/cvsps.py
hgext/convert/darcs.py
hgext/convert/hg.py
hgext/convert/subversion.py
--- a/hgext/convert/common.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/common.py	Sun Aug 31 16:12:02 2008 +0200
@@ -228,7 +228,7 @@
 
     def _run(self, cmd, *args, **kwargs):
         cmdline = self._cmdline(cmd, *args, **kwargs)
-        self.ui.debug('running: %s\n' % (cmdline,))
+        self.ui.debug(_('running: %s\n') % (cmdline,))
         self.prerun()
         try:
             return util.popen(cmdline)
--- a/hgext/convert/convcmd.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/convcmd.py	Sun Aug 31 16:12:02 2008 +0200
@@ -184,7 +184,7 @@
     def writeauthormap(self):
         authorfile = self.authorfile
         if authorfile:
-           self.ui.status('Writing author map file %s\n' % authorfile)
+           self.ui.status(_('Writing author map file %s\n') % authorfile)
            ofile = open(authorfile, 'w+')
            for author in self.authors:
                ofile.write("%s=%s\n" % (author, self.authors[author]))
@@ -201,15 +201,15 @@
                 dstauthor = dstauthor.strip()
                 if srcauthor in self.authors and dstauthor != self.authors[srcauthor]:
                     self.ui.status(
-                        'Overriding mapping for author %s, was %s, will be %s\n'
+                        _('Overriding mapping for author %s, was %s, will be %s\n')
                         % (srcauthor, self.authors[srcauthor], dstauthor))
                 else:
-                    self.ui.debug('Mapping author %s to %s\n'
+                    self.ui.debug(_('Mapping author %s to %s\n')
                                   % (srcauthor, dstauthor))
                     self.authors[srcauthor] = dstauthor
             except IndexError:
                 self.ui.warn(
-                    'Ignoring bad line in author map file %s: %s\n'
+                    _('Ignoring bad line in author map file %s: %s\n')
                     % (authorfile, line.rstrip()))
         afile.close()
 
@@ -241,7 +241,7 @@
         self.dest.setbranch(commit.branch, pbranches)
         try:
             parents = self.splicemap[rev].replace(',', ' ').split()
-            self.ui.status('spliced in %s as parents of %s\n' %
+            self.ui.status(_('spliced in %s as parents of %s\n') %
                            (parents, rev))
             parents = [self.map.get(p, p) for p in parents]
         except KeyError:
@@ -256,15 +256,15 @@
             self.source.before()
             self.dest.before()
             self.source.setrevmap(self.map)
-            self.ui.status("scanning source...\n")
+            self.ui.status(_("scanning source...\n"))
             heads = self.source.getheads()
             parents = self.walktree(heads)
-            self.ui.status("sorting...\n")
+            self.ui.status(_("sorting...\n"))
             t = self.toposort(parents)
             num = len(t)
             c = None
 
-            self.ui.status("converting...\n")
+            self.ui.status(_("converting...\n"))
             for c in t:
                 num -= 1
                 desc = self.commitcache[c].desc
@@ -309,7 +309,7 @@
 
     if not dest:
         dest = hg.defaultdest(src) + "-hg"
-        ui.status("assuming destination %s\n" % dest)
+        ui.status(_("assuming destination %s\n") % dest)
 
     destc = convertsink(ui, dest, opts.get('dest_type'))
 
--- a/hgext/convert/cvs.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/cvs.py	Sun Aug 31 16:12:02 2008 +0200
@@ -54,7 +54,7 @@
                     util.parsedate(self.rev, ['%Y/%m/%d %H:%M:%S'])
                     cmd = '%s -d "1970/01/01 00:00:01" -d "%s"' % (cmd, self.rev)
                 except util.Abort:
-                    raise util.Abort('revision %s is not a patchset number or date' % self.rev)
+                    raise util.Abort(_('revision %s is not a patchset number or date') % self.rev)
 
         d = os.getcwd()
         try:
@@ -181,7 +181,7 @@
         user, host = None, None
         cmd = ['cvs', 'server']
 
-        self.ui.status("connecting to %s\n" % root)
+        self.ui.status(_("connecting to %s\n") % root)
 
         if root.startswith(":pserver:"):
             root = root[9:]
@@ -221,7 +221,7 @@
                 sck.send("\n".join(["BEGIN AUTH REQUEST", root, user, passw,
                                     "END AUTH REQUEST", ""]))
                 if sck.recv(128) != "I LOVE YOU\n":
-                    raise util.Abort("CVS pserver authentication failed")
+                    raise util.Abort(_("CVS pserver authentication failed"))
 
                 self.writep = self.readp = sck.makefile('r+')
 
@@ -264,7 +264,7 @@
         self.writep.flush()
         r = self.readp.readline()
         if not r.startswith("Valid-requests"):
-            raise util.Abort("server sucks")
+            raise util.Abort(_("server sucks"))
         if "UseUnchanged" in r:
             self.writep.write("UseUnchanged\n")
             self.writep.flush()
@@ -283,7 +283,7 @@
             while count > 0:
                 data = fp.read(min(count, chunksize))
                 if not data:
-                    raise util.Abort("%d bytes missing from remote file" % count)
+                    raise util.Abort(_("%d bytes missing from remote file") % count)
                 count -= len(data)
                 output.write(data)
             return output.getvalue()
@@ -318,14 +318,14 @@
                 if line == "ok\n":
                     return (data, "x" in mode and "x" or "")
                 elif line.startswith("E "):
-                    self.ui.warn("cvs server: %s\n" % line[2:])
+                    self.ui.warn(_("cvs server: %s\n") % line[2:])
                 elif line.startswith("Remove"):
                     l = self.readp.readline()
                     l = self.readp.readline()
                     if l != "ok\n":
-                        raise util.Abort("unknown CVS response: %s" % l)
+                        raise util.Abort(_("unknown CVS response: %s") % l)
                 else:
-                    raise util.Abort("unknown CVS response: %s" % line)
+                    raise util.Abort(_("unknown CVS response: %s") % line)
 
     def getfile(self, file, rev):
         data, mode = self._getfile(file, rev)
--- a/hgext/convert/cvsps.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/cvsps.py	Sun Aug 31 16:12:02 2008 +0200
@@ -150,8 +150,8 @@
     store = False # set when a new record can be appended
 
     cmd = [util.shellquote(arg) for arg in cmd]
-    ui.note("running %s\n" % (' '.join(cmd)))
-    ui.debug("prefix=%r directory=%r root=%r\n" % (prefix, directory, root))
+    ui.note(_("running %s\n") % (' '.join(cmd)))
+    ui.debug(_("prefix=%r directory=%r root=%r\n") % (prefix, directory, root))
 
     for line in util.popen(' '.join(cmd)):
         if line.endswith('\n'):
--- a/hgext/convert/darcs.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/darcs.py	Sun Aug 31 16:12:02 2008 +0200
@@ -66,7 +66,7 @@
         self.parents[child] = []
 
     def after(self):
-        self.ui.debug('cleaning up %s\n' % self.tmppath)
+        self.ui.debug(_('cleaning up %s\n') % self.tmppath)
         shutil.rmtree(self.tmppath, ignore_errors=True)
 
     def xml(self, cmd, **kwargs):
--- a/hgext/convert/hg.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/hg.py	Sun Aug 31 16:12:02 2008 +0200
@@ -177,7 +177,7 @@
          def getfilectx(repo, memctx, f):
             return context.memfilectx(f, data, False, False, None)
 
-         self.ui.status("updating tags\n")
+         self.ui.status(_("updating tags\n"))
          date = "%s 0" % int(time.mktime(time.gmtime()))
          extra = {'branch': self.tagsbranch}
          ctx = context.memctx(self.repo, (tagparent, None), "update tags",
--- a/hgext/convert/subversion.py	Sun Aug 31 16:12:02 2008 +0200
+++ b/hgext/convert/subversion.py	Sun Aug 31 16:12:02 2008 +0200
@@ -189,7 +189,7 @@
             try:
                 latest = int(rev)
             except ValueError:
-                raise util.Abort('svn: revision %s is not an integer' % rev)
+                raise util.Abort(_('svn: revision %s is not an integer') % rev)
 
         self.startrev = self.ui.config('convert', 'svn.startrev', default=0)
         try:
@@ -290,7 +290,7 @@
                     self.ui.note(_('ignoring empty branch %s\n') %
                                    branch.encode(self.encoding))
                     continue
-                self.ui.note('found branch %s at %d\n' %
+                self.ui.note(_('found branch %s at %d\n') %
                              (branch, self.revnum(brevid)))
                 self.heads.append(brevid)
 
@@ -420,7 +420,7 @@
                 tagspath = srctagspath
 
         except SubversionException, (inst, num):
-            self.ui.note('no tags found at revision %d\n' % start)
+            self.ui.note(_('no tags found at revision %d\n') % start)
         return tags
 
     def converted(self, rev, destrev):
@@ -473,7 +473,7 @@
         except SubversionException:
             dirent = None
         if not dirent:
-            raise util.Abort('%s not found up to revision %d' % (path, stop))
+            raise util.Abort(_('%s not found up to revision %d') % (path, stop))
 
         # stat() gives us the previous revision on this line of development, but
         # it might be in *another module*. Fetch the log and detect renames down
@@ -489,7 +489,7 @@
                     if not path.startswith(p) or not paths[p].copyfrom_path:
                         continue
                     newpath = paths[p].copyfrom_path + path[len(p):]
-                    self.ui.debug("branch renamed from %s to %s at %d\n" %
+                    self.ui.debug(_("branch renamed from %s to %s at %d\n") %
                                   (path, newpath, revnum))
                     path = newpath
                     break
@@ -528,7 +528,7 @@
         prevmodule = self.prevmodule
         if prevmodule is None:
             prevmodule = ''
-        self.ui.debug("reparent to %s\n" % svn_url)
+        self.ui.debug(_("reparent to %s\n") % svn_url)
         svn.ra.reparent(self.ra, svn_url)
         self.prevmodule = module
         return prevmodule
@@ -560,11 +560,11 @@
                 copyfrom_path = self.getrelpath(ent.copyfrom_path, pmodule)
                 if not copyfrom_path:
                     continue
-                self.ui.debug("copied to %s from %s@%s\n" %
+                self.ui.debug(_("copied to %s from %s@%s\n") %
                               (entrypath, copyfrom_path, ent.copyfrom_rev))
                 copies[self.recode(entry)] = self.recode(copyfrom_path)
             elif kind == 0: # gone, but had better be a deleted *file*
-                self.ui.debug("gone from %s\n" % ent.copyfrom_rev)
+                self.ui.debug(_("gone from %s\n") % ent.copyfrom_rev)
 
                 # if a branch is created but entries are removed in the same
                 # changeset, get the right fromrev
@@ -582,22 +582,22 @@
                         part = "/".join(parts[:i])
                         info = part, copyfrom.get(part, None)
                         if info[1] is not None:
-                            self.ui.debug("Found parent directory %s\n" % info[1])
+                            self.ui.debug(_("Found parent directory %s\n") % info[1])
                             rc = info
                     return rc
 
-                self.ui.debug("base, entry %s %s\n" % (basepath, entrypath))
+                self.ui.debug(_("base, entry %s %s\n") % (basepath, entrypath))
 
                 frompath, froment = lookup_parts(entrypath) or (None, revnum - 1)
 
                 # need to remove fragment from lookup_parts and replace with copyfrom_path
                 if frompath is not None:
-                    self.ui.debug("munge-o-matic\n")
+                    self.ui.debug(_("munge-o-matic\n"))
                     self.ui.debug(entrypath + '\n')
                     self.ui.debug(entrypath[len(frompath):] + '\n')
                     entrypath = froment.copyfrom_path + entrypath[len(frompath):]
                     fromrev = froment.copyfrom_rev
-                    self.ui.debug("Info: %s %s %s %s\n" % (frompath, froment, ent, entrypath))
+                    self.ui.debug(_("Info: %s %s %s %s\n") % (frompath, froment, ent, entrypath))
 
                 # We can avoid the reparent calls if the module has not changed
                 # but it probably does not worth the pain.
@@ -638,7 +638,7 @@
                             else:
                                 entries.append(entry)
                 else:
-                    self.ui.debug('unknown path in revision %d: %s\n' % \
+                    self.ui.debug(_('unknown path in revision %d: %s\n') % \
                                   (revnum, path))
             elif kind == svn.core.svn_node_dir:
                 # Should probably synthesize normal file entries
@@ -684,7 +684,7 @@
                 if not copyfrompath:
                     continue
                 copyfrom[path] = ent
-                self.ui.debug("mark %s came from %s:%d\n"
+                self.ui.debug(_("mark %s came from %s:%d\n")
                               % (path, copyfrompath, ent.copyfrom_rev))
                 children = self._find_children(ent.copyfrom_path, ent.copyfrom_rev)
                 children.sort()
@@ -715,7 +715,7 @@
             """Return the parsed commit object or None, and True if
             the revision is a branch root.
             """
-            self.ui.debug("parsing revision %d (%d changes)\n" %
+            self.ui.debug(_("parsing revision %d (%d changes)\n") %
                           (revnum, len(orig_paths)))
 
             branched = False
@@ -752,10 +752,10 @@
                         prevmodule, prevnum = self.revsplit(previd)[1:]
                         if prevnum >= self.startrev:
                             parents = [previd]
-                            self.ui.note('found parent of branch %s at %d: %s\n' %
+                            self.ui.note(_('found parent of branch %s at %d: %s\n') %
                                          (self.module, prevnum, prevmodule))
                 else:
-                    self.ui.debug("No copyfrom path, don't know what to do.\n")
+                    self.ui.debug(_("No copyfrom path, don't know what to do.\n"))
 
             paths = []
             # filter out unrelated paths
@@ -794,7 +794,7 @@
             self.child_cset = cset
             return cset, branched
 
-        self.ui.note('fetching revision log for "%s" from %d to %d\n' %
+        self.ui.note(_('fetching revision log for "%s" from %d to %d\n') %
                      (self.module, from_revnum, to_revnum))
 
         try:
@@ -808,11 +808,11 @@
                         lastonbranch = True
                         break
                     if self.is_blacklisted(revnum):
-                        self.ui.note('skipping blacklisted revision %d\n'
+                        self.ui.note(_('skipping blacklisted revision %d\n')
                                      % revnum)
                         continue
                     if paths is None:
-                        self.ui.debug('revision %d has no entries\n' % revnum)
+                        self.ui.debug(_('revision %d has no entries\n') % revnum)
                         continue
                     cset, lastonbranch = parselogentry(paths, revnum, author,
                                                        date, message)
@@ -837,7 +837,7 @@
                     pass
         except SubversionException, (inst, num):
             if num == svn.core.SVN_ERR_FS_NO_SUCH_REVISION:
-                raise util.Abort('svn: branch has no revision %s' % to_revnum)
+                raise util.Abort(_('svn: branch has no revision %s') % to_revnum)
             raise
 
     def _getfile(self, file, rev):
@@ -890,7 +890,7 @@
                 return relative
 
         # The path is outside our tracked tree...
-        self.ui.debug('%r is not under %r, ignoring\n' % (path, module))
+        self.ui.debug(_('%r is not under %r, ignoring\n') % (path, module))
         return None
 
     def _checkpath(self, path, revnum):