Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mercurial
evolve
Commits
292de4cca111
Commit
292de4cc
authored
Jan 13, 2020
by
Anton Shestakov
Browse files
obshistory: make patchavailable() handle predecessors too
parent
ee5ad9739ed1
Pipeline
#5296
passed with stage
in 5 minutes and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
hgext3rd/evolve/obshistory.py
View file @
292de4cc
...
...
@@ -213,7 +213,7 @@
'''
pass
def
patchavailable
(
node
,
repo
,
successors
):
def
patchavailable
(
node
,
repo
,
candidates
,
successive
=
True
):
if
node
not
in
repo
:
return
False
,
b
"context is not local"
...
...
@@ -217,10 +217,16 @@
if
node
not
in
repo
:
return
False
,
b
"context is not local"
if
len
(
successors
)
==
0
:
return
False
,
b
"no successors"
elif
len
(
successors
)
>
1
:
return
False
,
b
"too many successors (%d)"
%
len
(
successors
)
succ
=
successors
[
0
]
if
len
(
candidates
)
==
0
:
if
successive
:
msg
=
b
"no successors"
else
:
msg
=
b
"no predecessors"
return
False
,
msg
elif
len
(
candidates
)
>
1
:
if
successive
:
msg
=
b
"too many successors (%d)"
else
:
msg
=
b
"too many predecessors (%d)"
return
False
,
msg
%
len
(
candidates
)
...
...
@@ -226,4 +232,3 @@
if
succ
not
in
repo
:
return
False
,
b
"successor is unknown locally"
cand
=
candidates
[
0
]
...
...
@@ -229,3 +234,10 @@
# Check that both node and succ have the same parents
if
cand
not
in
repo
:
if
successive
:
msg
=
b
"successor is unknown locally"
else
:
msg
=
b
"predecessor is unknown locally"
return
False
,
msg
# Check that both node and cand have the same parents
nodep1
,
nodep2
=
repo
[
node
].
p1
(),
repo
[
node
].
p2
()
...
...
@@ -231,3 +243,3 @@
nodep1
,
nodep2
=
repo
[
node
].
p1
(),
repo
[
node
].
p2
()
succp1
,
succ
p2
=
repo
[
succ
].
p1
(),
repo
[
succ
].
p2
()
candp1
,
cand
p2
=
repo
[
cand
].
p1
(),
repo
[
cand
].
p2
()
...
...
@@ -233,4 +245,4 @@
if
nodep1
!=
succ
p1
or
nodep2
!=
succ
p2
:
if
nodep1
!=
cand
p1
or
nodep2
!=
cand
p2
:
return
False
,
b
"changesets rebased"
...
...
@@ -235,6 +247,6 @@
return
False
,
b
"changesets rebased"
return
True
,
succ
return
True
,
cand
def
getmarkerdescriptionpatch
(
repo
,
basedesc
,
succdesc
):
# description are stored without final new line,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment