Mercurial > hg
comparison hgext/keyword.py @ 23079:c4ce50a3d634 stable
keyword: use parent of working copy as base for status
Instead of calling repo[None].status(), use the more common form that
uses the parent of the working copy as the base:
repo['.'].status(). Note that the former defaults to comparing to
revision '.', while the latter defaults to revision None, so the
contexts being compared are the same.
It might seem like this would result in a reverse diff, but it turns
out that workingctx.status() incorrectly reverses the result. That bug
will be fixed in a later commit.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 23 Oct 2014 13:17:37 -0700 |
parents | 31f34a213384 |
children | cb9d845406e5 |
comparison
equal
deleted
inserted
replaced
23078:eb763217152a | 23079:c4ce50a3d634 |
---|---|
617 if not dryrun: | 617 if not dryrun: |
618 changed = self['.'].files() | 618 changed = self['.'].files() |
619 ret = super(kwrepo, self).rollback(dryrun, force) | 619 ret = super(kwrepo, self).rollback(dryrun, force) |
620 if not dryrun: | 620 if not dryrun: |
621 ctx = self['.'] | 621 ctx = self['.'] |
622 modified, added = _preselect(self[None].status(), changed) | 622 modified, added = _preselect(ctx.status(), changed) |
623 kwt.overwrite(ctx, modified, True, True) | 623 kwt.overwrite(ctx, modified, True, True) |
624 kwt.overwrite(ctx, added, True, False) | 624 kwt.overwrite(ctx, added, True, False) |
625 return ret | 625 return ret |
626 finally: | 626 finally: |
627 wlock.release() | 627 wlock.release() |
700 try: | 700 try: |
701 # record returns 0 even when nothing has changed | 701 # record returns 0 even when nothing has changed |
702 # therefore compare nodes before and after | 702 # therefore compare nodes before and after |
703 kwt.postcommit = True | 703 kwt.postcommit = True |
704 ctx = repo['.'] | 704 ctx = repo['.'] |
705 wstatus = repo[None].status() | 705 wstatus = ctx.status() |
706 ret = orig(ui, repo, commitfunc, *pats, **opts) | 706 ret = orig(ui, repo, commitfunc, *pats, **opts) |
707 recctx = repo['.'] | 707 recctx = repo['.'] |
708 if ctx != recctx: | 708 if ctx != recctx: |
709 modified, added = _preselect(wstatus, recctx.files()) | 709 modified, added = _preselect(wstatus, recctx.files()) |
710 kwt.restrict = False | 710 kwt.restrict = False |