We were doing repo['tip'].node() or similar in a few places where
repo.changelog.tip() would be enough.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
We were doing repo['tip'].node() or similar in a few places where
repo.changelog.tip() would be enough.
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | contrib/python-hook-examples.py (2 lines) | |||
| M | hgext/mq.py (4 lines) | |||
| M | tests/test-commit.t (2 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Sep 26 2018, 1:38 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| commit.diffstat = python:/path/to/this/file.py:diffstat | commit.diffstat = python:/path/to/this/file.py:diffstat | ||||
| changegroup.diffstat = python:/path/to/this/file.py:diffstat | changegroup.diffstat = python:/path/to/this/file.py:diffstat | ||||
| ''' | ''' | ||||
| if kwargs.get('parent2'): | if kwargs.get('parent2'): | ||||
| return | return | ||||
| node = kwargs['node'] | node = kwargs['node'] | ||||
| first = repo[node].p1().node() | first = repo[node].p1().node() | ||||
| if 'url' in kwargs: | if 'url' in kwargs: | ||||
| last = repo['tip'].node() | last = repo.changelog.tip() | ||||
| else: | else: | ||||
| last = node | last = node | ||||
| diff = patch.diff(repo, first, last) | diff = patch.diff(repo, first, last) | ||||
| ui.write(patch.diffstat(util.iterlines(diff))) | ui.write(patch.diffstat(util.iterlines(diff))) | ||||
| wctx = repo[None] | wctx = repo[None] | ||||
| pctx = repo['.'] | pctx = repo['.'] | ||||
| overwrite = False | overwrite = False | ||||
| mergedsubstate = subrepoutil.submerge(repo, pctx, wctx, wctx, | mergedsubstate = subrepoutil.submerge(repo, pctx, wctx, wctx, | ||||
| overwrite) | overwrite) | ||||
| files += mergedsubstate.keys() | files += mergedsubstate.keys() | ||||
| match = scmutil.matchfiles(repo, files or []) | match = scmutil.matchfiles(repo, files or []) | ||||
| oldtip = repo['tip'] | oldtip = repo.changelog.tip() | ||||
| n = newcommit(repo, None, message, ph.user, ph.date, match=match, | n = newcommit(repo, None, message, ph.user, ph.date, match=match, | ||||
| force=True) | force=True) | ||||
| if repo['tip'] == oldtip: | if repo.changelog.tip() == oldtip: | ||||
| raise error.Abort(_("qpush exactly duplicates child changeset")) | raise error.Abort(_("qpush exactly duplicates child changeset")) | ||||
| if n is None: | if n is None: | ||||
| raise error.Abort(_("repository commit failed")) | raise error.Abort(_("repository commit failed")) | ||||
| if update_status: | if update_status: | ||||
| self.applied.append(statusentry(n, patchname)) | self.applied.append(statusentry(n, patchname)) | ||||
| if patcherr: | if patcherr: | ||||
| > from __future__ import absolute_import | > from __future__ import absolute_import | ||||
| > from mercurial import context, hg, node, ui as uimod | > from mercurial import context, hg, node, ui as uimod | ||||
| > notrc = u".h\u200cg".encode('utf-8') + b'/hgrc' | > notrc = u".h\u200cg".encode('utf-8') + b'/hgrc' | ||||
| > u = uimod.ui.load() | > u = uimod.ui.load() | ||||
| > r = hg.repository(u, b'.') | > r = hg.repository(u, b'.') | ||||
| > def filectxfn(repo, memctx, path): | > def filectxfn(repo, memctx, path): | ||||
| > return context.memfilectx(repo, memctx, path, | > return context.memfilectx(repo, memctx, path, | ||||
| > b'[hooks]\nupdate = echo owned') | > b'[hooks]\nupdate = echo owned') | ||||
| > c = context.memctx(r, [r[b'tip'].node(), node.nullid], | > c = context.memctx(r, [r.changelog.tip(), node.nullid], | ||||
| > b'evil', [notrc], filectxfn, 0) | > b'evil', [notrc], filectxfn, 0) | ||||
| > r.commitctx(c) | > r.commitctx(c) | ||||
| > EOF | > EOF | ||||
| $ "$PYTHON" evil-commit.py | $ "$PYTHON" evil-commit.py | ||||
| #if windows | #if windows | ||||
| $ hg co --clean tip | $ hg co --clean tip | ||||
| abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc) | abort: path contains illegal component: .h\xe2\x80\x8cg\\hgrc (esc) | ||||
| [255] | [255] | ||||