Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 34136:ae95853c250a
cmdutil: fix amend when passing a date
Following https://phab.mercurial-scm.org/D636, passing the same date that the
changeset to amend would results in no new commits but the output changed
from:
$ hg amend -d '0 0'
nothing changed
[1]
to:
$ hg amend -d '0 0'
Restore the old behavior by parsing the date passed as parameter so the
condition "date == old.date()" correctly works in cases both dates are
identical.
Add a test for covering this regression.
This bug was found thanks to Evolve test suite.
Differential Revision: https://phab.mercurial-scm.org/D691
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 11 Sep 2017 18:07:29 +0200 |
parents | a39dce4a76b8 |
children | e9898ad31115 |
comparison
equal
deleted
inserted
replaced
34135:07f09995e857 | 34136:ae95853c250a |
---|---|
3057 extra.update(wctx.extra()) | 3057 extra.update(wctx.extra()) |
3058 | 3058 |
3059 user = opts.get('user') or old.user() | 3059 user = opts.get('user') or old.user() |
3060 date = opts.get('date') or old.date() | 3060 date = opts.get('date') or old.date() |
3061 | 3061 |
3062 # Parse the date to allow comparison between date and old.date() | |
3063 date = util.parsedate(date) | |
3064 | |
3062 if len(old.parents()) > 1: | 3065 if len(old.parents()) > 1: |
3063 # ctx.files() isn't reliable for merges, so fall back to the | 3066 # ctx.files() isn't reliable for merges, so fall back to the |
3064 # slower repo.status() method | 3067 # slower repo.status() method |
3065 files = set([fn for st in repo.status(base, old)[:3] | 3068 files = set([fn for st in repo.status(base, old)[:3] |
3066 for fn in st]) | 3069 for fn in st]) |