This is the newer, more semantic API.
Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG20c2a15cd47a: fix: use `set_possibly_dirty` instead of `normallookup`
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
Comment Actions
I noticed that this broke hg fix in some cases. I wrote a test case to show the difference (replace set_possibly_dirty by normallookup to see the different behavior)
import os from mercurial import ( hg, ui as uimod, ) ui = uimod.ui.load() repo = hg.repository(ui, b'test1', create=True) os.chdir('test1') # Add a commit with file "foo" with open('foo', 'wb') as f: f.write(b'foo\n') repo[None].add([b'foo']) node1 = repo.commit(text=b'commit1', date=b"0 0") # Modify file "foo" in a second commit with open('foo', 'wb') as f: f.write(b'foo2\n') repo.commit(text=b'commit2', date=b"0 0") # Simulate `hg checkout` of commit 1 by reverting the contents on disk # and calling dirstate.set_possibly_dirty(). with open('foo', 'wb') as f: f.write(b'foo\n') with repo.wlock(), repo.lock(), repo.transaction(b'test') as tr: with repo.dirstate.parentchange(): repo.dirstate.setparents(node1, repo.nullid) repo.dirstate.set_possibly_dirty(b'foo') # repo.dirstate.normallookup(b'foo') repo.dirstate.write(tr) repo = hg.repository(ui, b'.') print("status: %r" % repo.status())
Is that difference intended?
My hg fix case that broke was later fixed by D11210, so maybe it was just that hg fix used the API incorrectly to start with?