##// END OF EJS Templates
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot -
r1402:9d2c2e6b default
parent child Browse files
Show More
@@ -44,11 +44,11 class changelog(revlog):
44 try:
44 try:
45 when, offset = map(int, date.split(' '))
45 when, offset = map(int, date.split(' '))
46 except ValueError:
46 except ValueError:
47 raise ValueError('invalid date: %r' % date)
47 raise ValueError(_('invalid date: %r') % date)
48 if abs(when) > 0x7fffffff:
48 if abs(when) > 0x7fffffff:
49 raise ValueError('date exceeds 32 bits: %d' % when)
49 raise ValueError(_('date exceeds 32 bits: %d') % when)
50 if abs(offset) >= 43200:
50 if abs(offset) >= 43200:
51 raise ValueError('impossible time zone offset: %d' % offset)
51 raise ValueError(_('impossible time zone offset: %d') % offset)
52 else:
52 else:
53 date = "%d %d" % util.makedate()
53 date = "%d %d" % util.makedate()
54 list.sort()
54 list.sort()
This diff has been collapsed as it changes many lines, (614 lines changed) Show them Hide them
@@ -179,7 +179,7 def revrange(ui, repo, revs, revlog=None
179 try:
179 try:
180 num = revlog.rev(revlog.lookup(val))
180 num = revlog.rev(revlog.lookup(val))
181 except KeyError:
181 except KeyError:
182 raise util.Abort('invalid revision identifier %s', val)
182 raise util.Abort(_('invalid revision identifier %s'), val)
183 return num
183 return num
184 seen = {}
184 seen = {}
185 for spec in revs:
185 for spec in revs:
@@ -239,7 +239,7 def make_filename(repo, r, pat, node=Non
239 i += 1
239 i += 1
240 return ''.join(newname)
240 return ''.join(newname)
241 except KeyError, inst:
241 except KeyError, inst:
242 raise util.Abort("invalid format spec '%%%s' in output file name",
242 raise util.Abort(_("invalid format spec '%%%s' in output file name"),
243 inst.args[0])
243 inst.args[0])
244
244
245 def make_file(repo, r, pat, node=None,
245 def make_file(repo, r, pat, node=None,
@@ -333,52 +333,52 def show_changeset(ui, repo, rev=0, chan
333 parents = []
333 parents = []
334
334
335 if ui.verbose:
335 if ui.verbose:
336 ui.write("changeset: %d:%s\n" % (rev, hex(changenode)))
336 ui.write(_("changeset: %d:%s\n") % (rev, hex(changenode)))
337 else:
337 else:
338 ui.write("changeset: %d:%s\n" % (rev, short(changenode)))
338 ui.write(_("changeset: %d:%s\n") % (rev, short(changenode)))
339
339
340 for tag in repo.nodetags(changenode):
340 for tag in repo.nodetags(changenode):
341 ui.status("tag: %s\n" % tag)
341 ui.status(_("tag: %s\n") % tag)
342 for parent in parents:
342 for parent in parents:
343 ui.write("parent: %d:%s\n" % parent)
343 ui.write(_("parent: %d:%s\n") % parent)
344
344
345 if brinfo and changenode in brinfo:
345 if brinfo and changenode in brinfo:
346 br = brinfo[changenode]
346 br = brinfo[changenode]
347 ui.write("branch: %s\n" % " ".join(br))
347 ui.write(_("branch: %s\n") % " ".join(br))
348
348
349 ui.debug("manifest: %d:%s\n" % (repo.manifest.rev(changes[0]),
349 ui.debug(_("manifest: %d:%s\n") % (repo.manifest.rev(changes[0]),
350 hex(changes[0])))
350 hex(changes[0])))
351 ui.status("user: %s\n" % changes[1])
351 ui.status(_("user: %s\n") % changes[1])
352 ui.status("date: %s\n" % date)
352 ui.status(_("date: %s\n") % date)
353
353
354 if ui.debugflag:
354 if ui.debugflag:
355 files = repo.changes(log.parents(changenode)[0], changenode)
355 files = repo.changes(log.parents(changenode)[0], changenode)
356 for key, value in zip(["files:", "files+:", "files-:"], files):
356 for key, value in zip([_("files:"), _("files+:"), _("files-:")], files):
357 if value:
357 if value:
358 ui.note("%-12s %s\n" % (key, " ".join(value)))
358 ui.note("%-12s %s\n" % (key, " ".join(value)))
359 else:
359 else:
360 ui.note("files: %s\n" % " ".join(changes[3]))
360 ui.note(_("files: %s\n") % " ".join(changes[3]))
361
361
362 description = changes[4].strip()
362 description = changes[4].strip()
363 if description:
363 if description:
364 if ui.verbose:
364 if ui.verbose:
365 ui.status("description:\n")
365 ui.status(_("description:\n"))
366 ui.status(description)
366 ui.status(description)
367 ui.status("\n\n")
367 ui.status("\n\n")
368 else:
368 else:
369 ui.status("summary: %s\n" % description.splitlines()[0])
369 ui.status(_("summary: %s\n") % description.splitlines()[0])
370 ui.status("\n")
370 ui.status("\n")
371
371
372 def show_version(ui):
372 def show_version(ui):
373 """output version and copyright information"""
373 """output version and copyright information"""
374 ui.write("Mercurial Distributed SCM (version %s)\n"
374 ui.write(_("Mercurial Distributed SCM (version %s)\n")
375 % version.get_version())
375 % version.get_version())
376 ui.status(
376 ui.status(_(
377 "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n"
377 "\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n"
378 "This is free software; see the source for copying conditions. "
378 "This is free software; see the source for copying conditions. "
379 "There is NO\nwarranty; "
379 "There is NO\nwarranty; "
380 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
380 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
381 )
381 ))
382
382
383 def help_(ui, cmd=None, with_version=False):
383 def help_(ui, cmd=None, with_version=False):
384 """show help for a given command or all commands"""
384 """show help for a given command or all commands"""
@@ -401,7 +401,7 def help_(ui, cmd=None, with_version=Fal
401 # aliases
401 # aliases
402 aliases = ', '.join(key.split('|')[1:])
402 aliases = ', '.join(key.split('|')[1:])
403 if aliases:
403 if aliases:
404 ui.write("\naliases: %s\n" % aliases)
404 ui.write(_("\naliases: %s\n") % aliases)
405
405
406 # options
406 # options
407 if i[1]:
407 if i[1]:
@@ -412,18 +412,18 def help_(ui, cmd=None, with_version=Fal
412 if ui.verbose or with_version:
412 if ui.verbose or with_version:
413 show_version(ui)
413 show_version(ui)
414 else:
414 else:
415 ui.status("Mercurial Distributed SCM\n")
415 ui.status(_("Mercurial Distributed SCM\n"))
416 ui.status('\n')
416 ui.status('\n')
417
417
418 # list of commands
418 # list of commands
419 if cmd == "shortlist":
419 if cmd == "shortlist":
420 ui.status('basic commands (use "hg help" '
420 ui.status(_('basic commands (use "hg help" '
421 'for the full list or option "-v" for details):\n\n')
421 'for the full list or option "-v" for details):\n\n'))
422 elif ui.verbose:
422 elif ui.verbose:
423 ui.status('list of commands:\n\n')
423 ui.status(_('list of commands:\n\n'))
424 else:
424 else:
425 ui.status('list of commands (use "hg help -v" '
425 ui.status(_('list of commands (use "hg help -v" '
426 'to show aliases and global options):\n\n')
426 'to show aliases and global options):\n\n'))
427
427
428 h = {}
428 h = {}
429 cmds = {}
429 cmds = {}
@@ -462,7 +462,7 def help_(ui, cmd=None, with_version=Fal
462 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
462 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
463 longopt and " --%s" % longopt),
463 longopt and " --%s" % longopt),
464 "%s%s" % (desc,
464 "%s%s" % (desc,
465 default and " (default: %s)" % default
465 default and _(" (default: %s)") % default
466 or "")))
466 or "")))
467
467
468 if opt_output:
468 if opt_output:
@@ -480,10 +480,10 def add(ui, repo, *pats, **opts):
480 names = []
480 names = []
481 for src, abs, rel, exact in walk(repo, pats, opts):
481 for src, abs, rel, exact in walk(repo, pats, opts):
482 if exact:
482 if exact:
483 if ui.verbose: ui.status('adding %s\n' % rel)
483 if ui.verbose: ui.status(_('adding %s\n') % rel)
484 names.append(abs)
484 names.append(abs)
485 elif repo.dirstate.state(abs) == '?':
485 elif repo.dirstate.state(abs) == '?':
486 ui.status('adding %s\n' % rel)
486 ui.status(_('adding %s\n') % rel)
487 names.append(abs)
487 names.append(abs)
488 repo.add(names)
488 repo.add(names)
489
489
@@ -494,11 +494,11 def addremove(ui, repo, *pats, **opts):
494 if src == 'f' and repo.dirstate.state(abs) == '?':
494 if src == 'f' and repo.dirstate.state(abs) == '?':
495 add.append(abs)
495 add.append(abs)
496 if ui.verbose or not exact:
496 if ui.verbose or not exact:
497 ui.status('adding ', rel, '\n')
497 ui.status(_('adding %s\n') % rel)
498 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
498 if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel):
499 remove.append(abs)
499 remove.append(abs)
500 if ui.verbose or not exact:
500 if ui.verbose or not exact:
501 ui.status('removing ', rel, '\n')
501 ui.status(_('removing %s\n') % rel)
502 repo.add(add)
502 repo.add(add)
503 repo.remove(remove)
503 repo.remove(remove)
504
504
@@ -513,7 +513,7 def annotate(ui, repo, *pats, **opts):
513 return trimuser(ui, cl[1], rev, ucache)
513 return trimuser(ui, cl[1], rev, ucache)
514
514
515 if not pats:
515 if not pats:
516 raise util.Abort('at least one file name or pattern required')
516 raise util.Abort(_('at least one file name or pattern required'))
517
517
518 opmap = [['user', getname], ['number', str], ['changeset', getnode]]
518 opmap = [['user', getname], ['number', str], ['changeset', getnode]]
519 if not opts['user'] and not opts['changeset']:
519 if not opts['user'] and not opts['changeset']:
@@ -528,12 +528,12 def annotate(ui, repo, *pats, **opts):
528
528
529 for src, abs, rel, exact in walk(repo, pats, opts):
529 for src, abs, rel, exact in walk(repo, pats, opts):
530 if abs not in mmap:
530 if abs not in mmap:
531 ui.warn("warning: %s is not in the repository!\n" % rel)
531 ui.warn(_("warning: %s is not in the repository!\n") % rel)
532 continue
532 continue
533
533
534 f = repo.file(abs)
534 f = repo.file(abs)
535 if not opts['text'] and util.binary(f.read(mmap[abs])):
535 if not opts['text'] and util.binary(f.read(mmap[abs])):
536 ui.write("%s: binary file\n" % rel)
536 ui.write(_("%s: binary file\n") % rel)
537 continue
537 continue
538
538
539 lines = f.annotate(mmap[abs])
539 lines = f.annotate(mmap[abs])
@@ -586,7 +586,7 def cat(ui, repo, file1, *pats, **opts):
586 try:
586 try:
587 n = r.lookup(rev)
587 n = r.lookup(rev)
588 except KeyError, inst:
588 except KeyError, inst:
589 raise util.Abort('cannot find file %s in rev %s', rel, rev)
589 raise util.Abort(_('cannot find file %s in rev %s'), rel, rev)
590 else:
590 else:
591 n = r.tip()
591 n = r.tip()
592 fp = make_file(repo, r, opts['output'], node=n, pathname=abs)
592 fp = make_file(repo, r, opts['output'], node=n, pathname=abs)
@@ -598,7 +598,7 def clone(ui, source, dest=None, **opts)
598 dest = os.path.basename(os.path.normpath(source))
598 dest = os.path.basename(os.path.normpath(source))
599
599
600 if os.path.exists(dest):
600 if os.path.exists(dest):
601 raise util.Abort("destination '%s' already exists", dest)
601 raise util.Abort(_("destination '%s' already exists"), dest)
602
602
603 dest = os.path.realpath(dest)
603 dest = os.path.realpath(dest)
604
604
@@ -670,14 +670,14 def clone(ui, source, dest=None, **opts)
670 def commit(ui, repo, *pats, **opts):
670 def commit(ui, repo, *pats, **opts):
671 """commit the specified files or all outstanding changes"""
671 """commit the specified files or all outstanding changes"""
672 if opts['text']:
672 if opts['text']:
673 ui.warn("Warning: -t and --text is deprecated,"
673 ui.warn(_("Warning: -t and --text is deprecated,"
674 " please use -m or --message instead.\n")
674 " please use -m or --message instead.\n"))
675 message = opts['message'] or opts['text']
675 message = opts['message'] or opts['text']
676 logfile = opts['logfile']
676 logfile = opts['logfile']
677
677
678 if message and logfile:
678 if message and logfile:
679 raise util.Abort('options --message and --logfile are mutually '
679 raise util.Abort(_('options --message and --logfile are mutually '
680 'exclusive')
680 'exclusive'))
681 if not message and logfile:
681 if not message and logfile:
682 try:
682 try:
683 if logfile == '-':
683 if logfile == '-':
@@ -685,7 +685,7 def commit(ui, repo, *pats, **opts):
685 else:
685 else:
686 message = open(logfile).read()
686 message = open(logfile).read()
687 except IOError, inst:
687 except IOError, inst:
688 raise util.Abort("can't read commit message '%s': %s" %
688 raise util.Abort(_("can't read commit message '%s': %s") %
689 (logfile, inst.strerror))
689 (logfile, inst.strerror))
690
690
691 if opts['addremove']:
691 if opts['addremove']:
@@ -708,19 +708,19 def commit(ui, repo, *pats, **opts):
708
708
709 def docopy(ui, repo, pats, opts):
709 def docopy(ui, repo, pats, opts):
710 if not pats:
710 if not pats:
711 raise util.Abort('no source or destination specified')
711 raise util.Abort(_('no source or destination specified'))
712 elif len(pats) == 1:
712 elif len(pats) == 1:
713 raise util.Abort('no destination specified')
713 raise util.Abort(_('no destination specified'))
714 pats = list(pats)
714 pats = list(pats)
715 dest = pats.pop()
715 dest = pats.pop()
716 sources = []
716 sources = []
717
717
718 def okaytocopy(abs, rel, exact):
718 def okaytocopy(abs, rel, exact):
719 reasons = {'?': 'is not managed',
719 reasons = {'?': _('is not managed'),
720 'a': 'has been marked for add'}
720 'a': _('has been marked for add')}
721 reason = reasons.get(repo.dirstate.state(abs))
721 reason = reasons.get(repo.dirstate.state(abs))
722 if reason:
722 if reason:
723 if exact: ui.warn('%s: not copying - file %s\n' % (rel, reason))
723 if exact: ui.warn(_('%s: not copying - file %s\n') % (rel, reason))
724 else:
724 else:
725 return True
725 return True
726
726
@@ -728,7 +728,7 def docopy(ui, repo, pats, opts):
728 if okaytocopy(abs, rel, exact):
728 if okaytocopy(abs, rel, exact):
729 sources.append((abs, rel, exact))
729 sources.append((abs, rel, exact))
730 if not sources:
730 if not sources:
731 raise util.Abort('no files to copy')
731 raise util.Abort(_('no files to copy'))
732
732
733 cwd = repo.getcwd()
733 cwd = repo.getcwd()
734 absdest = util.canonpath(repo.root, cwd, dest)
734 absdest = util.canonpath(repo.root, cwd, dest)
@@ -740,10 +740,10 def docopy(ui, repo, pats, opts):
740
740
741 if destisfile:
741 if destisfile:
742 if opts['parents']:
742 if opts['parents']:
743 raise util.Abort('with --parents, destination must be a directory')
743 raise util.Abort(_('with --parents, destination must be a directory'))
744 elif len(sources) > 1:
744 elif len(sources) > 1:
745 raise util.Abort('with multiple sources, destination must be a '
745 raise util.Abort(_('with multiple sources, destination must be a '
746 'directory')
746 'directory'))
747 errs, copied = 0, []
747 errs, copied = 0, []
748 for abs, rel, exact in sources:
748 for abs, rel, exact in sources:
749 if opts['parents']:
749 if opts['parents']:
@@ -755,7 +755,7 def docopy(ui, repo, pats, opts):
755 myabsdest = util.canonpath(repo.root, cwd, mydest)
755 myabsdest = util.canonpath(repo.root, cwd, mydest)
756 myreldest = util.pathto(cwd, myabsdest)
756 myreldest = util.pathto(cwd, myabsdest)
757 if not opts['force'] and repo.dirstate.state(myabsdest) not in 'a?':
757 if not opts['force'] and repo.dirstate.state(myabsdest) not in 'a?':
758 ui.warn('%s: not overwriting - file already managed\n' % myreldest)
758 ui.warn(_('%s: not overwriting - file already managed\n') % myreldest)
759 continue
759 continue
760 mydestdir = os.path.dirname(myreldest) or '.'
760 mydestdir = os.path.dirname(myreldest) or '.'
761 if not opts['after']:
761 if not opts['after']:
@@ -765,7 +765,7 def docopy(ui, repo, pats, opts):
765 except OSError, inst:
765 except OSError, inst:
766 if inst.errno != errno.EEXIST: raise
766 if inst.errno != errno.EEXIST: raise
767 if ui.verbose or not exact:
767 if ui.verbose or not exact:
768 ui.status('copying %s to %s\n' % (rel, myreldest))
768 ui.status(_('copying %s to %s\n') % (rel, myreldest))
769 if not opts['after']:
769 if not opts['after']:
770 try:
770 try:
771 shutil.copyfile(rel, myreldest)
771 shutil.copyfile(rel, myreldest)
@@ -774,15 +774,15 def docopy(ui, repo, pats, opts):
774 raise util.Abort(str(inst))
774 raise util.Abort(str(inst))
775 except IOError, inst:
775 except IOError, inst:
776 if inst.errno == errno.ENOENT:
776 if inst.errno == errno.ENOENT:
777 ui.warn('%s: deleted in working copy\n' % rel)
777 ui.warn(_('%s: deleted in working copy\n') % rel)
778 else:
778 else:
779 ui.warn('%s: cannot copy - %s\n' % (rel, inst.strerror))
779 ui.warn(_('%s: cannot copy - %s\n') % (rel, inst.strerror))
780 errs += 1
780 errs += 1
781 continue
781 continue
782 repo.copy(abs, myabsdest)
782 repo.copy(abs, myabsdest)
783 copied.append((abs, rel, exact))
783 copied.append((abs, rel, exact))
784 if errs:
784 if errs:
785 ui.warn('(consider using --after)\n')
785 ui.warn(_('(consider using --after)\n'))
786 return errs, copied
786 return errs, copied
787
787
788 def copy(ui, repo, *pats, **opts):
788 def copy(ui, repo, *pats, **opts):
@@ -811,22 +811,22 def debugcheckstate(ui, repo):
811 for f in dc:
811 for f in dc:
812 state = repo.dirstate.state(f)
812 state = repo.dirstate.state(f)
813 if state in "nr" and f not in m1:
813 if state in "nr" and f not in m1:
814 ui.warn("%s in state %s, but not in manifest1\n" % (f, state))
814 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
815 errors += 1
815 errors += 1
816 if state in "a" and f in m1:
816 if state in "a" and f in m1:
817 ui.warn("%s in state %s, but also in manifest1\n" % (f, state))
817 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
818 errors += 1
818 errors += 1
819 if state in "m" and f not in m1 and f not in m2:
819 if state in "m" and f not in m1 and f not in m2:
820 ui.warn("%s in state %s, but not in either manifest\n" %
820 ui.warn(_("%s in state %s, but not in either manifest\n") %
821 (f, state))
821 (f, state))
822 errors += 1
822 errors += 1
823 for f in m1:
823 for f in m1:
824 state = repo.dirstate.state(f)
824 state = repo.dirstate.state(f)
825 if state not in "nrm":
825 if state not in "nrm":
826 ui.warn("%s in manifest1, but listed as state %s" % (f, state))
826 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
827 errors += 1
827 errors += 1
828 if errors:
828 if errors:
829 raise util.Abort(".hg/dirstate inconsistent with current parent's manifest")
829 raise util.Abort(_(".hg/dirstate inconsistent with current parent's manifest"))
830
830
831 def debugconfig(ui):
831 def debugconfig(ui):
832 """show combined config settings from all hgrc files"""
832 """show combined config settings from all hgrc files"""
@@ -862,7 +862,7 def debugstate(ui, repo):
862 time.strftime("%x %X",
862 time.strftime("%x %X",
863 time.localtime(dc[file_][3])), file_))
863 time.localtime(dc[file_][3])), file_))
864 for f in repo.dirstate.copies:
864 for f in repo.dirstate.copies:
865 ui.write("copy: %s -> %s\n" % (repo.dirstate.copies[f], f))
865 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f))
866
866
867 def debugdata(ui, file_, rev):
867 def debugdata(ui, file_, rev):
868 """dump the contents of an data file revision"""
868 """dump the contents of an data file revision"""
@@ -870,7 +870,7 def debugdata(ui, file_, rev):
870 try:
870 try:
871 ui.write(r.revision(r.lookup(rev)))
871 ui.write(r.revision(r.lookup(rev)))
872 except KeyError:
872 except KeyError:
873 raise util.Abort('invalid revision identifier %s', rev)
873 raise util.Abort(_('invalid revision identifier %s'), rev)
874
874
875 def debugindex(ui, file_):
875 def debugindex(ui, file_):
876 """dump the contents of an index file"""
876 """dump the contents of an index file"""
@@ -910,9 +910,9 def debugrename(ui, repo, file, rev=None
910 n = r.tip()
910 n = r.tip()
911 m = r.renamed(n)
911 m = r.renamed(n)
912 if m:
912 if m:
913 ui.write("renamed from %s:%s\n" % (m[0], hex(m[1])))
913 ui.write(_("renamed from %s:%s\n") % (m[0], hex(m[1])))
914 else:
914 else:
915 ui.write("not renamed\n")
915 ui.write(_("not renamed\n"))
916
916
917 def debugwalk(ui, repo, *pats, **opts):
917 def debugwalk(ui, repo, *pats, **opts):
918 """show how files match on given patterns"""
918 """show how files match on given patterns"""
@@ -936,7 +936,7 def diff(ui, repo, *pats, **opts):
936 if len(revs) > 1:
936 if len(revs) > 1:
937 node2 = revs[1]
937 node2 = revs[1]
938 if len(revs) > 2:
938 if len(revs) > 2:
939 raise util.Abort("too many revisions to diff")
939 raise util.Abort(_("too many revisions to diff"))
940
940
941 fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
941 fns, matchfn, anypats = matchpats(repo, repo.getcwd(), pats, opts)
942
942
@@ -970,12 +970,12 def doexport(ui, repo, changeset, seqno,
970 def export(ui, repo, *changesets, **opts):
970 def export(ui, repo, *changesets, **opts):
971 """dump the header and diffs for one or more changesets"""
971 """dump the header and diffs for one or more changesets"""
972 if not changesets:
972 if not changesets:
973 raise util.Abort("export requires at least one changeset")
973 raise util.Abort(_("export requires at least one changeset"))
974 seqno = 0
974 seqno = 0
975 revs = list(revrange(ui, repo, changesets))
975 revs = list(revrange(ui, repo, changesets))
976 total = len(revs)
976 total = len(revs)
977 revwidth = max(map(len, revs))
977 revwidth = max(map(len, revs))
978 ui.note(len(revs) > 1 and "Exporting patches:\n" or "Exporting patch:\n")
978 ui.note(len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n"))
979 for cset in revs:
979 for cset in revs:
980 seqno += 1
980 seqno += 1
981 doexport(ui, repo, cset, seqno, total, revwidth, opts)
981 doexport(ui, repo, cset, seqno, total, revwidth, opts)
@@ -987,7 +987,7 def forget(ui, repo, *pats, **opts):
987 if repo.dirstate.state(abs) == 'a':
987 if repo.dirstate.state(abs) == 'a':
988 forget.append(abs)
988 forget.append(abs)
989 if ui.verbose or not exact:
989 if ui.verbose or not exact:
990 ui.status('forgetting ', rel, '\n')
990 ui.status(_('forgetting %s\n') % rel)
991 repo.forget(forget)
991 repo.forget(forget)
992
992
993 def grep(ui, repo, pattern, *pats, **opts):
993 def grep(ui, repo, pattern, *pats, **opts):
@@ -1122,7 +1122,7 def identify(ui, repo):
1122 """print information about the working copy"""
1122 """print information about the working copy"""
1123 parents = [p for p in repo.dirstate.parents() if p != nullid]
1123 parents = [p for p in repo.dirstate.parents() if p != nullid]
1124 if not parents:
1124 if not parents:
1125 ui.write("unknown\n")
1125 ui.write(_("unknown\n"))
1126 return
1126 return
1127
1127
1128 hexfunc = ui.verbose and hex or short
1128 hexfunc = ui.verbose and hex or short
@@ -1147,7 +1147,7 def import_(ui, repo, patch1, *patches,
1147 if not opts['force']:
1147 if not opts['force']:
1148 (c, a, d, u) = repo.changes()
1148 (c, a, d, u) = repo.changes()
1149 if c or a or d:
1149 if c or a or d:
1150 raise util.Abort("outstanding uncommitted changes")
1150 raise util.Abort(_("outstanding uncommitted changes"))
1151
1151
1152 d = opts["base"]
1152 d = opts["base"]
1153 strip = opts["strip"]
1153 strip = opts["strip"]
@@ -1161,7 +1161,7 def import_(ui, repo, patch1, *patches,
1161 '(---|\*\*\*)[ \t])')
1161 '(---|\*\*\*)[ \t])')
1162
1162
1163 for patch in patches:
1163 for patch in patches:
1164 ui.status("applying %s\n" % patch)
1164 ui.status(_("applying %s\n") % patch)
1165 pf = os.path.join(d, patch)
1165 pf = os.path.join(d, patch)
1166
1166
1167 message = []
1167 message = []
@@ -1172,15 +1172,15 def import_(ui, repo, patch1, *patches,
1172 if (not message and not hgpatch and
1172 if (not message and not hgpatch and
1173 mailre.match(line) and not opts['force']):
1173 mailre.match(line) and not opts['force']):
1174 if len(line) > 35: line = line[:32] + '...'
1174 if len(line) > 35: line = line[:32] + '...'
1175 raise util.Abort('first line looks like a '
1175 raise util.Abort(_('first line looks like a '
1176 'mail header: ' + line)
1176 'mail header: ') + line)
1177 if diffre.match(line):
1177 if diffre.match(line):
1178 break
1178 break
1179 elif hgpatch:
1179 elif hgpatch:
1180 # parse values when importing the result of an hg export
1180 # parse values when importing the result of an hg export
1181 if line.startswith("# User "):
1181 if line.startswith("# User "):
1182 user = line[7:]
1182 user = line[7:]
1183 ui.debug('User: %s\n' % user)
1183 ui.debug(_('User: %s\n') % user)
1184 elif not line.startswith("# ") and line:
1184 elif not line.startswith("# ") and line:
1185 message.append(line)
1185 message.append(line)
1186 hgpatch = False
1186 hgpatch = False
@@ -1192,10 +1192,10 def import_(ui, repo, patch1, *patches,
1192
1192
1193 # make sure message isn't empty
1193 # make sure message isn't empty
1194 if not message:
1194 if not message:
1195 message = "imported patch %s\n" % patch
1195 message = _("imported patch %s\n") % patch
1196 else:
1196 else:
1197 message = "%s\n" % '\n'.join(message)
1197 message = "%s\n" % '\n'.join(message)
1198 ui.debug('message:\n%s\n' % message)
1198 ui.debug(_('message:\n%s\n') % message)
1199
1199
1200 files = util.patch(strip, pf, ui)
1200 files = util.patch(strip, pf, ui)
1201
1201
@@ -1208,7 +1208,7 def incoming(ui, repo, source="default",
1208 source = ui.expandpath(source)
1208 source = ui.expandpath(source)
1209 other = hg.repository(ui, source)
1209 other = hg.repository(ui, source)
1210 if not other.local():
1210 if not other.local():
1211 raise util.Abort("incoming doesn't work for remote repositories yet")
1211 raise util.Abort(_("incoming doesn't work for remote repositories yet"))
1212 o = repo.findincoming(other)
1212 o = repo.findincoming(other)
1213 if not o:
1213 if not o:
1214 return
1214 return
@@ -1355,7 +1355,7 def paths(ui, search=None):
1355 if name == search:
1355 if name == search:
1356 ui.write("%s\n" % path)
1356 ui.write("%s\n" % path)
1357 return
1357 return
1358 ui.warn("not found!\n")
1358 ui.warn(_("not found!\n"))
1359 return 1
1359 return 1
1360 else:
1360 else:
1361 for name, path in ui.configitems("paths"):
1361 for name, path in ui.configitems("paths"):
@@ -1364,7 +1364,7 def paths(ui, search=None):
1364 def pull(ui, repo, source="default", **opts):
1364 def pull(ui, repo, source="default", **opts):
1365 """pull changes from the specified source"""
1365 """pull changes from the specified source"""
1366 source = ui.expandpath(source)
1366 source = ui.expandpath(source)
1367 ui.status('pulling from %s\n' % (source))
1367 ui.status(_('pulling from %s\n') % (source))
1368
1368
1369 if opts['ssh']:
1369 if opts['ssh']:
1370 ui.setconfig("ui", "ssh", opts['ssh'])
1370 ui.setconfig("ui", "ssh", opts['ssh'])
@@ -1377,7 +1377,7 def pull(ui, repo, source="default", **o
1377 if opts['update']:
1377 if opts['update']:
1378 return update(ui, repo)
1378 return update(ui, repo)
1379 else:
1379 else:
1380 ui.status("(run 'hg update' to get a working copy)\n")
1380 ui.status(_("(run 'hg update' to get a working copy)\n"))
1381
1381
1382 return r
1382 return r
1383
1383
@@ -1398,8 +1398,8 def push(ui, repo, dest="default-push",
1398 def rawcommit(ui, repo, *flist, **rc):
1398 def rawcommit(ui, repo, *flist, **rc):
1399 "raw commit interface"
1399 "raw commit interface"
1400 if rc['text']:
1400 if rc['text']:
1401 ui.warn("Warning: -t and --text is deprecated,"
1401 ui.warn(_("Warning: -t and --text is deprecated,"
1402 " please use -m or --message instead.\n")
1402 " please use -m or --message instead.\n"))
1403 message = rc['message'] or rc['text']
1403 message = rc['message'] or rc['text']
1404 if not message and rc['logfile']:
1404 if not message and rc['logfile']:
1405 try:
1405 try:
@@ -1407,7 +1407,7 def rawcommit(ui, repo, *flist, **rc):
1407 except IOError:
1407 except IOError:
1408 pass
1408 pass
1409 if not message and not rc['logfile']:
1409 if not message and not rc['logfile']:
1410 raise util.Abort("missing commit message")
1410 raise util.Abort(_("missing commit message"))
1411
1411
1412 files = relpath(repo, list(flist))
1412 files = relpath(repo, list(flist))
1413 if rc['files']:
1413 if rc['files']:
@@ -1430,16 +1430,16 def remove(ui, repo, pat, *pats, **opts)
1430 def okaytoremove(abs, rel, exact):
1430 def okaytoremove(abs, rel, exact):
1431 c, a, d, u = repo.changes(files = [abs])
1431 c, a, d, u = repo.changes(files = [abs])
1432 reason = None
1432 reason = None
1433 if c: reason = 'is modified'
1433 if c: reason = _('is modified')
1434 elif a: reason = 'has been marked for add'
1434 elif a: reason = _('has been marked for add')
1435 elif u: reason = 'is not managed'
1435 elif u: reason = _('is not managed')
1436 if reason:
1436 if reason:
1437 if exact: ui.warn('not removing %s: file %s\n' % (rel, reason))
1437 if exact: ui.warn(_('not removing %s: file %s\n') % (rel, reason))
1438 else:
1438 else:
1439 return True
1439 return True
1440 for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
1440 for src, abs, rel, exact in walk(repo, (pat,) + pats, opts):
1441 if okaytoremove(abs, rel, exact):
1441 if okaytoremove(abs, rel, exact):
1442 if ui.verbose or not exact: ui.status('removing %s\n' % rel)
1442 if ui.verbose or not exact: ui.status(_('removing %s\n') % rel)
1443 names.append(abs)
1443 names.append(abs)
1444 for name in names:
1444 for name in names:
1445 try:
1445 try:
@@ -1453,7 +1453,7 def rename(ui, repo, *pats, **opts):
1453 errs, copied = docopy(ui, repo, pats, opts)
1453 errs, copied = docopy(ui, repo, pats, opts)
1454 names = []
1454 names = []
1455 for abs, rel, exact in copied:
1455 for abs, rel, exact in copied:
1456 if ui.verbose or not exact: ui.status('removing %s\n' % rel)
1456 if ui.verbose or not exact: ui.status(_('removing %s\n') % rel)
1457 try:
1457 try:
1458 os.unlink(rel)
1458 os.unlink(rel)
1459 except OSError, inst:
1459 except OSError, inst:
@@ -1505,7 +1505,7 def revert(ui, repo, *names, **opts):
1505 r = repo.update(node, False, True, choose, False)
1505 r = repo.update(node, False, True, choose, False)
1506 for n in relnames:
1506 for n in relnames:
1507 if n not in chosen:
1507 if n not in chosen:
1508 ui.warn('error: no matches for %s\n' % n)
1508 ui.warn(_('error: no matches for %s\n') % n)
1509 r = 1
1509 r = 1
1510 sys.stdout.flush()
1510 sys.stdout.flush()
1511 return r
1511 return r
@@ -1605,9 +1605,9 def serve(ui, repo, **opts):
1605 except socket.error:
1605 except socket.error:
1606 pass
1606 pass
1607 if port != 80:
1607 if port != 80:
1608 ui.status('listening at http://%s:%d/\n' % (addr, port))
1608 ui.status(_('listening at http://%s:%d/\n') % (addr, port))
1609 else:
1609 else:
1610 ui.status('listening at http://%s/\n' % addr)
1610 ui.status(_('listening at http://%s/\n') % addr)
1611 httpd.serve_forever()
1611 httpd.serve_forever()
1612
1612
1613 def status(ui, repo, *pats, **opts):
1613 def status(ui, repo, *pats, **opts):
@@ -1624,10 +1624,10 def status(ui, repo, *pats, **opts):
1624 (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
1624 (c, a, d, u) = [[util.pathto(cwd, x) for x in n]
1625 for n in repo.changes(files=files, match=matchfn)]
1625 for n in repo.changes(files=files, match=matchfn)]
1626
1626
1627 changetypes = [('modified', 'M', c),
1627 changetypes = [(_('modified'), 'M', c),
1628 ('added', 'A', a),
1628 (_('added'), 'A', a),
1629 ('removed', 'R', d),
1629 (_('removed'), 'R', d),
1630 ('unknown', '?', u)]
1630 (_('unknown'), '?', u)]
1631
1631
1632 end = opts['print0'] and '\0' or '\n'
1632 end = opts['print0'] and '\0' or '\n'
1633
1633
@@ -1644,17 +1644,17 def status(ui, repo, *pats, **opts):
1644 def tag(ui, repo, name, rev=None, **opts):
1644 def tag(ui, repo, name, rev=None, **opts):
1645 """add a tag for the current tip or a given revision"""
1645 """add a tag for the current tip or a given revision"""
1646 if opts['text']:
1646 if opts['text']:
1647 ui.warn("Warning: -t and --text is deprecated,"
1647 ui.warn(_("Warning: -t and --text is deprecated,"
1648 " please use -m or --message instead.\n")
1648 " please use -m or --message instead.\n"))
1649 if name == "tip":
1649 if name == "tip":
1650 raise util.Abort("the name 'tip' is reserved")
1650 raise util.Abort(_("the name 'tip' is reserved"))
1651 if rev:
1651 if rev:
1652 r = hex(repo.lookup(rev))
1652 r = hex(repo.lookup(rev))
1653 else:
1653 else:
1654 r = hex(repo.changelog.tip())
1654 r = hex(repo.changelog.tip())
1655
1655
1656 if name.find(revrangesep) >= 0:
1656 if name.find(revrangesep) >= 0:
1657 raise util.Abort("'%s' cannot be used in a tag name" % revrangesep)
1657 raise util.Abort(_("'%s' cannot be used in a tag name") % revrangesep)
1658
1658
1659 if opts['local']:
1659 if opts['local']:
1660 repo.opener("localtags", "a").write("%s %s\n" % (r, name))
1660 repo.opener("localtags", "a").write("%s %s\n" % (r, name))
@@ -1663,15 +1663,15 def tag(ui, repo, name, rev=None, **opts
1663 (c, a, d, u) = repo.changes()
1663 (c, a, d, u) = repo.changes()
1664 for x in (c, a, d, u):
1664 for x in (c, a, d, u):
1665 if ".hgtags" in x:
1665 if ".hgtags" in x:
1666 raise util.Abort("working copy of .hgtags is changed "
1666 raise util.Abort(_("working copy of .hgtags is changed "
1667 "(please commit .hgtags manually)")
1667 "(please commit .hgtags manually)"))
1668
1668
1669 repo.wfile(".hgtags", "ab").write("%s %s\n" % (r, name))
1669 repo.wfile(".hgtags", "ab").write("%s %s\n" % (r, name))
1670 if repo.dirstate.state(".hgtags") == '?':
1670 if repo.dirstate.state(".hgtags") == '?':
1671 repo.add([".hgtags"])
1671 repo.add([".hgtags"])
1672
1672
1673 message = (opts['message'] or opts['text'] or
1673 message = (opts['message'] or opts['text'] or
1674 "Added tag %s for changeset %s" % (name, r))
1674 _("Added tag %s for changeset %s") % (name, r))
1675 try:
1675 try:
1676 repo.commit([".hgtags"], message, opts['user'], opts['date'])
1676 repo.commit([".hgtags"], message, opts['user'], opts['date'])
1677 except ValueError, inst:
1677 except ValueError, inst:
@@ -1699,7 +1699,7 def unbundle(ui, repo, fname):
1699 f = urllib.urlopen(fname)
1699 f = urllib.urlopen(fname)
1700
1700
1701 if f.read(4) != "HG10":
1701 if f.read(4) != "HG10":
1702 raise util.Abort("%s: not a Mercurial bundle file" % fname)
1702 raise util.Abort(_("%s: not a Mercurial bundle file") % fname)
1703
1703
1704 def bzgenerator(f):
1704 def bzgenerator(f):
1705 zd = bz2.BZ2Decompressor()
1705 zd = bz2.BZ2Decompressor()
@@ -1745,15 +1745,15 def update(ui, repo, node=None, merge=Fa
1745 if branch in br[x]:
1745 if branch in br[x]:
1746 found.append(x)
1746 found.append(x)
1747 if len(found) > 1:
1747 if len(found) > 1:
1748 ui.warn("Found multiple heads for %s\n" % branch)
1748 ui.warn(_("Found multiple heads for %s\n") % branch)
1749 for x in found:
1749 for x in found:
1750 show_changeset(ui, repo, changenode=x, brinfo=br)
1750 show_changeset(ui, repo, changenode=x, brinfo=br)
1751 return 1
1751 return 1
1752 if len(found) == 1:
1752 if len(found) == 1:
1753 node = found[0]
1753 node = found[0]
1754 ui.warn("Using head %s for branch %s\n" % (short(node), branch))
1754 ui.warn(_("Using head %s for branch %s\n") % (short(node), branch))
1755 else:
1755 else:
1756 ui.warn("branch %s not found\n" % (branch))
1756 ui.warn(_("branch %s not found\n") % (branch))
1757 return 1
1757 return 1
1758 else:
1758 else:
1759 node = node and repo.lookup(node) or repo.changelog.tip()
1759 node = node and repo.lookup(node) or repo.changelog.tip()
@@ -1768,243 +1768,243 def verify(ui, repo):
1768 table = {
1768 table = {
1769 "^add":
1769 "^add":
1770 (add,
1770 (add,
1771 [('I', 'include', [], 'include path in search'),
1771 [('I', 'include', [], _('include path in search')),
1772 ('X', 'exclude', [], 'exclude path from search')],
1772 ('X', 'exclude', [], _('exclude path from search'))],
1773 "hg add [OPTION]... [FILE]..."),
1773 "hg add [OPTION]... [FILE]..."),
1774 "addremove":
1774 "addremove":
1775 (addremove,
1775 (addremove,
1776 [('I', 'include', [], 'include path in search'),
1776 [('I', 'include', [], _('include path in search')),
1777 ('X', 'exclude', [], 'exclude path from search')],
1777 ('X', 'exclude', [], _('exclude path from search'))],
1778 "hg addremove [OPTION]... [FILE]..."),
1778 _("hg addremove [OPTION]... [FILE]...")),
1779 "^annotate":
1779 "^annotate":
1780 (annotate,
1780 (annotate,
1781 [('r', 'rev', '', 'revision'),
1781 [('r', 'rev', '', _('revision')),
1782 ('a', 'text', None, 'treat all files as text'),
1782 ('a', 'text', None, _('treat all files as text')),
1783 ('u', 'user', None, 'show user'),
1783 ('u', 'user', None, _('show user')),
1784 ('n', 'number', None, 'show revision number'),
1784 ('n', 'number', None, _('show revision number')),
1785 ('c', 'changeset', None, 'show changeset'),
1785 ('c', 'changeset', None, _('show changeset')),
1786 ('I', 'include', [], 'include path in search'),
1786 ('I', 'include', [], _('include path in search')),
1787 ('X', 'exclude', [], 'exclude path from search')],
1787 ('X', 'exclude', [], _('exclude path from search'))],
1788 'hg annotate [OPTION]... FILE...'),
1788 _('hg annotate [OPTION]... FILE...')),
1789 "bundle":
1789 "bundle":
1790 (bundle,
1790 (bundle,
1791 [],
1791 [],
1792 'hg bundle FILE DEST'),
1792 _('hg bundle FILE DEST')),
1793 "cat":
1793 "cat":
1794 (cat,
1794 (cat,
1795 [('I', 'include', [], 'include path in search'),
1795 [('I', 'include', [], _('include path in search')),
1796 ('X', 'exclude', [], 'exclude path from search'),
1796 ('X', 'exclude', [], _('exclude path from search')),
1797 ('o', 'output', "", 'output to file'),
1797 ('o', 'output', "", _('output to file')),
1798 ('r', 'rev', '', 'revision')],
1798 ('r', 'rev', '', _('revision'))],
1799 'hg cat [OPTION]... FILE...'),
1799 _('hg cat [OPTION]... FILE...')),
1800 "^clone":
1800 "^clone":
1801 (clone,
1801 (clone,
1802 [('U', 'noupdate', None, 'skip update after cloning'),
1802 [('U', 'noupdate', None, _('skip update after cloning')),
1803 ('e', 'ssh', "", 'ssh command'),
1803 ('e', 'ssh', "", _('ssh command')),
1804 ('', 'pull', None, 'use pull protocol to copy metadata'),
1804 ('', 'pull', None, _('use pull protocol to copy metadata')),
1805 ('', 'remotecmd', "", 'remote hg command')],
1805 ('', 'remotecmd', "", _('remote hg command'))],
1806 'hg clone [OPTION]... SOURCE [DEST]'),
1806 _('hg clone [OPTION]... SOURCE [DEST]')),
1807 "^commit|ci":
1807 "^commit|ci":
1808 (commit,
1808 (commit,
1809 [('A', 'addremove', None, 'run add/remove during commit'),
1809 [('A', 'addremove', None, _('run add/remove during commit')),
1810 ('I', 'include', [], 'include path in search'),
1810 ('I', 'include', [], _('include path in search')),
1811 ('X', 'exclude', [], 'exclude path from search'),
1811 ('X', 'exclude', [], _('exclude path from search')),
1812 ('m', 'message', "", 'commit message'),
1812 ('m', 'message', "", _('commit message')),
1813 ('t', 'text', "", 'commit message (deprecated: use -m)'),
1813 ('t', 'text', "", _('commit message (deprecated: use -m)')),
1814 ('l', 'logfile', "", 'commit message file'),
1814 ('l', 'logfile', "", _('commit message file')),
1815 ('d', 'date', "", 'date code'),
1815 ('d', 'date', "", _('date code')),
1816 ('u', 'user', "", 'user')],
1816 ('u', 'user', "", _('user'))],
1817 'hg commit [OPTION]... [FILE]...'),
1817 _('hg commit [OPTION]... [FILE]...')),
1818 "copy|cp": (copy,
1818 "copy|cp": (copy,
1819 [('I', 'include', [], 'include path in search'),
1819 [('I', 'include', [], _('include path in search')),
1820 ('X', 'exclude', [], 'exclude path from search'),
1820 ('X', 'exclude', [], _('exclude path from search')),
1821 ('A', 'after', None, 'record a copy after it has happened'),
1821 ('A', 'after', None, _('record a copy after it has happened')),
1822 ('f', 'force', None, 'replace destination if it exists'),
1822 ('f', 'force', None, _('replace destination if it exists')),
1823 ('p', 'parents', None, 'append source path to dest')],
1823 ('p', 'parents', None, _('append source path to dest'))],
1824 'hg copy [OPTION]... [SOURCE]... DEST'),
1824 _('hg copy [OPTION]... [SOURCE]... DEST')),
1825 "debugancestor": (debugancestor, [], 'debugancestor INDEX REV1 REV2'),
1825 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
1826 "debugcheckstate": (debugcheckstate, [], 'debugcheckstate'),
1826 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')),
1827 "debugconfig": (debugconfig, [], 'debugconfig'),
1827 "debugconfig": (debugconfig, [], _('debugconfig')),
1828 "debugsetparents": (debugsetparents, [], 'debugsetparents REV1 [REV2]'),
1828 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')),
1829 "debugstate": (debugstate, [], 'debugstate'),
1829 "debugstate": (debugstate, [], _('debugstate')),
1830 "debugdata": (debugdata, [], 'debugdata FILE REV'),
1830 "debugdata": (debugdata, [], _('debugdata FILE REV')),
1831 "debugindex": (debugindex, [], 'debugindex FILE'),
1831 "debugindex": (debugindex, [], _('debugindex FILE')),
1832 "debugindexdot": (debugindexdot, [], 'debugindexdot FILE'),
1832 "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')),
1833 "debugrename": (debugrename, [], 'debugrename FILE [REV]'),
1833 "debugrename": (debugrename, [], _('debugrename FILE [REV]')),
1834 "debugwalk":
1834 "debugwalk":
1835 (debugwalk,
1835 (debugwalk,
1836 [('I', 'include', [], 'include path in search'),
1836 [('I', 'include', [], _('include path in search')),
1837 ('X', 'exclude', [], 'exclude path from search')],
1837 ('X', 'exclude', [], _('exclude path from search'))],
1838 'debugwalk [OPTION]... [FILE]...'),
1838 _('debugwalk [OPTION]... [FILE]...')),
1839 "^diff":
1839 "^diff":
1840 (diff,
1840 (diff,
1841 [('r', 'rev', [], 'revision'),
1841 [('r', 'rev', [], _('revision')),
1842 ('a', 'text', None, 'treat all files as text'),
1842 ('a', 'text', None, _('treat all files as text')),
1843 ('I', 'include', [], 'include path in search'),
1843 ('I', 'include', [], _('include path in search')),
1844 ('X', 'exclude', [], 'exclude path from search')],
1844 ('X', 'exclude', [], _('exclude path from search'))],
1845 'hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...'),
1845 _('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')),
1846 "^export":
1846 "^export":
1847 (export,
1847 (export,
1848 [('o', 'output', "", 'output to file'),
1848 [('o', 'output', "", _('output to file')),
1849 ('a', 'text', None, 'treat all files as text')],
1849 ('a', 'text', None, _('treat all files as text'))],
1850 "hg export [-a] [-o OUTFILE] REV..."),
1850 _("hg export [-a] [-o OUTFILE] REV...")),
1851 "forget":
1851 "forget":
1852 (forget,
1852 (forget,
1853 [('I', 'include', [], 'include path in search'),
1853 [('I', 'include', [], _('include path in search')),
1854 ('X', 'exclude', [], 'exclude path from search')],
1854 ('X', 'exclude', [], _('exclude path from search'))],
1855 "hg forget [OPTION]... FILE..."),
1855 _("hg forget [OPTION]... FILE...")),
1856 "grep":
1856 "grep":
1857 (grep,
1857 (grep,
1858 [('0', 'print0', None, 'end fields with NUL'),
1858 [('0', 'print0', None, _('end fields with NUL')),
1859 ('I', 'include', [], 'include path in search'),
1859 ('I', 'include', [], _('include path in search')),
1860 ('X', 'exclude', [], 'include path in search'),
1860 ('X', 'exclude', [], _('include path in search')),
1861 ('', 'all', None, 'print all revisions with matches'),
1861 ('', 'all', None, _('print all revisions with matches')),
1862 ('i', 'ignore-case', None, 'ignore case when matching'),
1862 ('i', 'ignore-case', None, _('ignore case when matching')),
1863 ('l', 'files-with-matches', None, 'print names of files and revs with matches'),
1863 ('l', 'files-with-matches', None, _('print names of files and revs with matches')),
1864 ('n', 'line-number', None, 'print line numbers'),
1864 ('n', 'line-number', None, _('print line numbers')),
1865 ('r', 'rev', [], 'search in revision rev'),
1865 ('r', 'rev', [], _('search in revision rev')),
1866 ('u', 'user', None, 'print user who made change')],
1866 ('u', 'user', None, _('print user who made change'))],
1867 "hg grep [OPTION]... PATTERN [FILE]..."),
1867 _("hg grep [OPTION]... PATTERN [FILE]...")),
1868 "heads":
1868 "heads":
1869 (heads,
1869 (heads,
1870 [('b', 'branches', None, 'find branch info')],
1870 [('b', 'branches', None, _('find branch info'))],
1871 'hg heads [-b]'),
1871 _('hg heads [-b]')),
1872 "help": (help_, [], 'hg help [COMMAND]'),
1872 "help": (help_, [], _('hg help [COMMAND]')),
1873 "identify|id": (identify, [], 'hg identify'),
1873 "identify|id": (identify, [], _('hg identify')),
1874 "import|patch":
1874 "import|patch":
1875 (import_,
1875 (import_,
1876 [('p', 'strip', 1, 'path strip'),
1876 [('p', 'strip', 1, _('path strip')),
1877 ('f', 'force', None, 'skip check for outstanding changes'),
1877 ('f', 'force', None, _('skip check for outstanding changes')),
1878 ('b', 'base', "", 'base path')],
1878 ('b', 'base', "", _('base path'))],
1879 "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
1879 _("hg import [-f] [-p NUM] [-b BASE] PATCH...")),
1880 "incoming|in": (incoming,
1880 "incoming|in": (incoming,
1881 [('p', 'patch', None, 'show patch')],
1881 [('p', 'patch', None, _('show patch'))],
1882 'hg incoming [-p] [SOURCE]'),
1882 _('hg incoming [-p] [SOURCE]')),
1883 "^init": (init, [], 'hg init [DEST]'),
1883 "^init": (init, [], _('hg init [DEST]')),
1884 "locate":
1884 "locate":
1885 (locate,
1885 (locate,
1886 [('r', 'rev', '', 'revision'),
1886 [('r', 'rev', '', _('revision')),
1887 ('0', 'print0', None, 'end filenames with NUL'),
1887 ('0', 'print0', None, _('end filenames with NUL')),
1888 ('f', 'fullpath', None, 'print complete paths'),
1888 ('f', 'fullpath', None, _('print complete paths')),
1889 ('I', 'include', [], 'include path in search'),
1889 ('I', 'include', [], _('include path in search')),
1890 ('X', 'exclude', [], 'exclude path from search')],
1890 ('X', 'exclude', [], _('exclude path from search'))],
1891 'hg locate [OPTION]... [PATTERN]...'),
1891 _('hg locate [OPTION]... [PATTERN]...')),
1892 "^log|history":
1892 "^log|history":
1893 (log,
1893 (log,
1894 [('I', 'include', [], 'include path in search'),
1894 [('I', 'include', [], _('include path in search')),
1895 ('X', 'exclude', [], 'exclude path from search'),
1895 ('X', 'exclude', [], _('exclude path from search')),
1896 ('b', 'branch', None, 'show branches'),
1896 ('b', 'branch', None, _('show branches')),
1897 ('k', 'keyword', [], 'search for a keyword'),
1897 ('k', 'keyword', [], _('search for a keyword')),
1898 ('r', 'rev', [], 'revision'),
1898 ('r', 'rev', [], _('revision')),
1899 ('p', 'patch', None, 'show patch')],
1899 ('p', 'patch', None, _('show patch'))],
1900 'hg log [-I] [-X] [-r REV]... [-p] [FILE]'),
1900 _('hg log [-I] [-X] [-r REV]... [-p] [FILE]')),
1901 "manifest": (manifest, [], 'hg manifest [REV]'),
1901 "manifest": (manifest, [], _('hg manifest [REV]')),
1902 "outgoing|out": (outgoing,
1902 "outgoing|out": (outgoing,
1903 [('p', 'patch', None, 'show patch')],
1903 [('p', 'patch', None, _('show patch'))],
1904 'hg outgoing [-p] [DEST]'),
1904 _('hg outgoing [-p] [DEST]')),
1905 "parents": (parents, [], 'hg parents [REV]'),
1905 "parents": (parents, [], _('hg parents [REV]')),
1906 "paths": (paths, [], 'hg paths [NAME]'),
1906 "paths": (paths, [], _('hg paths [NAME]')),
1907 "^pull":
1907 "^pull":
1908 (pull,
1908 (pull,
1909 [('u', 'update', None, 'update working directory'),
1909 [('u', 'update', None, _('update working directory')),
1910 ('e', 'ssh', "", 'ssh command'),
1910 ('e', 'ssh', "", _('ssh command')),
1911 ('', 'remotecmd', "", 'remote hg command')],
1911 ('', 'remotecmd', "", _('remote hg command'))],
1912 'hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]'),
1912 _('hg pull [-u] [-e FILE] [--remotecmd FILE] [SOURCE]')),
1913 "^push":
1913 "^push":
1914 (push,
1914 (push,
1915 [('f', 'force', None, 'force push'),
1915 [('f', 'force', None, _('force push')),
1916 ('e', 'ssh', "", 'ssh command'),
1916 ('e', 'ssh', "", _('ssh command')),
1917 ('', 'remotecmd', "", 'remote hg command')],
1917 ('', 'remotecmd', "", _('remote hg command'))],
1918 'hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]'),
1918 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')),
1919 "rawcommit":
1919 "rawcommit":
1920 (rawcommit,
1920 (rawcommit,
1921 [('p', 'parent', [], 'parent'),
1921 [('p', 'parent', [], _('parent')),
1922 ('d', 'date', "", 'date code'),
1922 ('d', 'date', "", _('date code')),
1923 ('u', 'user', "", 'user'),
1923 ('u', 'user', "", _('user')),
1924 ('F', 'files', "", 'file list'),
1924 ('F', 'files', "", _('file list')),
1925 ('m', 'message', "", 'commit message'),
1925 ('m', 'message', "", _('commit message')),
1926 ('t', 'text', "", 'commit message (deprecated: use -m)'),
1926 ('t', 'text', "", _('commit message (deprecated: use -m)')),
1927 ('l', 'logfile', "", 'commit message file')],
1927 ('l', 'logfile', "", _('commit message file'))],
1928 'hg rawcommit [OPTION]... [FILE]...'),
1928 _('hg rawcommit [OPTION]... [FILE]...')),
1929 "recover": (recover, [], "hg recover"),
1929 "recover": (recover, [], _("hg recover")),
1930 "^remove|rm": (remove,
1930 "^remove|rm": (remove,
1931 [('I', 'include', [], 'include path in search'),
1931 [('I', 'include', [], _('include path in search')),
1932 ('X', 'exclude', [], 'exclude path from search')],
1932 ('X', 'exclude', [], _('exclude path from search'))],
1933 "hg remove [OPTION]... FILE..."),
1933 _("hg remove [OPTION]... FILE...")),
1934 "rename|mv": (rename,
1934 "rename|mv": (rename,
1935 [('I', 'include', [], 'include path in search'),
1935 [('I', 'include', [], _('include path in search')),
1936 ('X', 'exclude', [], 'exclude path from search'),
1936 ('X', 'exclude', [], _('exclude path from search')),
1937 ('A', 'after', None, 'record a copy after it has happened'),
1937 ('A', 'after', None, _('record a copy after it has happened')),
1938 ('f', 'force', None, 'replace destination if it exists'),
1938 ('f', 'force', None, _('replace destination if it exists')),
1939 ('p', 'parents', None, 'append source path to dest')],
1939 ('p', 'parents', None, _('append source path to dest'))],
1940 'hg rename [OPTION]... [SOURCE]... DEST'),
1940 _('hg rename [OPTION]... [SOURCE]... DEST')),
1941 "^revert":
1941 "^revert":
1942 (revert,
1942 (revert,
1943 [("n", "nonrecursive", None, "don't recurse into subdirs"),
1943 [("n", "nonrecursive", None, _("don't recurse into subdirs")),
1944 ("r", "rev", "", "revision")],
1944 ("r", "rev", "", _("revision"))],
1945 "hg revert [-n] [-r REV] [NAME]..."),
1945 _("hg revert [-n] [-r REV] [NAME]...")),
1946 "root": (root, [], "hg root"),
1946 "root": (root, [], _("hg root")),
1947 "^serve":
1947 "^serve":
1948 (serve,
1948 (serve,
1949 [('A', 'accesslog', '', 'access log file'),
1949 [('A', 'accesslog', '', _('access log file')),
1950 ('E', 'errorlog', '', 'error log file'),
1950 ('E', 'errorlog', '', _('error log file')),
1951 ('p', 'port', 0, 'listen port'),
1951 ('p', 'port', 0, _('listen port')),
1952 ('a', 'address', '', 'interface address'),
1952 ('a', 'address', '', _('interface address')),
1953 ('n', 'name', "", 'repository name'),
1953 ('n', 'name', "", _('repository name')),
1954 ('', 'stdio', None, 'for remote clients'),
1954 ('', 'stdio', None, _('for remote clients')),
1955 ('t', 'templates', "", 'template directory'),
1955 ('t', 'templates', "", _('template directory')),
1956 ('', 'style', "", 'template style'),
1956 ('', 'style', "", _('template style')),
1957 ('6', 'ipv6', None, 'use IPv6 in addition to IPv4')],
1957 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
1958 "hg serve [OPTION]..."),
1958 _("hg serve [OPTION]...")),
1959 "^status":
1959 "^status":
1960 (status,
1960 (status,
1961 [('m', 'modified', None, 'show only modified files'),
1961 [('m', 'modified', None, _('show only modified files')),
1962 ('a', 'added', None, 'show only added files'),
1962 ('a', 'added', None, _('show only added files')),
1963 ('r', 'removed', None, 'show only removed files'),
1963 ('r', 'removed', None, _('show only removed files')),
1964 ('u', 'unknown', None, 'show only unknown (not tracked) files'),
1964 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
1965 ('n', 'no-status', None, 'hide status prefix'),
1965 ('n', 'no-status', None, _('hide status prefix')),
1966 ('0', 'print0', None, 'end filenames with NUL'),
1966 ('0', 'print0', None, _('end filenames with NUL')),
1967 ('I', 'include', [], 'include path in search'),
1967 ('I', 'include', [], _('include path in search')),
1968 ('X', 'exclude', [], 'exclude path from search')],
1968 ('X', 'exclude', [], _('exclude path from search'))],
1969 "hg status [OPTION]... [FILE]..."),
1969 _("hg status [OPTION]... [FILE]...")),
1970 "tag":
1970 "tag":
1971 (tag,
1971 (tag,
1972 [('l', 'local', None, 'make the tag local'),
1972 [('l', 'local', None, _('make the tag local')),
1973 ('m', 'message', "", 'commit message'),
1973 ('m', 'message', "", _('commit message')),
1974 ('t', 'text', "", 'commit message (deprecated: use -m)'),
1974 ('t', 'text', "", _('commit message (deprecated: use -m)')),
1975 ('d', 'date', "", 'date code'),
1975 ('d', 'date', "", _('date code')),
1976 ('u', 'user', "", 'user')],
1976 ('u', 'user', "", _('user'))],
1977 'hg tag [OPTION]... NAME [REV]'),
1977 _('hg tag [OPTION]... NAME [REV]')),
1978 "tags": (tags, [], 'hg tags'),
1978 "tags": (tags, [], _('hg tags')),
1979 "tip": (tip, [], 'hg tip'),
1979 "tip": (tip, [], _('hg tip')),
1980 "unbundle":
1980 "unbundle":
1981 (unbundle,
1981 (unbundle,
1982 [],
1982 [],
1983 'hg unbundle FILE'),
1983 _('hg unbundle FILE')),
1984 "undo": (undo, [], 'hg undo'),
1984 "undo": (undo, [], _('hg undo')),
1985 "^update|up|checkout|co":
1985 "^update|up|checkout|co":
1986 (update,
1986 (update,
1987 [('b', 'branch', "", 'checkout the head of a specific branch'),
1987 [('b', 'branch', "", _('checkout the head of a specific branch')),
1988 ('m', 'merge', None, 'allow merging of conflicts'),
1988 ('m', 'merge', None, _('allow merging of conflicts')),
1989 ('C', 'clean', None, 'overwrite locally modified files')],
1989 ('C', 'clean', None, _('overwrite locally modified files'))],
1990 'hg update [-b TAG] [-m] [-C] [REV]'),
1990 _('hg update [-b TAG] [-m] [-C] [REV]')),
1991 "verify": (verify, [], 'hg verify'),
1991 "verify": (verify, [], _('hg verify')),
1992 "version": (show_version, [], 'hg version'),
1992 "version": (show_version, [], _('hg version')),
1993 }
1993 }
1994
1994
1995 globalopts = [
1995 globalopts = [
1996 ('R', 'repository', "", 'repository root directory'),
1996 ('R', 'repository', "", _('repository root directory')),
1997 ('', 'cwd', '', 'change working directory'),
1997 ('', 'cwd', '', _('change working directory')),
1998 ('y', 'noninteractive', None, 'run non-interactively'),
1998 ('y', 'noninteractive', None, _('run non-interactively')),
1999 ('q', 'quiet', None, 'quiet mode'),
1999 ('q', 'quiet', None, _('quiet mode')),
2000 ('v', 'verbose', None, 'verbose mode'),
2000 ('v', 'verbose', None, _('verbose mode')),
2001 ('', 'debug', None, 'debug mode'),
2001 ('', 'debug', None, _('debug mode')),
2002 ('', 'debugger', None, 'start debugger'),
2002 ('', 'debugger', None, _('start debugger')),
2003 ('', 'traceback', None, 'print traceback on exception'),
2003 ('', 'traceback', None, _('print traceback on exception')),
2004 ('', 'time', None, 'time how long the command takes'),
2004 ('', 'time', None, _('time how long the command takes')),
2005 ('', 'profile', None, 'profile'),
2005 ('', 'profile', None, _('profile')),
2006 ('', 'version', None, 'output version information and exit'),
2006 ('', 'version', None, _('output version information and exit')),
2007 ('h', 'help', None, 'display help and exit'),
2007 ('h', 'help', None, _('display help and exit')),
2008 ]
2008 ]
2009
2009
2010 norepo = ("clone init version help debugancestor debugconfig debugdata"
2010 norepo = ("clone init version help debugancestor debugconfig debugdata"
@@ -2077,7 +2077,7 def dispatch(args):
2077 try:
2077 try:
2078 mod = imp.load_source(x[0], x[1])
2078 mod = imp.load_source(x[0], x[1])
2079 except:
2079 except:
2080 u.warn("*** failed to import extension %s\n" % x[1])
2080 u.warn(_("*** failed to import extension %s\n") % x[1])
2081 continue
2081 continue
2082 else:
2082 else:
2083 def importh(name):
2083 def importh(name):
@@ -2089,7 +2089,7 def dispatch(args):
2089 try:
2089 try:
2090 mod = importh(x[0])
2090 mod = importh(x[0])
2091 except:
2091 except:
2092 u.warn("failed to import extension %s\n" % x[0])
2092 u.warn(_("failed to import extension %s\n") % x[0])
2093 continue
2093 continue
2094
2094
2095 external.append(mod)
2095 external.append(mod)
@@ -2097,21 +2097,21 def dispatch(args):
2097 cmdtable = getattr(x, 'cmdtable', {})
2097 cmdtable = getattr(x, 'cmdtable', {})
2098 for t in cmdtable:
2098 for t in cmdtable:
2099 if t in table:
2099 if t in table:
2100 u.warn("module %s overrides %s\n" % (x.__name__, t))
2100 u.warn(_("module %s overrides %s\n") % (x.__name__, t))
2101 table.update(cmdtable)
2101 table.update(cmdtable)
2102
2102
2103 try:
2103 try:
2104 cmd, func, args, options, cmdoptions = parse(args)
2104 cmd, func, args, options, cmdoptions = parse(args)
2105 except ParseError, inst:
2105 except ParseError, inst:
2106 if inst.args[0]:
2106 if inst.args[0]:
2107 u.warn("hg %s: %s\n" % (inst.args[0], inst.args[1]))
2107 u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
2108 help_(u, inst.args[0])
2108 help_(u, inst.args[0])
2109 else:
2109 else:
2110 u.warn("hg: %s\n" % inst.args[1])
2110 u.warn(_("hg: %s\n") % inst.args[1])
2111 help_(u, 'shortlist')
2111 help_(u, 'shortlist')
2112 sys.exit(-1)
2112 sys.exit(-1)
2113 except UnknownCommand, inst:
2113 except UnknownCommand, inst:
2114 u.warn("hg: unknown command '%s'\n" % inst.args[0])
2114 u.warn(_("hg: unknown command '%s'\n") % inst.args[0])
2115 help_(u, 'shortlist')
2115 help_(u, 'shortlist')
2116 sys.exit(1)
2116 sys.exit(1)
2117
2117
@@ -2124,7 +2124,7 def dispatch(args):
2124 s = get_times()
2124 s = get_times()
2125 def print_time():
2125 def print_time():
2126 t = get_times()
2126 t = get_times()
2127 u.warn("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n" %
2127 u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
2128 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
2128 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
2129 atexit.register(print_time)
2129 atexit.register(print_time)
2130
2130
@@ -2183,42 +2183,42 def dispatch(args):
2183 traceback.print_exc()
2183 traceback.print_exc()
2184 raise
2184 raise
2185 except hg.RepoError, inst:
2185 except hg.RepoError, inst:
2186 u.warn("abort: ", inst, "!\n")
2186 u.warn(_("abort: "), inst, "!\n")
2187 except revlog.RevlogError, inst:
2187 except revlog.RevlogError, inst:
2188 u.warn("abort: ", inst, "!\n")
2188 u.warn(_("abort: "), inst, "!\n")
2189 except SignalInterrupt:
2189 except SignalInterrupt:
2190 u.warn("killed!\n")
2190 u.warn(_("killed!\n"))
2191 except KeyboardInterrupt:
2191 except KeyboardInterrupt:
2192 try:
2192 try:
2193 u.warn("interrupted!\n")
2193 u.warn(_("interrupted!\n"))
2194 except IOError, inst:
2194 except IOError, inst:
2195 if inst.errno == errno.EPIPE:
2195 if inst.errno == errno.EPIPE:
2196 if u.debugflag:
2196 if u.debugflag:
2197 u.warn("\nbroken pipe\n")
2197 u.warn(_("\nbroken pipe\n"))
2198 else:
2198 else:
2199 raise
2199 raise
2200 except IOError, inst:
2200 except IOError, inst:
2201 if hasattr(inst, "code"):
2201 if hasattr(inst, "code"):
2202 u.warn("abort: %s\n" % inst)
2202 u.warn(_("abort: %s\n") % inst)
2203 elif hasattr(inst, "reason"):
2203 elif hasattr(inst, "reason"):
2204 u.warn("abort: error: %s\n" % inst.reason[1])
2204 u.warn(_("abort: error: %s\n") % inst.reason[1])
2205 elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
2205 elif hasattr(inst, "args") and inst[0] == errno.EPIPE:
2206 if u.debugflag:
2206 if u.debugflag:
2207 u.warn("broken pipe\n")
2207 u.warn(_("broken pipe\n"))
2208 elif getattr(inst, "strerror", None):
2208 elif getattr(inst, "strerror", None):
2209 if getattr(inst, "filename", None):
2209 if getattr(inst, "filename", None):
2210 u.warn("abort: %s - %s\n" % (inst.strerror, inst.filename))
2210 u.warn(_("abort: %s - %s\n") % (inst.strerror, inst.filename))
2211 else:
2211 else:
2212 u.warn("abort: %s\n" % inst.strerror)
2212 u.warn(_("abort: %s\n") % inst.strerror)
2213 else:
2213 else:
2214 raise
2214 raise
2215 except OSError, inst:
2215 except OSError, inst:
2216 if hasattr(inst, "filename"):
2216 if hasattr(inst, "filename"):
2217 u.warn("abort: %s: %s\n" % (inst.strerror, inst.filename))
2217 u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename))
2218 else:
2218 else:
2219 u.warn("abort: %s\n" % inst.strerror)
2219 u.warn(_("abort: %s\n") % inst.strerror)
2220 except util.Abort, inst:
2220 except util.Abort, inst:
2221 u.warn('abort: ', inst.args[0] % inst.args[1:], '\n')
2221 u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n')
2222 sys.exit(1)
2222 sys.exit(1)
2223 except TypeError, inst:
2223 except TypeError, inst:
2224 # was this an argument error?
2224 # was this an argument error?
@@ -2226,17 +2226,17 def dispatch(args):
2226 if len(tb) > 2: # no
2226 if len(tb) > 2: # no
2227 raise
2227 raise
2228 u.debug(inst, "\n")
2228 u.debug(inst, "\n")
2229 u.warn("%s: invalid arguments\n" % cmd)
2229 u.warn(_("%s: invalid arguments\n") % cmd)
2230 help_(u, cmd)
2230 help_(u, cmd)
2231 except UnknownCommand, inst:
2231 except UnknownCommand, inst:
2232 u.warn("hg: unknown command '%s'\n" % inst.args[0])
2232 u.warn(_("hg: unknown command '%s'\n") % inst.args[0])
2233 help_(u, 'shortlist')
2233 help_(u, 'shortlist')
2234 except SystemExit:
2234 except SystemExit:
2235 # don't catch this in the catch-all below
2235 # don't catch this in the catch-all below
2236 raise
2236 raise
2237 except:
2237 except:
2238 u.warn("** unknown exception encountered, details follow\n")
2238 u.warn(_("** unknown exception encountered, details follow\n"))
2239 u.warn("** report bug details to mercurial@selenic.com\n")
2239 u.warn(_("** report bug details to mercurial@selenic.com\n"))
2240 raise
2240 raise
2241
2241
2242 sys.exit(-1)
2242 sys.exit(-1)
@@ -68,7 +68,7 class dirstate:
68 try:
68 try:
69 syntax = syntaxes[s]
69 syntax = syntaxes[s]
70 except KeyError:
70 except KeyError:
71 self.ui.warn("ignoring invalid syntax '%s'\n" % s)
71 self.ui.warn(_("ignoring invalid syntax '%s'\n") % s)
72 continue
72 continue
73 pat = syntax + line
73 pat = syntax + line
74 for s in syntaxes.values():
74 for s in syntaxes.values():
@@ -190,7 +190,7 class dirstate:
190 try:
190 try:
191 del self.map[f]
191 del self.map[f]
192 except KeyError:
192 except KeyError:
193 self.ui.warn("not in dirstate: %s!\n" % f)
193 self.ui.warn(_("not in dirstate: %s!\n") % f)
194 pass
194 pass
195
195
196 def clear(self):
196 def clear(self):
@@ -276,13 +276,13 class dirstate:
276 return True
276 return True
277 else:
277 else:
278 kind = 'unknown'
278 kind = 'unknown'
279 if stat.S_ISCHR(st.st_mode): kind = 'character device'
279 if stat.S_ISCHR(st.st_mode): kind = _('character device')
280 elif stat.S_ISBLK(st.st_mode): kind = 'block device'
280 elif stat.S_ISBLK(st.st_mode): kind = _('block device')
281 elif stat.S_ISFIFO(st.st_mode): kind = 'fifo'
281 elif stat.S_ISFIFO(st.st_mode): kind = _('fifo')
282 elif stat.S_ISLNK(st.st_mode): kind = 'symbolic link'
282 elif stat.S_ISLNK(st.st_mode): kind = _('symbolic link')
283 elif stat.S_ISSOCK(st.st_mode): kind = 'socket'
283 elif stat.S_ISSOCK(st.st_mode): kind = _('socket')
284 elif stat.S_ISDIR(st.st_mode): kind = 'directory'
284 elif stat.S_ISDIR(st.st_mode): kind = _('directory')
285 self.ui.warn('%s: unsupported file type (type is %s)\n' % (
285 self.ui.warn(_('%s: unsupported file type (type is %s)\n') % (
286 util.pathto(self.getcwd(), f),
286 util.pathto(self.getcwd(), f),
287 kind))
287 kind))
288 return False
288 return False
@@ -112,7 +112,7 class templater:
112 if m:
112 if m:
113 self.map[m.group(1)] = os.path.join(self.base, m.group(2))
113 self.map[m.group(1)] = os.path.join(self.base, m.group(2))
114 else:
114 else:
115 raise LookupError("unknown map entry '%s'" % l)
115 raise LookupError(_("unknown map entry '%s'") % l)
116
116
117 def __call__(self, t, **map):
117 def __call__(self, t, **map):
118 m = self.defaults.copy()
118 m = self.defaults.copy()
@@ -844,7 +844,7 def create_server(repo):
844
844
845 def __init__(self, *args, **kwargs):
845 def __init__(self, *args, **kwargs):
846 if self.address_family is None:
846 if self.address_family is None:
847 raise hg.RepoError('IPv6 not available on this system')
847 raise hg.RepoError(_('IPv6 not available on this system'))
848 BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
848 BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
849
849
850 class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler):
850 class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler):
@@ -68,7 +68,7 class httprepository(remoterepository):
68 return -1
68 return -1
69
69
70 def do_cmd(self, cmd, **args):
70 def do_cmd(self, cmd, **args):
71 self.ui.debug("sending %s command\n" % cmd)
71 self.ui.debug(_("sending %s command\n") % cmd)
72 q = {"cmd": cmd}
72 q = {"cmd": cmd}
73 q.update(args)
73 q.update(args)
74 qs = urllib.urlencode(q)
74 qs = urllib.urlencode(q)
@@ -80,13 +80,13 class httprepository(remoterepository):
80 if not proto.startswith('application/mercurial') and \
80 if not proto.startswith('application/mercurial') and \
81 not proto.startswith('text/plain') and \
81 not proto.startswith('text/plain') and \
82 not proto.startswith('application/hg-changegroup'):
82 not proto.startswith('application/hg-changegroup'):
83 raise hg.RepoError("'%s' does not appear to be an hg repository" %
83 raise hg.RepoError(_("'%s' does not appear to be an hg repository") %
84 self.url)
84 self.url)
85
85
86 if proto.startswith('application/mercurial'):
86 if proto.startswith('application/mercurial'):
87 version = proto[22:]
87 version = proto[22:]
88 if float(version) > 0.1:
88 if float(version) > 0.1:
89 raise hg.RepoError("'%s' uses newer protocol %s" %
89 raise hg.RepoError(_("'%s' uses newer protocol %s") %
90 (self.url, version))
90 (self.url, version))
91
91
92 return resp
92 return resp
@@ -96,7 +96,7 class httprepository(remoterepository):
96 try:
96 try:
97 return map(bin, d[:-1].split(" "))
97 return map(bin, d[:-1].split(" "))
98 except:
98 except:
99 self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
99 self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n")
100 raise
100 raise
101
101
102 def branches(self, nodes):
102 def branches(self, nodes):
@@ -106,7 +106,7 class httprepository(remoterepository):
106 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
106 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
107 return br
107 return br
108 except:
108 except:
109 self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
109 self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n")
110 raise
110 raise
111
111
112 def between(self, pairs):
112 def between(self, pairs):
@@ -116,7 +116,7 class httprepository(remoterepository):
116 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
116 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
117 return p
117 return p
118 except:
118 except:
119 self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n")
119 self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n")
120 raise
120 raise
121
121
122 def changegroup(self, nodes):
122 def changegroup(self, nodes):
@@ -19,12 +19,12 class localrepository:
19 while not os.path.isdir(os.path.join(p, ".hg")):
19 while not os.path.isdir(os.path.join(p, ".hg")):
20 oldp = p
20 oldp = p
21 p = os.path.dirname(p)
21 p = os.path.dirname(p)
22 if p == oldp: raise repo.RepoError("no repo found")
22 if p == oldp: raise repo.RepoError(_("no repo found"))
23 path = p
23 path = p
24 self.path = os.path.join(path, ".hg")
24 self.path = os.path.join(path, ".hg")
25
25
26 if not create and not os.path.isdir(self.path):
26 if not create and not os.path.isdir(self.path):
27 raise repo.RepoError("repository %s not found" % self.path)
27 raise repo.RepoError(_("repository %s not found") % self.path)
28
28
29 self.root = os.path.abspath(path)
29 self.root = os.path.abspath(path)
30 self.ui = ui
30 self.ui = ui
@@ -49,7 +49,7 class localrepository:
49 def hook(self, name, **args):
49 def hook(self, name, **args):
50 s = self.ui.config("hooks", name)
50 s = self.ui.config("hooks", name)
51 if s:
51 if s:
52 self.ui.note("running hook %s: %s\n" % (name, s))
52 self.ui.note(_("running hook %s: %s\n") % (name, s))
53 old = {}
53 old = {}
54 for k, v in args.items():
54 for k, v in args.items():
55 k = k.upper()
55 k = k.upper()
@@ -69,7 +69,7 class localrepository:
69 del os.environ[k]
69 del os.environ[k]
70
70
71 if r:
71 if r:
72 self.ui.warn("abort: %s hook failed with status %d!\n" %
72 self.ui.warn(_("abort: %s hook failed with status %d!\n") %
73 (name, r))
73 (name, r))
74 return False
74 return False
75 return True
75 return True
@@ -139,7 +139,7 class localrepository:
139 try:
139 try:
140 return self.changelog.lookup(key)
140 return self.changelog.lookup(key)
141 except:
141 except:
142 raise repo.RepoError("unknown revision '%s'" % key)
142 raise repo.RepoError(_("unknown revision '%s'") % key)
143
143
144 def dev(self):
144 def dev(self):
145 return os.stat(self.path).st_dev
145 return os.stat(self.path).st_dev
@@ -175,7 +175,7 class localrepository:
175
175
176 for mf, cmd in self.encodepats:
176 for mf, cmd in self.encodepats:
177 if mf(filename):
177 if mf(filename):
178 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
178 self.ui.debug(_("filtering %s through %s\n") % (filename, cmd))
179 data = util.filter(data, cmd)
179 data = util.filter(data, cmd)
180 break
180 break
181
181
@@ -191,7 +191,7 class localrepository:
191
191
192 for mf, cmd in self.decodepats:
192 for mf, cmd in self.decodepats:
193 if mf(filename):
193 if mf(filename):
194 self.ui.debug("filtering %s through %s\n" % (filename, cmd))
194 self.ui.debug(_("filtering %s through %s\n") % (filename, cmd))
195 data = util.filter(data, cmd)
195 data = util.filter(data, cmd)
196 break
196 break
197
197
@@ -218,28 +218,28 class localrepository:
218 def recover(self):
218 def recover(self):
219 lock = self.lock()
219 lock = self.lock()
220 if os.path.exists(self.join("journal")):
220 if os.path.exists(self.join("journal")):
221 self.ui.status("rolling back interrupted transaction\n")
221 self.ui.status(_("rolling back interrupted transaction\n"))
222 return transaction.rollback(self.opener, self.join("journal"))
222 return transaction.rollback(self.opener, self.join("journal"))
223 else:
223 else:
224 self.ui.warn("no interrupted transaction available\n")
224 self.ui.warn(_("no interrupted transaction available\n"))
225
225
226 def undo(self):
226 def undo(self):
227 lock = self.lock()
227 lock = self.lock()
228 if os.path.exists(self.join("undo")):
228 if os.path.exists(self.join("undo")):
229 self.ui.status("rolling back last transaction\n")
229 self.ui.status(_("rolling back last transaction\n"))
230 transaction.rollback(self.opener, self.join("undo"))
230 transaction.rollback(self.opener, self.join("undo"))
231 self.dirstate = None
231 self.dirstate = None
232 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
232 util.rename(self.join("undo.dirstate"), self.join("dirstate"))
233 self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root)
233 self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root)
234 else:
234 else:
235 self.ui.warn("no undo information available\n")
235 self.ui.warn(_("no undo information available\n"))
236
236
237 def lock(self, wait=1):
237 def lock(self, wait=1):
238 try:
238 try:
239 return lock.lock(self.join("lock"), 0)
239 return lock.lock(self.join("lock"), 0)
240 except lock.LockHeld, inst:
240 except lock.LockHeld, inst:
241 if wait:
241 if wait:
242 self.ui.warn("waiting for lock held by %s\n" % inst.args[0])
242 self.ui.warn(_("waiting for lock held by %s\n") % inst.args[0])
243 return lock.lock(self.join("lock"), wait)
243 return lock.lock(self.join("lock"), wait)
244 raise inst
244 raise inst
245
245
@@ -327,7 +327,7 class localrepository:
327 elif s == 'r':
327 elif s == 'r':
328 remove.append(f)
328 remove.append(f)
329 else:
329 else:
330 self.ui.warn("%s not tracked!\n" % f)
330 self.ui.warn(_("%s not tracked!\n") % f)
331 else:
331 else:
332 (c, a, d, u) = self.changes(match=match)
332 (c, a, d, u) = self.changes(match=match)
333 commit = c + a
333 commit = c + a
@@ -341,7 +341,7 class localrepository:
341 m2 = self.manifest.read(c2[0])
341 m2 = self.manifest.read(c2[0])
342
342
343 if not commit and not remove and not force and p2 == nullid:
343 if not commit and not remove and not force and p2 == nullid:
344 self.ui.status("nothing changed\n")
344 self.ui.status(_("nothing changed\n"))
345 return None
345 return None
346
346
347 if not self.hook("precommit"):
347 if not self.hook("precommit"):
@@ -360,7 +360,7 class localrepository:
360 mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False))
360 mf1[f] = util.is_exec(self.wjoin(f), mf1.get(f, False))
361 t = self.wread(f)
361 t = self.wread(f)
362 except IOError:
362 except IOError:
363 self.ui.warn("trouble committing %s!\n" % f)
363 self.ui.warn(_("trouble committing %s!\n") % f)
364 raise
364 raise
365
365
366 r = self.file(f)
366 r = self.file(f)
@@ -370,7 +370,7 class localrepository:
370 if cp:
370 if cp:
371 meta["copy"] = cp
371 meta["copy"] = cp
372 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid)))
372 meta["copyrev"] = hex(m1.get(cp, m2.get(cp, nullid)))
373 self.ui.debug(" %s: copy %s:%s\n" % (f, cp, meta["copyrev"]))
373 self.ui.debug(_(" %s: copy %s:%s\n") % (f, cp, meta["copyrev"]))
374 fp1, fp2 = nullid, nullid
374 fp1, fp2 = nullid, nullid
375 else:
375 else:
376 fp1 = m1.get(f, nullid)
376 fp1 = m1.get(f, nullid)
@@ -521,18 +521,18 class localrepository:
521 for f in list:
521 for f in list:
522 p = self.wjoin(f)
522 p = self.wjoin(f)
523 if not os.path.exists(p):
523 if not os.path.exists(p):
524 self.ui.warn("%s does not exist!\n" % f)
524 self.ui.warn(_("%s does not exist!\n") % f)
525 elif not os.path.isfile(p):
525 elif not os.path.isfile(p):
526 self.ui.warn("%s not added: only files supported currently\n" % f)
526 self.ui.warn(_("%s not added: only files supported currently\n") % f)
527 elif self.dirstate.state(f) in 'an':
527 elif self.dirstate.state(f) in 'an':
528 self.ui.warn("%s already tracked!\n" % f)
528 self.ui.warn(_("%s already tracked!\n") % f)
529 else:
529 else:
530 self.dirstate.update([f], "a")
530 self.dirstate.update([f], "a")
531
531
532 def forget(self, list):
532 def forget(self, list):
533 for f in list:
533 for f in list:
534 if self.dirstate.state(f) not in 'ai':
534 if self.dirstate.state(f) not in 'ai':
535 self.ui.warn("%s not added!\n" % f)
535 self.ui.warn(_("%s not added!\n") % f)
536 else:
536 else:
537 self.dirstate.forget([f])
537 self.dirstate.forget([f])
538
538
@@ -540,21 +540,21 class localrepository:
540 for f in list:
540 for f in list:
541 p = self.wjoin(f)
541 p = self.wjoin(f)
542 if os.path.exists(p):
542 if os.path.exists(p):
543 self.ui.warn("%s still exists!\n" % f)
543 self.ui.warn(_("%s still exists!\n") % f)
544 elif self.dirstate.state(f) == 'a':
544 elif self.dirstate.state(f) == 'a':
545 self.ui.warn("%s never committed!\n" % f)
545 self.ui.warn(_("%s never committed!\n") % f)
546 self.dirstate.forget([f])
546 self.dirstate.forget([f])
547 elif f not in self.dirstate:
547 elif f not in self.dirstate:
548 self.ui.warn("%s not tracked!\n" % f)
548 self.ui.warn(_("%s not tracked!\n") % f)
549 else:
549 else:
550 self.dirstate.update([f], "r")
550 self.dirstate.update([f], "r")
551
551
552 def copy(self, source, dest):
552 def copy(self, source, dest):
553 p = self.wjoin(dest)
553 p = self.wjoin(dest)
554 if not os.path.exists(p):
554 if not os.path.exists(p):
555 self.ui.warn("%s does not exist!\n" % dest)
555 self.ui.warn(_("%s does not exist!\n") % dest)
556 elif not os.path.isfile(p):
556 elif not os.path.isfile(p):
557 self.ui.warn("copy failed: %s is not a file\n" % dest)
557 self.ui.warn(_("copy failed: %s is not a file\n") % dest)
558 else:
558 else:
559 if self.dirstate.state(dest) == '?':
559 if self.dirstate.state(dest) == '?':
560 self.dirstate.update([dest], "a")
560 self.dirstate.update([dest], "a")
@@ -738,7 +738,7 class localrepository:
738
738
739 # assume we're closer to the tip than the root
739 # assume we're closer to the tip than the root
740 # and start by examining the heads
740 # and start by examining the heads
741 self.ui.status("searching for changes\n")
741 self.ui.status(_("searching for changes\n"))
742
742
743 if not heads:
743 if not heads:
744 heads = remote.heads()
744 heads = remote.heads()
@@ -768,21 +768,21 class localrepository:
768 if n[0] in seen:
768 if n[0] in seen:
769 continue
769 continue
770
770
771 self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1])))
771 self.ui.debug(_("examining %s:%s\n") % (short(n[0]), short(n[1])))
772 if n[0] == nullid:
772 if n[0] == nullid:
773 break
773 break
774 if n in seenbranch:
774 if n in seenbranch:
775 self.ui.debug("branch already found\n")
775 self.ui.debug(_("branch already found\n"))
776 continue
776 continue
777 if n[1] and n[1] in m: # do we know the base?
777 if n[1] and n[1] in m: # do we know the base?
778 self.ui.debug("found incomplete branch %s:%s\n"
778 self.ui.debug(_("found incomplete branch %s:%s\n")
779 % (short(n[0]), short(n[1])))
779 % (short(n[0]), short(n[1])))
780 search.append(n) # schedule branch range for scanning
780 search.append(n) # schedule branch range for scanning
781 seenbranch[n] = 1
781 seenbranch[n] = 1
782 else:
782 else:
783 if n[1] not in seen and n[1] not in fetch:
783 if n[1] not in seen and n[1] not in fetch:
784 if n[2] in m and n[3] in m:
784 if n[2] in m and n[3] in m:
785 self.ui.debug("found new changeset %s\n" %
785 self.ui.debug(_("found new changeset %s\n") %
786 short(n[1]))
786 short(n[1]))
787 fetch[n[1]] = 1 # earliest unknown
787 fetch[n[1]] = 1 # earliest unknown
788 base[n[2]] = 1 # latest known
788 base[n[2]] = 1 # latest known
@@ -797,14 +797,14 class localrepository:
797
797
798 if r:
798 if r:
799 reqcnt += 1
799 reqcnt += 1
800 self.ui.debug("request %d: %s\n" %
800 self.ui.debug(_("request %d: %s\n") %
801 (reqcnt, " ".join(map(short, r))))
801 (reqcnt, " ".join(map(short, r))))
802 for p in range(0, len(r), 10):
802 for p in range(0, len(r), 10):
803 for b in remote.branches(r[p:p+10]):
803 for b in remote.branches(r[p:p+10]):
804 self.ui.debug("received %s:%s\n" %
804 self.ui.debug(_("received %s:%s\n") %
805 (short(b[0]), short(b[1])))
805 (short(b[0]), short(b[1])))
806 if b[0] in m:
806 if b[0] in m:
807 self.ui.debug("found base node %s\n" % short(b[0]))
807 self.ui.debug(_("found base node %s\n") % short(b[0]))
808 base[b[0]] = 1
808 base[b[0]] = 1
809 elif b[0] not in seen:
809 elif b[0] not in seen:
810 unknown.append(b)
810 unknown.append(b)
@@ -818,15 +818,15 class localrepository:
818 p = n[0]
818 p = n[0]
819 f = 1
819 f = 1
820 for i in l:
820 for i in l:
821 self.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
821 self.ui.debug(_("narrowing %d:%d %s\n") % (f, len(l), short(i)))
822 if i in m:
822 if i in m:
823 if f <= 2:
823 if f <= 2:
824 self.ui.debug("found new branch changeset %s\n" %
824 self.ui.debug(_("found new branch changeset %s\n") %
825 short(p))
825 short(p))
826 fetch[p] = 1
826 fetch[p] = 1
827 base[i] = 1
827 base[i] = 1
828 else:
828 else:
829 self.ui.debug("narrowed branch search to %s:%s\n"
829 self.ui.debug(_("narrowed branch search to %s:%s\n")
830 % (short(p), short(i)))
830 % (short(p), short(i)))
831 search.append((p, i))
831 search.append((p, i))
832 break
832 break
@@ -835,15 +835,15 class localrepository:
835 # sanity check our fetch list
835 # sanity check our fetch list
836 for f in fetch.keys():
836 for f in fetch.keys():
837 if f in m:
837 if f in m:
838 raise repo.RepoError("already have changeset " + short(f[:4]))
838 raise repo.RepoError(_("already have changeset ") + short(f[:4]))
839
839
840 if base.keys() == [nullid]:
840 if base.keys() == [nullid]:
841 self.ui.warn("warning: pulling from an unrelated repository!\n")
841 self.ui.warn(_("warning: pulling from an unrelated repository!\n"))
842
842
843 self.ui.note("found new changesets starting at " +
843 self.ui.note(_("found new changesets starting at ") +
844 " ".join([short(f) for f in fetch]) + "\n")
844 " ".join([short(f) for f in fetch]) + "\n")
845
845
846 self.ui.debug("%d total queries\n" % reqcnt)
846 self.ui.debug(_("%d total queries\n") % reqcnt)
847
847
848 return fetch.keys()
848 return fetch.keys()
849
849
@@ -852,7 +852,7 class localrepository:
852 base = {}
852 base = {}
853 self.findincoming(remote, base, heads)
853 self.findincoming(remote, base, heads)
854
854
855 self.ui.debug("common changesets up to "
855 self.ui.debug(_("common changesets up to ")
856 + " ".join(map(short, base.keys())) + "\n")
856 + " ".join(map(short, base.keys())) + "\n")
857
857
858 remain = dict.fromkeys(self.changelog.nodemap)
858 remain = dict.fromkeys(self.changelog.nodemap)
@@ -882,13 +882,13 class localrepository:
882
882
883 # if we have an empty repo, fetch everything
883 # if we have an empty repo, fetch everything
884 if self.changelog.tip() == nullid:
884 if self.changelog.tip() == nullid:
885 self.ui.status("requesting all changes\n")
885 self.ui.status(_("requesting all changes\n"))
886 fetch = [nullid]
886 fetch = [nullid]
887 else:
887 else:
888 fetch = self.findincoming(remote)
888 fetch = self.findincoming(remote)
889
889
890 if not fetch:
890 if not fetch:
891 self.ui.status("no changes found\n")
891 self.ui.status(_("no changes found\n"))
892 return 1
892 return 1
893
893
894 cg = remote.changegroup(fetch)
894 cg = remote.changegroup(fetch)
@@ -901,19 +901,19 class localrepository:
901 heads = remote.heads()
901 heads = remote.heads()
902 inc = self.findincoming(remote, base, heads)
902 inc = self.findincoming(remote, base, heads)
903 if not force and inc:
903 if not force and inc:
904 self.ui.warn("abort: unsynced remote changes!\n")
904 self.ui.warn(_("abort: unsynced remote changes!\n"))
905 self.ui.status("(did you forget to sync? use push -f to force)\n")
905 self.ui.status(_("(did you forget to sync? use push -f to force)\n"))
906 return 1
906 return 1
907
907
908 update = self.findoutgoing(remote, base)
908 update = self.findoutgoing(remote, base)
909 if not update:
909 if not update:
910 self.ui.status("no changes found\n")
910 self.ui.status(_("no changes found\n"))
911 return 1
911 return 1
912 elif not force:
912 elif not force:
913 if len(heads) < len(self.changelog.heads()):
913 if len(heads) < len(self.changelog.heads()):
914 self.ui.warn("abort: push creates new remote branches!\n")
914 self.ui.warn(_("abort: push creates new remote branches!\n"))
915 self.ui.status("(did you forget to merge?" +
915 self.ui.status(_("(did you forget to merge?"
916 " use push -f to force)\n")
916 " use push -f to force)\n"))
917 return 1
917 return 1
918
918
919 cg = self.changegroup(update)
919 cg = self.changegroup(update)
@@ -963,8 +963,8 class localrepository:
963 if l <= 4: return ""
963 if l <= 4: return ""
964 d = source.read(l - 4)
964 d = source.read(l - 4)
965 if len(d) < l - 4:
965 if len(d) < l - 4:
966 raise repo.RepoError("premature EOF reading chunk" +
966 raise repo.RepoError(_("premature EOF reading chunk"
967 " (got %d bytes, expected %d)"
967 " (got %d bytes, expected %d)")
968 % (len(d), l - 4))
968 % (len(d), l - 4))
969 return d
969 return d
970
970
@@ -975,7 +975,7 class localrepository:
975 yield c
975 yield c
976
976
977 def csmap(x):
977 def csmap(x):
978 self.ui.debug("add changeset %s\n" % short(x))
978 self.ui.debug(_("add changeset %s\n") % short(x))
979 return self.changelog.count()
979 return self.changelog.count()
980
980
981 def revmap(x):
981 def revmap(x):
@@ -989,7 +989,7 class localrepository:
989 oldheads = len(self.changelog.heads())
989 oldheads = len(self.changelog.heads())
990
990
991 # pull off the changeset group
991 # pull off the changeset group
992 self.ui.status("adding changesets\n")
992 self.ui.status(_("adding changesets\n"))
993 co = self.changelog.tip()
993 co = self.changelog.tip()
994 cn = self.changelog.addgroup(getgroup(), csmap, tr, 1) # unique
994 cn = self.changelog.addgroup(getgroup(), csmap, tr, 1) # unique
995 cnr, cor = map(self.changelog.rev, (cn, co))
995 cnr, cor = map(self.changelog.rev, (cn, co))
@@ -998,16 +998,16 class localrepository:
998 changesets = cnr - cor
998 changesets = cnr - cor
999
999
1000 # pull off the manifest group
1000 # pull off the manifest group
1001 self.ui.status("adding manifests\n")
1001 self.ui.status(_("adding manifests\n"))
1002 mm = self.manifest.tip()
1002 mm = self.manifest.tip()
1003 mo = self.manifest.addgroup(getgroup(), revmap, tr)
1003 mo = self.manifest.addgroup(getgroup(), revmap, tr)
1004
1004
1005 # process the files
1005 # process the files
1006 self.ui.status("adding file changes\n")
1006 self.ui.status(_("adding file changes\n"))
1007 while 1:
1007 while 1:
1008 f = getchunk()
1008 f = getchunk()
1009 if not f: break
1009 if not f: break
1010 self.ui.debug("adding %s revisions\n" % f)
1010 self.ui.debug(_("adding %s revisions\n") % f)
1011 fl = self.file(f)
1011 fl = self.file(f)
1012 o = fl.count()
1012 o = fl.count()
1013 n = fl.addgroup(getgroup(), revmap, tr)
1013 n = fl.addgroup(getgroup(), revmap, tr)
@@ -1017,9 +1017,9 class localrepository:
1017 newheads = len(self.changelog.heads())
1017 newheads = len(self.changelog.heads())
1018 heads = ""
1018 heads = ""
1019 if oldheads and newheads > oldheads:
1019 if oldheads and newheads > oldheads:
1020 heads = " (+%d heads)" % (newheads - oldheads)
1020 heads = _(" (+%d heads)") % (newheads - oldheads)
1021
1021
1022 self.ui.status(("added %d changesets" +
1022 self.ui.status(_("added %d changesets"
1023 " with %d changes to %d files%s\n")
1023 " with %d changes to %d files%s\n")
1024 % (changesets, revisions, files, heads))
1024 % (changesets, revisions, files, heads))
1025
1025
@@ -1028,7 +1028,7 class localrepository:
1028 if changesets > 0:
1028 if changesets > 0:
1029 if not self.hook("changegroup",
1029 if not self.hook("changegroup",
1030 node=hex(self.changelog.node(cor+1))):
1030 node=hex(self.changelog.node(cor+1))):
1031 self.ui.warn("abort: changegroup hook returned failure!\n")
1031 self.ui.warn(_("abort: changegroup hook returned failure!\n"))
1032 return 1
1032 return 1
1033
1033
1034 for i in range(cor + 1, cnr + 1):
1034 for i in range(cor + 1, cnr + 1):
@@ -1040,7 +1040,7 class localrepository:
1040 moddirstate=True):
1040 moddirstate=True):
1041 pl = self.dirstate.parents()
1041 pl = self.dirstate.parents()
1042 if not force and pl[1] != nullid:
1042 if not force and pl[1] != nullid:
1043 self.ui.warn("aborting: outstanding uncommitted merges\n")
1043 self.ui.warn(_("aborting: outstanding uncommitted merges\n"))
1044 return 1
1044 return 1
1045
1045
1046 p1, p2 = pl[0], node
1046 p1, p2 = pl[0], node
@@ -1063,10 +1063,10 class localrepository:
1063
1063
1064 # resolve the manifest to determine which files
1064 # resolve the manifest to determine which files
1065 # we care about merging
1065 # we care about merging
1066 self.ui.note("resolving manifests\n")
1066 self.ui.note(_("resolving manifests\n"))
1067 self.ui.debug(" force %s allow %s moddirstate %s linear %s\n" %
1067 self.ui.debug(_(" force %s allow %s moddirstate %s linear %s\n") %
1068 (force, allow, moddirstate, linear_path))
1068 (force, allow, moddirstate, linear_path))
1069 self.ui.debug(" ancestor %s local %s remote %s\n" %
1069 self.ui.debug(_(" ancestor %s local %s remote %s\n") %
1070 (short(man), short(m1n), short(m2n)))
1070 (short(man), short(m1n), short(m2n)))
1071
1071
1072 merge = {}
1072 merge = {}
@@ -1112,7 +1112,7 class localrepository:
1112 a = ma.get(f, nullid)
1112 a = ma.get(f, nullid)
1113 # are both different from the ancestor?
1113 # are both different from the ancestor?
1114 if n != a and m2[f] != a:
1114 if n != a and m2[f] != a:
1115 self.ui.debug(" %s versions differ, resolve\n" % f)
1115 self.ui.debug(_(" %s versions differ, resolve\n") % f)
1116 # merge executable bits
1116 # merge executable bits
1117 # "if we changed or they changed, change in merge"
1117 # "if we changed or they changed, change in merge"
1118 a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
1118 a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
@@ -1123,7 +1123,7 class localrepository:
1123 # is remote's version newer?
1123 # is remote's version newer?
1124 # or are we going back in time?
1124 # or are we going back in time?
1125 elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]):
1125 elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]):
1126 self.ui.debug(" remote %s is newer, get\n" % f)
1126 self.ui.debug(_(" remote %s is newer, get\n") % f)
1127 get[f] = m2[f]
1127 get[f] = m2[f]
1128 s = 1
1128 s = 1
1129 elif f in umap:
1129 elif f in umap:
@@ -1132,60 +1132,60 class localrepository:
1132
1132
1133 if not s and mfw[f] != mf2[f]:
1133 if not s and mfw[f] != mf2[f]:
1134 if force:
1134 if force:
1135 self.ui.debug(" updating permissions for %s\n" % f)
1135 self.ui.debug(_(" updating permissions for %s\n") % f)
1136 util.set_exec(self.wjoin(f), mf2[f])
1136 util.set_exec(self.wjoin(f), mf2[f])
1137 else:
1137 else:
1138 a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
1138 a, b, c = mfa.get(f, 0), mfw[f], mf2[f]
1139 mode = ((a^b) | (a^c)) ^ a
1139 mode = ((a^b) | (a^c)) ^ a
1140 if mode != b:
1140 if mode != b:
1141 self.ui.debug(" updating permissions for %s\n" % f)
1141 self.ui.debug(_(" updating permissions for %s\n") % f)
1142 util.set_exec(self.wjoin(f), mode)
1142 util.set_exec(self.wjoin(f), mode)
1143 del m2[f]
1143 del m2[f]
1144 elif f in ma:
1144 elif f in ma:
1145 if n != ma[f]:
1145 if n != ma[f]:
1146 r = "d"
1146 r = _("d")
1147 if not force and (linear_path or allow):
1147 if not force and (linear_path or allow):
1148 r = self.ui.prompt(
1148 r = self.ui.prompt(
1149 (" local changed %s which remote deleted\n" % f) +
1149 (_(" local changed %s which remote deleted\n") % f) +
1150 "(k)eep or (d)elete?", "[kd]", "k")
1150 _("(k)eep or (d)elete?"), _("[kd]"), _("k"))
1151 if r == "d":
1151 if r == _("d"):
1152 remove.append(f)
1152 remove.append(f)
1153 else:
1153 else:
1154 self.ui.debug("other deleted %s\n" % f)
1154 self.ui.debug(_("other deleted %s\n") % f)
1155 remove.append(f) # other deleted it
1155 remove.append(f) # other deleted it
1156 else:
1156 else:
1157 # file is created on branch or in working directory
1157 # file is created on branch or in working directory
1158 if force and f not in umap:
1158 if force and f not in umap:
1159 self.ui.debug("remote deleted %s, clobbering\n" % f)
1159 self.ui.debug(_("remote deleted %s, clobbering\n") % f)
1160 remove.append(f)
1160 remove.append(f)
1161 elif n == m1.get(f, nullid): # same as parent
1161 elif n == m1.get(f, nullid): # same as parent
1162 if p2 == pa: # going backwards?
1162 if p2 == pa: # going backwards?
1163 self.ui.debug("remote deleted %s\n" % f)
1163 self.ui.debug(_("remote deleted %s\n") % f)
1164 remove.append(f)
1164 remove.append(f)
1165 else:
1165 else:
1166 self.ui.debug("local modified %s, keeping\n" % f)
1166 self.ui.debug(_("local modified %s, keeping\n") % f)
1167 else:
1167 else:
1168 self.ui.debug("working dir created %s, keeping\n" % f)
1168 self.ui.debug(_("working dir created %s, keeping\n") % f)
1169
1169
1170 for f, n in m2.iteritems():
1170 for f, n in m2.iteritems():
1171 if choose and not choose(f): continue
1171 if choose and not choose(f): continue
1172 if f[0] == "/": continue
1172 if f[0] == "/": continue
1173 if f in ma and n != ma[f]:
1173 if f in ma and n != ma[f]:
1174 r = "k"
1174 r = _("k")
1175 if not force and (linear_path or allow):
1175 if not force and (linear_path or allow):
1176 r = self.ui.prompt(
1176 r = self.ui.prompt(
1177 ("remote changed %s which local deleted\n" % f) +
1177 (_("remote changed %s which local deleted\n") % f) +
1178 "(k)eep or (d)elete?", "[kd]", "k")
1178 _("(k)eep or (d)elete?"), _("[kd]"), _("k"))
1179 if r == "k": get[f] = n
1179 if r == _("k"): get[f] = n
1180 elif f not in ma:
1180 elif f not in ma:
1181 self.ui.debug("remote created %s\n" % f)
1181 self.ui.debug(_("remote created %s\n") % f)
1182 get[f] = n
1182 get[f] = n
1183 else:
1183 else:
1184 if force or p2 == pa: # going backwards?
1184 if force or p2 == pa: # going backwards?
1185 self.ui.debug("local deleted %s, recreating\n" % f)
1185 self.ui.debug(_("local deleted %s, recreating\n") % f)
1186 get[f] = n
1186 get[f] = n
1187 else:
1187 else:
1188 self.ui.debug("local deleted %s\n" % f)
1188 self.ui.debug(_("local deleted %s\n") % f)
1189
1189
1190 del mw, m1, m2, ma
1190 del mw, m1, m2, ma
1191
1191
@@ -1200,17 +1200,17 class localrepository:
1200 p1, p2 = p2, nullid
1200 p1, p2 = p2, nullid
1201 else:
1201 else:
1202 if not allow:
1202 if not allow:
1203 self.ui.status("this update spans a branch" +
1203 self.ui.status(_("this update spans a branch"
1204 " affecting the following files:\n")
1204 " affecting the following files:\n"))
1205 fl = merge.keys() + get.keys()
1205 fl = merge.keys() + get.keys()
1206 fl.sort()
1206 fl.sort()
1207 for f in fl:
1207 for f in fl:
1208 cf = ""
1208 cf = ""
1209 if f in merge: cf = " (resolve)"
1209 if f in merge: cf = _(" (resolve)")
1210 self.ui.status(" %s%s\n" % (f, cf))
1210 self.ui.status(" %s%s\n" % (f, cf))
1211 self.ui.warn("aborting update spanning branches!\n")
1211 self.ui.warn(_("aborting update spanning branches!\n"))
1212 self.ui.status("(use update -m to merge across branches" +
1212 self.ui.status(_("(use update -m to merge across branches"
1213 " or -C to lose changes)\n")
1213 " or -C to lose changes)\n"))
1214 return 1
1214 return 1
1215 branch_merge = True
1215 branch_merge = True
1216
1216
@@ -1222,7 +1222,7 class localrepository:
1222 files.sort()
1222 files.sort()
1223 for f in files:
1223 for f in files:
1224 if f[0] == "/": continue
1224 if f[0] == "/": continue
1225 self.ui.note("getting %s\n" % f)
1225 self.ui.note(_("getting %s\n") % f)
1226 t = self.file(f).read(get[f])
1226 t = self.file(f).read(get[f])
1227 try:
1227 try:
1228 self.wwrite(f, t)
1228 self.wwrite(f, t)
@@ -1242,7 +1242,7 class localrepository:
1242 files = merge.keys()
1242 files = merge.keys()
1243 files.sort()
1243 files.sort()
1244 for f in files:
1244 for f in files:
1245 self.ui.status("merging %s\n" % f)
1245 self.ui.status(_("merging %s\n") % f)
1246 my, other, flag = merge[f]
1246 my, other, flag = merge[f]
1247 self.merge3(f, my, other)
1247 self.merge3(f, my, other)
1248 util.set_exec(self.wjoin(f), flag)
1248 util.set_exec(self.wjoin(f), flag)
@@ -1262,12 +1262,12 class localrepository:
1262
1262
1263 remove.sort()
1263 remove.sort()
1264 for f in remove:
1264 for f in remove:
1265 self.ui.note("removing %s\n" % f)
1265 self.ui.note(_("removing %s\n") % f)
1266 try:
1266 try:
1267 os.unlink(self.wjoin(f))
1267 os.unlink(self.wjoin(f))
1268 except OSError, inst:
1268 except OSError, inst:
1269 if inst.errno != errno.ENOENT:
1269 if inst.errno != errno.ENOENT:
1270 self.ui.warn("update failed to remove %s: %s!\n" %
1270 self.ui.warn(_("update failed to remove %s: %s!\n") %
1271 (f, inst.strerror))
1271 (f, inst.strerror))
1272 # try removing directories that might now be empty
1272 # try removing directories that might now be empty
1273 try: os.removedirs(os.path.dirname(self.wjoin(f)))
1273 try: os.removedirs(os.path.dirname(self.wjoin(f)))
@@ -1295,15 +1295,15 class localrepository:
1295 b = temp("base", base)
1295 b = temp("base", base)
1296 c = temp("other", other)
1296 c = temp("other", other)
1297
1297
1298 self.ui.note("resolving %s\n" % fn)
1298 self.ui.note(_("resolving %s\n") % fn)
1299 self.ui.debug("file %s: my %s other %s ancestor %s\n" %
1299 self.ui.debug(_("file %s: my %s other %s ancestor %s\n") %
1300 (fn, short(my), short(other), short(base)))
1300 (fn, short(my), short(other), short(base)))
1301
1301
1302 cmd = (os.environ.get("HGMERGE") or self.ui.config("ui", "merge")
1302 cmd = (os.environ.get("HGMERGE") or self.ui.config("ui", "merge")
1303 or "hgmerge")
1303 or "hgmerge")
1304 r = os.system("%s %s %s %s" % (cmd, a, b, c))
1304 r = os.system("%s %s %s %s" % (cmd, a, b, c))
1305 if r:
1305 if r:
1306 self.ui.warn("merging %s failed!\n" % fn)
1306 self.ui.warn(_("merging %s failed!\n") % fn)
1307
1307
1308 os.unlink(b)
1308 os.unlink(b)
1309 os.unlink(c)
1309 os.unlink(c)
@@ -1320,25 +1320,25 class localrepository:
1320 errors[0] += 1
1320 errors[0] += 1
1321
1321
1322 seen = {}
1322 seen = {}
1323 self.ui.status("checking changesets\n")
1323 self.ui.status(_("checking changesets\n"))
1324 for i in range(self.changelog.count()):
1324 for i in range(self.changelog.count()):
1325 changesets += 1
1325 changesets += 1
1326 n = self.changelog.node(i)
1326 n = self.changelog.node(i)
1327 l = self.changelog.linkrev(n)
1327 l = self.changelog.linkrev(n)
1328 if l != i:
1328 if l != i:
1329 err("incorrect link (%d) for changeset revision %d" % (l, i))
1329 err(_("incorrect link (%d) for changeset revision %d") %(l, i))
1330 if n in seen:
1330 if n in seen:
1331 err("duplicate changeset at revision %d" % i)
1331 err(_("duplicate changeset at revision %d") % i)
1332 seen[n] = 1
1332 seen[n] = 1
1333
1333
1334 for p in self.changelog.parents(n):
1334 for p in self.changelog.parents(n):
1335 if p not in self.changelog.nodemap:
1335 if p not in self.changelog.nodemap:
1336 err("changeset %s has unknown parent %s" %
1336 err(_("changeset %s has unknown parent %s") %
1337 (short(n), short(p)))
1337 (short(n), short(p)))
1338 try:
1338 try:
1339 changes = self.changelog.read(n)
1339 changes = self.changelog.read(n)
1340 except Exception, inst:
1340 except Exception, inst:
1341 err("unpacking changeset %s: %s" % (short(n), inst))
1341 err(_("unpacking changeset %s: %s") % (short(n), inst))
1342
1342
1343 neededmanifests[changes[0]] = n
1343 neededmanifests[changes[0]] = n
1344
1344
@@ -1346,55 +1346,55 class localrepository:
1346 filelinkrevs.setdefault(f, []).append(i)
1346 filelinkrevs.setdefault(f, []).append(i)
1347
1347
1348 seen = {}
1348 seen = {}
1349 self.ui.status("checking manifests\n")
1349 self.ui.status(_("checking manifests\n"))
1350 for i in range(self.manifest.count()):
1350 for i in range(self.manifest.count()):
1351 n = self.manifest.node(i)
1351 n = self.manifest.node(i)
1352 l = self.manifest.linkrev(n)
1352 l = self.manifest.linkrev(n)
1353
1353
1354 if l < 0 or l >= self.changelog.count():
1354 if l < 0 or l >= self.changelog.count():
1355 err("bad manifest link (%d) at revision %d" % (l, i))
1355 err(_("bad manifest link (%d) at revision %d") % (l, i))
1356
1356
1357 if n in neededmanifests:
1357 if n in neededmanifests:
1358 del neededmanifests[n]
1358 del neededmanifests[n]
1359
1359
1360 if n in seen:
1360 if n in seen:
1361 err("duplicate manifest at revision %d" % i)
1361 err(_("duplicate manifest at revision %d") % i)
1362
1362
1363 seen[n] = 1
1363 seen[n] = 1
1364
1364
1365 for p in self.manifest.parents(n):
1365 for p in self.manifest.parents(n):
1366 if p not in self.manifest.nodemap:
1366 if p not in self.manifest.nodemap:
1367 err("manifest %s has unknown parent %s" %
1367 err(_("manifest %s has unknown parent %s") %
1368 (short(n), short(p)))
1368 (short(n), short(p)))
1369
1369
1370 try:
1370 try:
1371 delta = mdiff.patchtext(self.manifest.delta(n))
1371 delta = mdiff.patchtext(self.manifest.delta(n))
1372 except KeyboardInterrupt:
1372 except KeyboardInterrupt:
1373 self.ui.warn("interrupted")
1373 self.ui.warn(_("interrupted"))
1374 raise
1374 raise
1375 except Exception, inst:
1375 except Exception, inst:
1376 err("unpacking manifest %s: %s" % (short(n), inst))
1376 err(_("unpacking manifest %s: %s") % (short(n), inst))
1377
1377
1378 ff = [ l.split('\0') for l in delta.splitlines() ]
1378 ff = [ l.split('\0') for l in delta.splitlines() ]
1379 for f, fn in ff:
1379 for f, fn in ff:
1380 filenodes.setdefault(f, {})[bin(fn[:40])] = 1
1380 filenodes.setdefault(f, {})[bin(fn[:40])] = 1
1381
1381
1382 self.ui.status("crosschecking files in changesets and manifests\n")
1382 self.ui.status(_("crosschecking files in changesets and manifests\n"))
1383
1383
1384 for m,c in neededmanifests.items():
1384 for m,c in neededmanifests.items():
1385 err("Changeset %s refers to unknown manifest %s" %
1385 err(_("Changeset %s refers to unknown manifest %s") %
1386 (short(m), short(c)))
1386 (short(m), short(c)))
1387 del neededmanifests
1387 del neededmanifests
1388
1388
1389 for f in filenodes:
1389 for f in filenodes:
1390 if f not in filelinkrevs:
1390 if f not in filelinkrevs:
1391 err("file %s in manifest but not in changesets" % f)
1391 err(_("file %s in manifest but not in changesets") % f)
1392
1392
1393 for f in filelinkrevs:
1393 for f in filelinkrevs:
1394 if f not in filenodes:
1394 if f not in filenodes:
1395 err("file %s in changeset but not in manifest" % f)
1395 err(_("file %s in changeset but not in manifest") % f)
1396
1396
1397 self.ui.status("checking files\n")
1397 self.ui.status(_("checking files\n"))
1398 ff = filenodes.keys()
1398 ff = filenodes.keys()
1399 ff.sort()
1399 ff.sort()
1400 for f in ff:
1400 for f in ff:
@@ -1408,15 +1408,15 class localrepository:
1408 n = fl.node(i)
1408 n = fl.node(i)
1409
1409
1410 if n in seen:
1410 if n in seen:
1411 err("%s: duplicate revision %d" % (f, i))
1411 err(_("%s: duplicate revision %d") % (f, i))
1412 if n not in filenodes[f]:
1412 if n not in filenodes[f]:
1413 err("%s: %d:%s not in manifests" % (f, i, short(n)))
1413 err(_("%s: %d:%s not in manifests") % (f, i, short(n)))
1414 else:
1414 else:
1415 del filenodes[f][n]
1415 del filenodes[f][n]
1416
1416
1417 flr = fl.linkrev(n)
1417 flr = fl.linkrev(n)
1418 if flr not in filelinkrevs[f]:
1418 if flr not in filelinkrevs[f]:
1419 err("%s:%s points to unexpected changeset %d"
1419 err(_("%s:%s points to unexpected changeset %d")
1420 % (f, short(n), flr))
1420 % (f, short(n), flr))
1421 else:
1421 else:
1422 filelinkrevs[f].remove(flr)
1422 filelinkrevs[f].remove(flr)
@@ -1425,25 +1425,25 class localrepository:
1425 try:
1425 try:
1426 t = fl.read(n)
1426 t = fl.read(n)
1427 except Exception, inst:
1427 except Exception, inst:
1428 err("unpacking file %s %s: %s" % (f, short(n), inst))
1428 err(_("unpacking file %s %s: %s") % (f, short(n), inst))
1429
1429
1430 # verify parents
1430 # verify parents
1431 (p1, p2) = fl.parents(n)
1431 (p1, p2) = fl.parents(n)
1432 if p1 not in nodes:
1432 if p1 not in nodes:
1433 err("file %s:%s unknown parent 1 %s" %
1433 err(_("file %s:%s unknown parent 1 %s") %
1434 (f, short(n), short(p1)))
1434 (f, short(n), short(p1)))
1435 if p2 not in nodes:
1435 if p2 not in nodes:
1436 err("file %s:%s unknown parent 2 %s" %
1436 err(_("file %s:%s unknown parent 2 %s") %
1437 (f, short(n), short(p1)))
1437 (f, short(n), short(p1)))
1438 nodes[n] = 1
1438 nodes[n] = 1
1439
1439
1440 # cross-check
1440 # cross-check
1441 for node in filenodes[f]:
1441 for node in filenodes[f]:
1442 err("node %s in manifests not in %s" % (hex(node), f))
1442 err(_("node %s in manifests not in %s") % (hex(node), f))
1443
1443
1444 self.ui.status("%d files, %d changesets, %d total revisions\n" %
1444 self.ui.status(_("%d files, %d changesets, %d total revisions\n") %
1445 (files, changesets, revisions))
1445 (files, changesets, revisions))
1446
1446
1447 if errors[0]:
1447 if errors[0]:
1448 self.ui.warn("%d integrity errors encountered!\n" % errors[0])
1448 self.ui.warn(_("%d integrity errors encountered!\n") % errors[0])
1449 return 1
1449 return 1
@@ -44,7 +44,7 class manifest(revlog):
44 if self.listcache and self.addlist and self.listcache[0] == a:
44 if self.listcache and self.addlist and self.listcache[0] == a:
45 d = mdiff.diff(self.listcache[1], self.addlist, 1)
45 d = mdiff.diff(self.listcache[1], self.addlist, 1)
46 if mdiff.patch(a, d) != b:
46 if mdiff.patch(a, d) != b:
47 raise AssertionError("sortdiff failed!")
47 raise AssertionError(_("sortdiff failed!"))
48 return d
48 return d
49 else:
49 else:
50 return mdiff.textdiff(a, b)
50 return mdiff.textdiff(a, b)
@@ -145,7 +145,7 class manifest(revlog):
145 end = bs
145 end = bs
146 if w[1] == 1:
146 if w[1] == 1:
147 raise AssertionError(
147 raise AssertionError(
148 "failed to remove %s from manifest\n" % f)
148 _("failed to remove %s from manifest\n") % f)
149 else:
149 else:
150 # item is found, replace/delete the existing line
150 # item is found, replace/delete the existing line
151 end = bs + 1
151 end = bs + 1
@@ -159,7 +159,7 class manifest(revlog):
159
159
160 text = "".join(self.addlist)
160 text = "".join(self.addlist)
161 if cachedelta and mdiff.patch(self.listcache[0], cachedelta) != text:
161 if cachedelta and mdiff.patch(self.listcache[0], cachedelta) != text:
162 raise AssertionError("manifest delta failure\n")
162 raise AssertionError(_("manifest delta failure\n"))
163 n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
163 n = self.addrevision(text, transaction, link, p1, p2, cachedelta)
164 self.mapcache = (n, map, flags)
164 self.mapcache = (n, map, flags)
165 self.listcache = (text, self.addlist)
165 self.listcache = (text, self.addlist)
@@ -48,7 +48,7 def decompress(bin):
48 if t == '\0': return bin
48 if t == '\0': return bin
49 if t == 'x': return zlib.decompress(bin)
49 if t == 'x': return zlib.decompress(bin)
50 if t == 'u': return bin[1:]
50 if t == 'u': return bin[1:]
51 raise RevlogError("unknown compression type %s" % t)
51 raise RevlogError(_("unknown compression type %s") % t)
52
52
53 indexformat = ">4l20s20s20s"
53 indexformat = ">4l20s20s20s"
54
54
@@ -214,7 +214,7 class revlog:
214 try:
214 try:
215 return self.nodemap[node]
215 return self.nodemap[node]
216 except KeyError:
216 except KeyError:
217 raise RevlogError('%s: no node %s' % (self.indexfile, hex(node)))
217 raise RevlogError(_('%s: no node %s') % (self.indexfile, hex(node)))
218 def linkrev(self, node): return self.index[self.rev(node)][3]
218 def linkrev(self, node): return self.index[self.rev(node)][3]
219 def parents(self, node):
219 def parents(self, node):
220 if node == nullid: return (nullid, nullid)
220 if node == nullid: return (nullid, nullid)
@@ -294,8 +294,8 class revlog:
294 for n in self.nodemap:
294 for n in self.nodemap:
295 if hex(n).startswith(id):
295 if hex(n).startswith(id):
296 c.append(n)
296 c.append(n)
297 if len(c) > 1: raise RevlogError("Ambiguous identifier")
297 if len(c) > 1: raise RevlogError(_("Ambiguous identifier"))
298 if len(c) < 1: raise RevlogError("No match found")
298 if len(c) < 1: raise RevlogError(_("No match found"))
299 return c[0]
299 return c[0]
300
300
301 return None
301 return None
@@ -357,7 +357,7 class revlog:
357 text = mdiff.patches(text, bins)
357 text = mdiff.patches(text, bins)
358
358
359 if node != hash(text, p1, p2):
359 if node != hash(text, p1, p2):
360 raise RevlogError("integrity check failed on %s:%d"
360 raise RevlogError(_("integrity check failed on %s:%d")
361 % (self.datafile, rev))
361 % (self.datafile, rev))
362
362
363 self.cache = (node, rev, text)
363 self.cache = (node, rev, text)
@@ -629,7 +629,7 class revlog:
629 if node in self.nodemap:
629 if node in self.nodemap:
630 # this can happen if two branches make the same change
630 # this can happen if two branches make the same change
631 # if unique:
631 # if unique:
632 # raise RevlogError("already have %s" % hex(node[:4]))
632 # raise RevlogError(_("already have %s") % hex(node[:4]))
633 chain = node
633 chain = node
634 continue
634 continue
635 delta = chunk[80:]
635 delta = chunk[80:]
@@ -638,7 +638,7 class revlog:
638 # retrieve the parent revision of the delta chain
638 # retrieve the parent revision of the delta chain
639 chain = p1
639 chain = p1
640 if not chain in self.nodemap:
640 if not chain in self.nodemap:
641 raise RevlogError("unknown base %s" % short(chain[:4]))
641 raise RevlogError(_("unknown base %s") % short(chain[:4]))
642
642
643 # full versions are inserted when the needed deltas become
643 # full versions are inserted when the needed deltas become
644 # comparable to the uncompressed text or when the previous
644 # comparable to the uncompressed text or when the previous
@@ -657,7 +657,7 class revlog:
657 text = self.patches(text, [delta])
657 text = self.patches(text, [delta])
658 chk = self.addrevision(text, transaction, link, p1, p2)
658 chk = self.addrevision(text, transaction, link, p1, p2)
659 if chk != node:
659 if chk != node:
660 raise RevlogError("consistency error adding group")
660 raise RevlogError(_("consistency error adding group"))
661 measure = len(text)
661 measure = len(text)
662 else:
662 else:
663 e = (end, len(cdelta), self.base(t), link, p1, p2, node)
663 e = (end, len(cdelta), self.base(t), link, p1, p2, node)
@@ -18,7 +18,7 class sshrepository(remoterepository):
18
18
19 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path)
19 m = re.match(r'ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?', path)
20 if not m:
20 if not m:
21 raise hg.RepoError("couldn't parse destination %s" % path)
21 raise hg.RepoError(_("couldn't parse destination %s") % path)
22
22
23 self.user = m.group(2)
23 self.user = m.group(2)
24 self.host = m.group(3)
24 self.host = m.group(3)
@@ -42,7 +42,7 class sshrepository(remoterepository):
42 if size == 0: break
42 if size == 0: break
43 l = self.pipee.readline()
43 l = self.pipee.readline()
44 if not l: break
44 if not l: break
45 self.ui.status("remote: ", l)
45 self.ui.status(_("remote: "), l)
46
46
47 def __del__(self):
47 def __del__(self):
48 try:
48 try:
@@ -50,7 +50,7 class sshrepository(remoterepository):
50 self.pipei.close()
50 self.pipei.close()
51 # read the error descriptor until EOF
51 # read the error descriptor until EOF
52 for l in self.pipee:
52 for l in self.pipee:
53 self.ui.status("remote: ", l)
53 self.ui.status(_("remote: "), l)
54 self.pipee.close()
54 self.pipee.close()
55 except:
55 except:
56 pass
56 pass
@@ -59,7 +59,7 class sshrepository(remoterepository):
59 return -1
59 return -1
60
60
61 def do_cmd(self, cmd, **args):
61 def do_cmd(self, cmd, **args):
62 self.ui.debug("sending %s command\n" % cmd)
62 self.ui.debug(_("sending %s command\n") % cmd)
63 self.pipeo.write("%s\n" % cmd)
63 self.pipeo.write("%s\n" % cmd)
64 for k, v in args.items():
64 for k, v in args.items():
65 self.pipeo.write("%s %d\n" % (k, len(v)))
65 self.pipeo.write("%s %d\n" % (k, len(v)))
@@ -75,7 +75,7 class sshrepository(remoterepository):
75 try:
75 try:
76 l = int(l)
76 l = int(l)
77 except:
77 except:
78 raise hg.RepoError("unexpected response '%s'" % l)
78 raise hg.RepoError(_("unexpected response '%s'") % l)
79 return r.read(l)
79 return r.read(l)
80
80
81 def lock(self):
81 def lock(self):
@@ -90,7 +90,7 class sshrepository(remoterepository):
90 try:
90 try:
91 return map(bin, d[:-1].split(" "))
91 return map(bin, d[:-1].split(" "))
92 except:
92 except:
93 raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
93 raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
94
94
95 def branches(self, nodes):
95 def branches(self, nodes):
96 n = " ".join(map(hex, nodes))
96 n = " ".join(map(hex, nodes))
@@ -99,7 +99,7 class sshrepository(remoterepository):
99 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
99 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
100 return br
100 return br
101 except:
101 except:
102 raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
102 raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
103
103
104 def between(self, pairs):
104 def between(self, pairs):
105 n = "\n".join(["-".join(map(hex, p)) for p in pairs])
105 n = "\n".join(["-".join(map(hex, p)) for p in pairs])
@@ -108,7 +108,7 class sshrepository(remoterepository):
108 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
108 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ]
109 return p
109 return p
110 except:
110 except:
111 raise hg.RepoError("unexpected response '%s'" % (d[:400] + "..."))
111 raise hg.RepoError(_("unexpected response '%s'") % (d[:400] + "..."))
112
112
113 def changegroup(self, nodes):
113 def changegroup(self, nodes):
114 n = " ".join(map(hex, nodes))
114 n = " ".join(map(hex, nodes))
@@ -118,7 +118,7 class sshrepository(remoterepository):
118 def addchangegroup(self, cg):
118 def addchangegroup(self, cg):
119 d = self.call("addchangegroup")
119 d = self.call("addchangegroup")
120 if d:
120 if d:
121 raise hg.RepoError("push refused: %s", d)
121 raise hg.RepoError(_("push refused: %s"), d)
122
122
123 while 1:
123 while 1:
124 d = cg.read(4096)
124 d = cg.read(4096)
@@ -21,7 +21,7 class transaction:
21
21
22 # abort here if the journal already exists
22 # abort here if the journal already exists
23 if os.path.exists(journal):
23 if os.path.exists(journal):
24 raise AssertionError("journal already exists - run hg recover")
24 raise AssertionError(_("journal already exists - run hg recover"))
25
25
26 self.report = report
26 self.report = report
27 self.opener = opener
27 self.opener = opener
@@ -59,17 +59,17 class transaction:
59 def abort(self):
59 def abort(self):
60 if not self.entries: return
60 if not self.entries: return
61
61
62 self.report("transaction abort!\n")
62 self.report(_("transaction abort!\n"))
63
63
64 for f, o in self.entries:
64 for f, o in self.entries:
65 try:
65 try:
66 self.opener(f, "a").truncate(o)
66 self.opener(f, "a").truncate(o)
67 except:
67 except:
68 self.report("failed to truncate %s\n" % f)
68 self.report(_("failed to truncate %s\n") % f)
69
69
70 self.entries = []
70 self.entries = []
71
71
72 self.report("rollback completed\n")
72 self.report(_("rollback completed\n"))
73
73
74 def rollback(opener, file):
74 def rollback(opener, file):
75 for l in open(file).readlines():
75 for l in open(file).readlines():
@@ -115,7 +115,7 class ui:
115 if re.match(pat, r):
115 if re.match(pat, r):
116 return r
116 return r
117 else:
117 else:
118 self.write("unrecognized response\n")
118 self.write(_("unrecognized response\n"))
119 def status(self, *msg):
119 def status(self, *msg):
120 if not self.quiet: self.write(*msg)
120 if not self.quiet: self.write(*msg)
121 def warn(self, *msg):
121 def warn(self, *msg):
@@ -136,7 +136,7 class ui:
136 os.environ.get("EDITOR", "vi"))
136 os.environ.get("EDITOR", "vi"))
137
137
138 os.environ["HGUSER"] = self.username()
138 os.environ["HGUSER"] = self.username()
139 util.system("%s %s" % (editor, name), errprefix="edit failed")
139 util.system("%s %s" % (editor, name), errprefix=_("edit failed"))
140
140
141 t = open(name).read()
141 t = open(name).read()
142 t = re.sub("(?m)^HG:.*\n", "", t)
142 t = re.sub("(?m)^HG:.*\n", "", t)
@@ -47,7 +47,7 def tempfilter(s, cmd):
47 cmd = cmd.replace('INFILE', inname)
47 cmd = cmd.replace('INFILE', inname)
48 cmd = cmd.replace('OUTFILE', outname)
48 cmd = cmd.replace('OUTFILE', outname)
49 code = os.system(cmd)
49 code = os.system(cmd)
50 if code: raise Abort("command '%s' failed: %s" %
50 if code: raise Abort(_("command '%s' failed: %s") %
51 (cmd, explain_exit(code)))
51 (cmd, explain_exit(code)))
52 return open(outname, 'rb').read()
52 return open(outname, 'rb').read()
53 finally:
53 finally:
@@ -83,7 +83,7 def patch(strip, patchname, ui):
83 files.setdefault(pf, 1)
83 files.setdefault(pf, 1)
84 code = fp.close()
84 code = fp.close()
85 if code:
85 if code:
86 raise Abort("patch command failed: %s" % explain_exit(code)[0])
86 raise Abort(_("patch command failed: %s") % explain_exit(code)[0])
87 return files.keys()
87 return files.keys()
88
88
89 def binary(s):
89 def binary(s):
@@ -366,7 +366,7 if hasattr(os, 'link'):
366 os_link = os.link
366 os_link = os.link
367 else:
367 else:
368 def os_link(src, dst):
368 def os_link(src, dst):
369 raise OSError(0, "Hardlinks not supported")
369 raise OSError(0, _("Hardlinks not supported"))
370
370
371 # Platform specific variants
371 # Platform specific variants
372 if os.name == 'nt':
372 if os.name == 'nt':
@@ -431,7 +431,7 if os.name == 'nt':
431 readlock = _readlock_file
431 readlock = _readlock_file
432
432
433 def explain_exit(code):
433 def explain_exit(code):
434 return "exited with status %d" % code, code
434 return _("exited with status %d") % code, code
435
435
436 else:
436 else:
437 nulldev = '/dev/null'
437 nulldev = '/dev/null'
@@ -494,14 +494,14 else:
494 """return a 2-tuple (desc, code) describing a process's status"""
494 """return a 2-tuple (desc, code) describing a process's status"""
495 if os.WIFEXITED(code):
495 if os.WIFEXITED(code):
496 val = os.WEXITSTATUS(code)
496 val = os.WEXITSTATUS(code)
497 return "exited with status %d" % val, val
497 return _("exited with status %d") % val, val
498 elif os.WIFSIGNALED(code):
498 elif os.WIFSIGNALED(code):
499 val = os.WTERMSIG(code)
499 val = os.WTERMSIG(code)
500 return "killed by signal %d" % val, val
500 return _("killed by signal %d") % val, val
501 elif os.WIFSTOPPED(code):
501 elif os.WIFSTOPPED(code):
502 val = os.WSTOPSIG(code)
502 val = os.WSTOPSIG(code)
503 return "stopped by signal %d" % val, val
503 return _("stopped by signal %d") % val, val
504 raise ValueError("invalid exit code")
504 raise ValueError(_("invalid exit code"))
505
505
506 class chunkbuffer(object):
506 class chunkbuffer(object):
507 """Allow arbitrary sized chunks of data to be efficiently read from an
507 """Allow arbitrary sized chunks of data to be efficiently read from an
@@ -514,7 +514,7 class chunkbuffer(object):
514 self.buf = ''
514 self.buf = ''
515 self.targetsize = int(targetsize)
515 self.targetsize = int(targetsize)
516 if self.targetsize <= 0:
516 if self.targetsize <= 0:
517 raise ValueError("targetsize must be greater than 0, was %d" %
517 raise ValueError(_("targetsize must be greater than 0, was %d") %
518 targetsize)
518 targetsize)
519 self.iterempty = False
519 self.iterempty = False
520
520
General Comments 0
You need to be logged in to leave comments. Login now