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
636554d5
Commit
636554d5
authored
14 years ago
by
kiilerix
Browse files
Options
Downloads
Patches
Plain Diff
subrepo: docstrings
parent
efbc09fd
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/subrepo.py
+12
-2
12 additions, 2 deletions
mercurial/subrepo.py
with
12 additions
and
2 deletions
mercurial/subrepo.py
+
12
−
2
View file @
636554d5
...
...
@@ -13,6 +13,10 @@
nullstate
=
(
''
,
''
,
'
empty
'
)
def
state
(
ctx
):
"""
return a state dict, mapping subrepo paths configured in .hgsub
to tuple: (source from .hgsub, revision from .hgsubstate, kind
(key in types dict))
"""
p
=
config
.
config
()
def
read
(
f
,
sections
=
None
,
remap
=
None
):
if
f
in
ctx
:
...
...
@@ -46,8 +50,9 @@
return
state
def
writestate
(
repo
,
state
):
"""
rewrite .hgsubstate in (outer) repo with these subrepo states
"""
repo
.
wwrite
(
'
.hgsubstate
'
,
''
.
join
([
'
%s %s
\n
'
%
(
state
[
s
][
1
],
s
)
for
s
in
sorted
(
state
)]),
''
)
def
submerge
(
repo
,
wctx
,
mctx
,
actx
):
...
...
@@ -49,9 +54,10 @@
repo
.
wwrite
(
'
.hgsubstate
'
,
''
.
join
([
'
%s %s
\n
'
%
(
state
[
s
][
1
],
s
)
for
s
in
sorted
(
state
)]),
''
)
def
submerge
(
repo
,
wctx
,
mctx
,
actx
):
# working context, merging context, ancestor context
"""
delegated from merge.applyupdates: merging of .hgsubstate file
in working context, merging context and ancestor context
"""
if
mctx
==
actx
:
# backwards?
actx
=
wctx
.
p1
()
s1
=
wctx
.
substate
...
...
@@ -131,6 +137,7 @@
writestate
(
repo
,
sm
)
def
relpath
(
sub
):
"""
return path to this subrepo as seen from outermost repo
"""
if
not
hasattr
(
sub
,
'
_repo
'
):
return
sub
.
_path
parent
=
sub
.
_repo
...
...
@@ -139,6 +146,8 @@
return
sub
.
_repo
.
root
[
len
(
parent
.
root
)
+
1
:]
def
_abssource
(
repo
,
push
=
False
):
"""
return pull/push path of repo - either based on parent repo
.hgsub info or on the subrepos own config
"""
if
hasattr
(
repo
,
'
_subparent
'
):
source
=
repo
.
_subsource
if
source
.
startswith
(
'
/
'
)
or
'
://
'
in
source
:
...
...
@@ -158,6 +167,7 @@
return
repo
.
ui
.
config
(
'
paths
'
,
'
default
'
,
repo
.
root
)
def
subrepo
(
ctx
,
path
):
"""
return instance of the right subrepo class for subrepo in path
"""
# subrepo inherently violates our import layering rules
# because it wants to make repo objects from deep inside the stack
# so we manually delay the circular imports to not break
...
...
@@ -184,7 +194,7 @@
# get(self, state): run whatever commands are needed to put the
# subrepo into this state
# merge(self, state): merge currently-saved state with the new state.
# push(self, force): perform whatever action is anal
a
gous to 'hg push'
# push(self, force): perform whatever action is anal
o
gous to 'hg push'
# This may be a no-op on some systems.
class
hgsubrepo
(
object
):
...
...
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