We are cheating a bit to enforce we are in a pending change context. This will
have to be cleaned up later.
The end goal is reached, we are now using the newer, more semantic API.
( )
Alphare | |
pulkit |
hg-reviewers |
We are cheating a bit to enforce we are in a pending change context. This will
have to be cleaned up later.
The end goal is reached, we are now using the newer, more semantic API.
No Linters Available |
No Unit Test Coverage |
mercurial/dirstate.py | ||
---|---|---|
510 ↗ | (On Diff #29450) | This is the remain of some older draft that is clinging to life, it should be dropped. (update coming) |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/cmdutil.py (14 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
f6de450c27ab | ad95e2ab6d71 | Pierre-Yves David | Jul 18 2021, 7:17 PM |
dirstate = repo.dirstate | dirstate = repo.dirstate | ||||
for realname, tmpname in pycompat.iteritems(backups): | for realname, tmpname in pycompat.iteritems(backups): | ||||
ui.debug(b'restoring %r to %r\n' % (tmpname, realname)) | ui.debug(b'restoring %r to %r\n' % (tmpname, realname)) | ||||
if dirstate[realname] == b'n': | if dirstate[realname] == b'n': | ||||
# without normallookup, restoring timestamp | # without normallookup, restoring timestamp | ||||
# may cause partially committed files | # may cause partially committed files | ||||
# to be treated as unmodified | # to be treated as unmodified | ||||
dirstate.normallookup(realname) | |||||
# XXX-PENDINGCHANGE: We should clarify the context in | |||||
# which this function is called to make sure it | |||||
# already called within a `pendingchange`, However we | |||||
# are taking a shortcut here in order to be able to | |||||
# quickly deprecated the older API. | |||||
with dirstate.parentchange(): | |||||
dirstate.update_file( | |||||
realname, | |||||
p1_tracked=True, | |||||
wc_tracked=True, | |||||
possibly_dirty=True, | |||||
) | |||||
# copystat=True here and above are a hack to trick any | # copystat=True here and above are a hack to trick any | ||||
# editors that have f open that we haven't modified them. | # editors that have f open that we haven't modified them. | ||||
# | # | ||||
# Also note that this racy as an editor could notice the | # Also note that this racy as an editor could notice the | ||||
# file's mtime before we've finished writing it. | # file's mtime before we've finished writing it. | ||||
util.copyfile(tmpname, repo.wjoin(realname), copystat=True) | util.copyfile(tmpname, repo.wjoin(realname), copystat=True) | ||||
os.unlink(tmpname) | os.unlink(tmpname) |