@matheusbsbs / matheus-bagliano / commits / e8a8a4d76b
Fork 0

i18n: git-checkout basic messages

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Feb 22, 2011 at 23:41 UTC e8a8a4d76b1a609b343a174212655c5e07e00b50
1 file changed +34 -34
builtin/checkout.c
+34 -34
@@ -116,7 +116,7 @@ static int check_all_stages(struct cache_entry *ce, int pos)
116 ce_stage(active_cache[pos+1]) != 2 ||
117 strcmp(active_cache[pos+2]->name, ce->name) ||
118 ce_stage(active_cache[pos+2]) != 3)
119 - return error("path '%s' does not have all three versions",
119 + return error(_("path '%s' does not have all three versions"),
120 ce->name);
121 return 0;
122 }
@@ -150,7 +150,7 @@ static int checkout_merged(int pos, struct checkout *state)
150 ce_stage(active_cache[pos+1]) != 2 ||
151 strcmp(active_cache[pos+2]->name, path) ||
152 ce_stage(active_cache[pos+2]) != 3)
153 - return error("path '%s' does not have all 3 versions", path);
153 + return error(_("path '%s' does not have all 3 versions"), path);
154
155 read_mmblob(&ancestor, active_cache[pos]->sha1);
156 read_mmblob(&ours, active_cache[pos+1]->sha1);
@@ -167,7 +167,7 @@ static int checkout_merged(int pos, struct checkout *state)
167 free(theirs.ptr);
168 if (status < 0 || !result_buf.ptr) {
169 free(result_buf.ptr);
170 - return error("path '%s': cannot merge", path);
170 + return error(_("path '%s': cannot merge"), path);
171 }
172
173 /*
@@ -184,12 +184,12 @@ static int checkout_merged(int pos, struct checkout *state)
184 */
185 if (write_sha1_file(result_buf.ptr, result_buf.size,
186 blob_type, sha1))
187 - die("Unable to add merge result for '%s'", path);
187 + die(_("Unable to add merge result for '%s'"), path);
188 ce = make_cache_entry(create_ce_mode(active_cache[pos+1]->ce_mode),
189 sha1,
190 path, 2, 0);
191 if (!ce)
192 - die("make_cache_entry failed for path '%s'", path);
192 + die(_("make_cache_entry failed for path '%s'"), path);
193 status = checkout_entry(ce, state, NULL);
194 return status;
195 }
@@ -211,7 +211,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
211
212 newfd = hold_locked_index(lock_file, 1);
213 if (read_cache_preload(pathspec) < 0)
214 - return error("corrupt index file");
214 + return error(_("corrupt index file"));
215
216 if (source_tree)
217 read_tree_some(source_tree, pathspec);
@@ -239,14 +239,14 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
239 if (!ce_stage(ce))
240 continue;
241 if (opts->force) {
242 - warning("path '%s' is unmerged", ce->name);
242 + warning(_("path '%s' is unmerged"), ce->name);
243 } else if (stage) {
244 errs |= check_stage(stage, ce, pos);
245 } else if (opts->merge) {
246 errs |= check_all_stages(ce, pos);
247 } else {
248 errs = 1;
249 - error("path '%s' is unmerged", ce->name);
249 + error(_("path '%s' is unmerged"), ce->name);
250 }
251 pos = skip_same_name(ce, pos) - 1;
252 }
@@ -275,7 +275,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
275
276 if (write_cache(newfd, active_cache, active_nr) ||
277 commit_locked_index(lock_file))
278 - die("unable to write new index file");
278 + die(_("unable to write new index file"));
279
280 resolve_ref("HEAD", rev, 0, &flag);
281 head = lookup_commit_reference_gently(rev, 1);
@@ -292,7 +292,7 @@ static void show_local_changes(struct object *head, struct diff_options *opts)
292 rev.diffopt.flags = opts->flags;
293 rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;
294 if (diff_setup_done(&rev.diffopt) < 0)
295 - die("diff_setup_done failed");
295 + die(_("diff_setup_done failed"));
296 add_pending_object(&rev, head, NULL);
297 run_diff_index(&rev, 0);
298 }
@@ -366,7 +366,7 @@ static int merge_working_tree(struct checkout_opts *opts,
366 int newfd = hold_locked_index(lock_file, 1);
367
368 if (read_cache_preload(NULL) < 0)
369 - return error("corrupt index file");
369 + return error(_("corrupt index file"));
370
371 resolve_undo_clear();
372 if (opts->force) {
@@ -388,7 +388,7 @@ static int merge_working_tree(struct checkout_opts *opts,
388 refresh_cache(REFRESH_QUIET);
389
390 if (unmerged_cache()) {
391 - error("you need to resolve your current index first");
391 + error(_("you need to resolve your current index first"));
392 return 1;
393 }
394
@@ -470,7 +470,7 @@ static int merge_working_tree(struct checkout_opts *opts,
470
471 if (write_cache(newfd, active_cache, active_nr) ||
472 commit_locked_index(lock_file))
473 - die("unable to write new index file");
473 + die(_("unable to write new index file"));
474
475 if (!opts->force && !opts->quiet)
476 show_local_changes(&new->commit->object, &opts->diff_options);
@@ -519,7 +519,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,
519 temp = log_all_ref_updates;
520 log_all_ref_updates = 1;
521 if (log_ref_setup(ref_name, log_file, sizeof(log_file))) {
522 - fprintf(stderr, "Can not do reflog for '%s'\n",
522 + fprintf(stderr, _("Can not do reflog for '%s'\n"),
523 opts->new_orphan_branch);
524 log_all_ref_updates = temp;
525 return;
@@ -545,14 +545,14 @@ static void update_refs_for_switch(struct checkout_opts *opts,
545 create_symref("HEAD", new->path, msg.buf);
546 if (!opts->quiet) {
547 if (old->path && !strcmp(new->path, old->path))
548 - fprintf(stderr, "Already on '%s'\n",
548 + fprintf(stderr, _("Already on '%s'\n"),
549 new->name);
550 else if (opts->new_branch)
551 fprintf(stderr, "Switched to%s branch '%s'\n",
552 opts->branch_exists ? " and reset" : " a new",
553 new->name);
554 else
555 - fprintf(stderr, "Switched to branch '%s'\n",
555 + fprintf(stderr, _("Switched to branch '%s'\n"),
556 new->name);
557 }
558 if (old->path && old->name) {
@@ -597,7 +597,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
597 new->name = "HEAD";
598 new->commit = old.commit;
599 if (!new->commit)
600 - die("You are on a branch yet to be born");
600 + die(_("You are on a branch yet to be born"));
601 parse_commit(new->commit);
602 }
603
@@ -724,7 +724,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
724
725 /* we can assume from now on new_branch = !new_branch_force */
726 if (opts.new_branch && opts.new_branch_force)
727 - die("-B cannot be used with -b");
727 + die(_("-B cannot be used with -b"));
728
729 /* copy -B over to -b, so that we can just check the latter */
730 if (opts.new_branch_force)
@@ -732,28 +732,28 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
732
733 if (patch_mode && (opts.track > 0 || opts.new_branch
734 || opts.new_branch_log || opts.merge || opts.force))
735 - die ("--patch is incompatible with all other options");
735 + die (_("--patch is incompatible with all other options"));
736
737 /* --track without -b should DWIM */
738 if (0 < opts.track && !opts.new_branch) {
739 const char *argv0 = argv[0];
740 if (!argc || !strcmp(argv0, "--"))
741 - die ("--track needs a branch name");
741 + die (_("--track needs a branch name"));
742 if (!prefixcmp(argv0, "refs/"))
743 argv0 += 5;
744 if (!prefixcmp(argv0, "remotes/"))
745 argv0 += 8;
746 argv0 = strchr(argv0, '/');
747 if (!argv0 || !argv0[1])
748 - die ("Missing branch name; try -b");
748 + die (_("Missing branch name; try -b"));
749 opts.new_branch = argv0 + 1;
750 }
751
752 if (opts.new_orphan_branch) {
753 if (opts.new_branch)
754 - die("--orphan and -b|-B are mutually exclusive");
754 + die(_("--orphan and -b|-B are mutually exclusive"));
755 if (opts.track > 0)
756 - die("--orphan cannot be used with -t");
756 + die(_("--orphan cannot be used with -t"));
757 opts.new_branch = opts.new_orphan_branch;
758 }
759
@@ -763,7 +763,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
763 }
764
765 if (opts.force && opts.merge)
766 - die("git checkout: -f and -m are incompatible");
766 + die(_("git checkout: -f and -m are incompatible"));
767
768 /*
769 * case 1: git checkout <ref> -- [<paths>]
@@ -809,7 +809,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
809
810 if (get_sha1_mb(arg, rev)) {
811 if (has_dash_dash) /* case (1) */
812 - die("invalid reference: %s", arg);
812 + die(_("invalid reference: %s"), arg);
813 if (!patch_mode &&
814 dwim_new_local_branch &&
815 opts.track == BRANCH_TRACK_UNSPECIFIED &&
@@ -846,7 +846,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
846 source_tree = parse_tree_indirect(rev);
847
848 if (!source_tree) /* case (1): want a tree */
849 - die("reference is not a tree: %s", arg);
849 + die(_("reference is not a tree: %s"), arg);
850 if (!has_dash_dash) {/* case (3 -> 1) */
851 /*
852 * Do not complain the most common case
@@ -872,7 +872,7 @@ no_reference:
872 const char **pathspec = get_pathspec(prefix, argv);
873
874 if (!pathspec)
875 - die("invalid path specification");
875 + die(_("invalid path specification"));
876
877 if (patch_mode)
878 return interactive_checkout(new.name, pathspec, &opts);
@@ -880,14 +880,14 @@ no_reference:
880 /* Checkout paths */
881 if (opts.new_branch) {
882 if (argc == 1) {
883 - die("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?", argv[0]);
883 + die(_("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?"), argv[0]);
884 } else {
885 - die("git checkout: updating paths is incompatible with switching branches.");
885 + die(_("git checkout: updating paths is incompatible with switching branches."));
886 }
887 }
888
889 if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)
890 - die("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index.");
890 + die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));
891
892 return checkout_paths(source_tree, pathspec, &opts);
893 }
@@ -898,22 +898,22 @@ no_reference:
898 if (opts.new_branch) {
899 struct strbuf buf = STRBUF_INIT;
900 if (strbuf_check_branch_ref(&buf, opts.new_branch))
901 - die("git checkout: we do not like '%s' as a branch name.",
901 + die(_("git checkout: we do not like '%s' as a branch name."),
902 opts.new_branch);
903 if (!get_sha1(buf.buf, rev)) {
904 opts.branch_exists = 1;
905 if (!opts.new_branch_force)
906 - die("git checkout: branch %s already exists",
906 + die(_("git checkout: branch %s already exists"),
907 opts.new_branch);
908 }
909 strbuf_release(&buf);
910 }
911
912 if (new.name && !new.commit) {
913 - die("Cannot switch branch to a non-commit.");
913 + die(_("Cannot switch branch to a non-commit."));
914 }
915 if (opts.writeout_stage)
916 - die("--ours/--theirs is incompatible with switching branches.");
916 + die(_("--ours/--theirs is incompatible with switching branches."));
917
918 return switch_branches(&opts, &new);
919 }