Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mercurial
mercurial-devel
Commits
9742f937
Commit
9742f937
authored
7 years ago
by
Augie Fackler
Browse files
Options
Downloads
Patches
Plain Diff
localrepo: migrate to context manager for changing dirstate parents
parent
81936f64
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/localrepo.py
+14
-15
14 additions, 15 deletions
mercurial/localrepo.py
with
14 additions
and
15 deletions
mercurial/localrepo.py
+
14
−
15
View file @
9742f937
...
...
@@ -850,21 +850,20 @@
return
self
[
changeid
]
def
setparents
(
self
,
p1
,
p2
=
nullid
):
self
.
dirstate
.
beginparentchange
()
copies
=
self
.
dirstate
.
setparents
(
p1
,
p2
)
pctx
=
self
[
p1
]
if
copies
:
# Adjust copy records, the dirstate cannot do it, it
# requires access to parents manifests. Preserve them
# only for entries added to first parent.
for
f
in
copies
:
if
f
not
in
pctx
and
copies
[
f
]
in
pctx
:
self
.
dirstate
.
copy
(
copies
[
f
],
f
)
if
p2
==
nullid
:
for
f
,
s
in
sorted
(
self
.
dirstate
.
copies
().
items
()):
if
f
not
in
pctx
and
s
not
in
pctx
:
self
.
dirstate
.
copy
(
None
,
f
)
self
.
dirstate
.
endparentchange
()
with
self
.
dirstate
.
parentchange
():
copies
=
self
.
dirstate
.
setparents
(
p1
,
p2
)
pctx
=
self
[
p1
]
if
copies
:
# Adjust copy records, the dirstate cannot do it, it
# requires access to parents manifests. Preserve them
# only for entries added to first parent.
for
f
in
copies
:
if
f
not
in
pctx
and
copies
[
f
]
in
pctx
:
self
.
dirstate
.
copy
(
copies
[
f
],
f
)
if
p2
==
nullid
:
for
f
,
s
in
sorted
(
self
.
dirstate
.
copies
().
items
()):
if
f
not
in
pctx
and
s
not
in
pctx
:
self
.
dirstate
.
copy
(
None
,
f
)
def
filectx
(
self
,
path
,
changeid
=
None
,
fileid
=
None
):
"""
changeid can be a changeset revision, node, or tag.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment