Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hg-pull-mirror-test2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
heptapod
Testing Projects
hg-pull-mirror-test2
Commits
274c99fc
Commit
274c99fc
authored
17 years ago
by
Matt Mackall
Browse files
Options
Downloads
Patches
Plain Diff
dirstate: simplify state()
parent
b43f1769
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mercurial/dirstate.py
+7
-17
7 additions, 17 deletions
mercurial/dirstate.py
with
7 additions
and
17 deletions
mercurial/dirstate.py
+
7
−
17
View file @
274c99fc
...
...
@@ -12,4 +12,7 @@
import
struct
,
os
,
time
,
bisect
,
stat
,
strutil
,
util
,
re
,
errno
,
ignore
import
cStringIO
_unknown
=
(
'
?
'
,
0
,
0
,
0
)
_format
=
"
>cllll
"
class
dirstate
(
object
):
...
...
@@ -15,5 +18,4 @@
class
dirstate
(
object
):
format
=
"
>cllll
"
def
__init__
(
self
,
opener
,
ui
,
root
):
self
.
opener
=
opener
...
...
@@ -90,14 +92,6 @@
def
__getitem__
(
self
,
key
):
return
self
.
map
[
key
]
_unknown
=
(
'
?
'
,
0
,
0
,
0
)
def
get
(
self
,
key
):
try
:
return
self
[
key
]
except
KeyError
:
return
self
.
_unknown
def
__contains__
(
self
,
key
):
return
key
in
self
.
map
...
...
@@ -120,10 +114,7 @@
self
.
opener
(
"
branch
"
,
"
w
"
).
write
(
branch
+
'
\n
'
)
def
state
(
self
,
key
):
try
:
return
self
[
key
][
0
]
except
KeyError
:
return
"
?
"
return
self
.
map
.
get
(
key
,
(
"
?
"
,))[
0
]
def
read
(
self
):
self
.
map
=
{}
...
...
@@ -142,7 +133,6 @@
# deref fields so they will be local in loop
dmap
=
self
.
map
copymap
=
self
.
copymap
format
=
self
.
format
unpack
=
struct
.
unpack
pos
=
40
...
...
@@ -146,7 +136,7 @@
unpack
=
struct
.
unpack
pos
=
40
e_size
=
struct
.
calcsize
(
format
)
e_size
=
struct
.
calcsize
(
_
format
)
while
pos
<
len
(
st
):
newpos
=
pos
+
e_size
...
...
@@ -150,7 +140,7 @@
while
pos
<
len
(
st
):
newpos
=
pos
+
e_size
e
=
unpack
(
format
,
st
[
pos
:
newpos
])
e
=
unpack
(
_
format
,
st
[
pos
:
newpos
])
l
=
e
[
4
]
pos
=
newpos
newpos
=
pos
+
l
...
...
@@ -258,7 +248,7 @@
c
=
self
.
copied
(
f
)
if
c
:
f
=
f
+
"
\0
"
+
c
e
=
struct
.
pack
(
self
.
format
,
e
[
0
],
e
[
1
],
e
[
2
],
e
[
3
],
len
(
f
))
e
=
struct
.
pack
(
_
format
,
e
[
0
],
e
[
1
],
e
[
2
],
e
[
3
],
len
(
f
))
cs
.
write
(
e
)
cs
.
write
(
f
)
st
=
self
.
opener
(
"
dirstate
"
,
"
w
"
,
atomictemp
=
True
)
...
...
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