Submitter | Yuya Nishihara |
---|---|
Date | Feb. 11, 2015, 3:39 p.m. |
Message ID | <3de7bfd959efdfa8f32c.1423669183@mimosa> |
Download | mbox | patch |
Permalink | /patch/7788/ |
State | Accepted |
Headers | show |
Comments
On 2/11/2015 7:39 AM, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1423630753 -32400 > # Wed Feb 11 13:59:13 2015 +0900 > # Node ID 3de7bfd959efdfa8f32cb6a1eeb35b62564c64a7 > # Parent 50350f482b2a875944f81b3dd107b60ef92cd1cf > resolve: port to generic templater > > Test output changes because color labels are applied separately. > This series looks good to me. ~Ryan
Yuya Nishihara writes: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1423630753 -32400 > # Wed Feb 11 13:59:13 2015 +0900 > # Node ID 3de7bfd959efdfa8f32cb6a1eeb35b62564c64a7 > # Parent 50350f482b2a875944f81b3dd107b60ef92cd1cf > resolve: port to generic templater > > Test output changes because color labels are applied separately. Oh, nice! Looks fairly straight-forward but I only gave it a cursory review.
On Thu, Feb 12, 2015 at 12:39:43AM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1423630753 -32400 > # Wed Feb 11 13:59:13 2015 +0900 > # Node ID 3de7bfd959efdfa8f32cb6a1eeb35b62564c64a7 > # Parent 50350f482b2a875944f81b3dd107b60ef92cd1cf > resolve: port to generic templater queued for default, flagging patch 1 as bc because it is a minor bc > > Test output changes because color labels are applied separately. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -5225,7 +5225,7 @@ def rename(ui, repo, *pats, **opts): > ('m', 'mark', None, _('mark files as resolved')), > ('u', 'unmark', None, _('mark files as unresolved')), > ('n', 'no-status', None, _('hide status prefix'))] > - + mergetoolopts + walkopts, > + + mergetoolopts + walkopts + formatteropts, > _('[OPTION]... [FILE]...'), > inferrepo=True) > def resolve(ui, repo, *pats, **opts): > @@ -5278,17 +5278,17 @@ def resolve(ui, repo, *pats, **opts): > hint=('use --all to remerge all files')) > > if show: > + fm = ui.formatter('resolve', opts) > ms = mergemod.mergestate(repo) > m = scmutil.match(repo[None], pats, opts) > for f in ms: > if not m(f): > continue > - if nostatus: > - ui.write("%s\n" % f) > - else: > - ui.write("%s %s\n" % (ms[f].upper(), f), > - label='resolve.' + > - {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) > + l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved'}[ms[f]] > + fm.startitem() > + fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l) > + fm.write('path', '%s\n', f, label=l) > + fm.end() > return 0 > > wlock = repo.wlock() > diff --git a/tests/test-completion.t b/tests/test-completion.t > --- a/tests/test-completion.t > +++ b/tests/test-completion.t > @@ -278,7 +278,7 @@ Show all commands + options > phase: public, draft, secret, force, rev > recover: > rename: after, force, include, exclude, dry-run > - resolve: all, list, mark, unmark, no-status, tool, include, exclude > + resolve: all, list, mark, unmark, no-status, tool, include, exclude, template > revert: all, date, rev, no-backup, include, exclude, dry-run > rollback: dry-run, force > root: > diff --git a/tests/test-resolve.t b/tests/test-resolve.t > --- a/tests/test-resolve.t > +++ b/tests/test-resolve.t > @@ -43,6 +43,10 @@ resolve -l should contain unresolved ent > U file1 > U file2 > > + $ hg resolve -l --no-status > + file1 > + file2 > + > resolving an unknown path should emit a warning, but not for -l > > $ hg resolve -m does-not-exist > @@ -60,6 +64,18 @@ resolve -l should show resolved file as > R file1 > U file2 > > + $ hg resolve -l -Tjson > + [ > + { > + "path": "file1", > + "status": "R" > + }, > + { > + "path": "file2", > + "status": "U" > + } > + ] > + > resolve -m without paths should mark all resolved > > $ hg resolve -m > @@ -70,6 +86,10 @@ resolve -l should be empty after commit > > $ hg resolve -l > > + $ hg resolve -l -Tjson > + [ > + ] > + > resolve --all should abort when no merge in progress > > $ hg resolve --all > diff --git a/tests/test-status-color.t b/tests/test-status-color.t > --- a/tests/test-status-color.t > +++ b/tests/test-status-color.t > @@ -338,8 +338,8 @@ test 'resolve -l' > hg resolve with one unresolved, one resolved: > > $ hg resolve --color=always -l > - \x1b[0;31;1mU a\x1b[0m (esc) > - \x1b[0;32;1mR b\x1b[0m (esc) > + \x1b[0;31;1mU \x1b[0m\x1b[0;31;1ma\x1b[0m (esc) > + \x1b[0;32;1mR \x1b[0m\x1b[0;32;1mb\x1b[0m (esc) > > color coding of error message with current availability of curses > > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5225,7 +5225,7 @@ def rename(ui, repo, *pats, **opts): ('m', 'mark', None, _('mark files as resolved')), ('u', 'unmark', None, _('mark files as unresolved')), ('n', 'no-status', None, _('hide status prefix'))] - + mergetoolopts + walkopts, + + mergetoolopts + walkopts + formatteropts, _('[OPTION]... [FILE]...'), inferrepo=True) def resolve(ui, repo, *pats, **opts): @@ -5278,17 +5278,17 @@ def resolve(ui, repo, *pats, **opts): hint=('use --all to remerge all files')) if show: + fm = ui.formatter('resolve', opts) ms = mergemod.mergestate(repo) m = scmutil.match(repo[None], pats, opts) for f in ms: if not m(f): continue - if nostatus: - ui.write("%s\n" % f) - else: - ui.write("%s %s\n" % (ms[f].upper(), f), - label='resolve.' + - {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) + l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved'}[ms[f]] + fm.startitem() + fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l) + fm.write('path', '%s\n', f, label=l) + fm.end() return 0 wlock = repo.wlock() diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -278,7 +278,7 @@ Show all commands + options phase: public, draft, secret, force, rev recover: rename: after, force, include, exclude, dry-run - resolve: all, list, mark, unmark, no-status, tool, include, exclude + resolve: all, list, mark, unmark, no-status, tool, include, exclude, template revert: all, date, rev, no-backup, include, exclude, dry-run rollback: dry-run, force root: diff --git a/tests/test-resolve.t b/tests/test-resolve.t --- a/tests/test-resolve.t +++ b/tests/test-resolve.t @@ -43,6 +43,10 @@ resolve -l should contain unresolved ent U file1 U file2 + $ hg resolve -l --no-status + file1 + file2 + resolving an unknown path should emit a warning, but not for -l $ hg resolve -m does-not-exist @@ -60,6 +64,18 @@ resolve -l should show resolved file as R file1 U file2 + $ hg resolve -l -Tjson + [ + { + "path": "file1", + "status": "R" + }, + { + "path": "file2", + "status": "U" + } + ] + resolve -m without paths should mark all resolved $ hg resolve -m @@ -70,6 +86,10 @@ resolve -l should be empty after commit $ hg resolve -l + $ hg resolve -l -Tjson + [ + ] + resolve --all should abort when no merge in progress $ hg resolve --all diff --git a/tests/test-status-color.t b/tests/test-status-color.t --- a/tests/test-status-color.t +++ b/tests/test-status-color.t @@ -338,8 +338,8 @@ test 'resolve -l' hg resolve with one unresolved, one resolved: $ hg resolve --color=always -l - \x1b[0;31;1mU a\x1b[0m (esc) - \x1b[0;32;1mR b\x1b[0m (esc) + \x1b[0;31;1mU \x1b[0m\x1b[0;31;1ma\x1b[0m (esc) + \x1b[0;32;1mR \x1b[0m\x1b[0;32;1mb\x1b[0m (esc) color coding of error message with current availability of curses