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
905b6668
Commit
905b6668
authored
6 years ago
by
Danny Hooper
Browse files
Options
Downloads
Patches
Plain Diff
shelve: pick the most recent shelve if none specified for --patch/--stat
Differential Revision:
https://phab.mercurial-scm.org/D3950
parent
abcf500d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hgext/shelve.py
+9
-6
9 additions, 6 deletions
hgext/shelve.py
tests/test-shelve.t
+26
-1
26 additions, 1 deletion
tests/test-shelve.t
with
35 additions
and
7 deletions
hgext/shelve.py
+
9
−
6
View file @
905b6668
...
@@ -594,6 +594,6 @@
...
@@ -594,6 +594,6 @@
for
chunk
,
label
in
patch
.
diffstatui
(
difflines
,
width
=
width
):
for
chunk
,
label
in
patch
.
diffstatui
(
difflines
,
width
=
width
):
ui
.
write
(
chunk
,
label
=
label
)
ui
.
write
(
chunk
,
label
=
label
)
def
patchcmds
(
ui
,
repo
,
pats
,
opts
,
subcommand
):
def
patchcmds
(
ui
,
repo
,
pats
,
opts
):
"""
subcommand that displays shelves
"""
"""
subcommand that displays shelves
"""
if
len
(
pats
)
==
0
:
if
len
(
pats
)
==
0
:
...
@@ -598,6 +598,11 @@
...
@@ -598,6 +598,11 @@
"""
subcommand that displays shelves
"""
"""
subcommand that displays shelves
"""
if
len
(
pats
)
==
0
:
if
len
(
pats
)
==
0
:
raise
error
.
Abort
(
_
(
"
--%s expects at least one shelf
"
)
%
subcommand
)
shelves
=
listshelves
(
repo
)
if
not
shelves
:
raise
error
.
Abort
(
_
(
"
there are no shelves to show
"
))
mtime
,
name
=
shelves
[
0
]
sname
=
util
.
split
(
name
)[
1
]
pats
=
[
sname
]
for
shelfname
in
pats
:
for
shelfname
in
pats
:
if
not
shelvedfile
(
repo
,
shelfname
,
patchextension
).
exists
():
if
not
shelvedfile
(
repo
,
shelfname
,
patchextension
).
exists
():
...
@@ -1082,10 +1087,8 @@
...
@@ -1082,10 +1087,8 @@
return
deletecmd
(
ui
,
repo
,
pats
)
return
deletecmd
(
ui
,
repo
,
pats
)
elif
checkopt
(
'
list
'
):
elif
checkopt
(
'
list
'
):
return
listcmd
(
ui
,
repo
,
pats
,
opts
)
return
listcmd
(
ui
,
repo
,
pats
,
opts
)
elif
checkopt
(
'
patch
'
):
elif
checkopt
(
'
patch
'
)
or
checkopt
(
'
stat
'
):
return
patchcmds
(
ui
,
repo
,
pats
,
opts
,
subcommand
=
'
patch
'
)
return
patchcmds
(
ui
,
repo
,
pats
,
opts
)
elif
checkopt
(
'
stat
'
):
return
patchcmds
(
ui
,
repo
,
pats
,
opts
,
subcommand
=
'
stat
'
)
else
:
else
:
return
createcmd
(
ui
,
repo
,
pats
,
opts
)
return
createcmd
(
ui
,
repo
,
pats
,
opts
)
...
...
This diff is collapsed.
Click to expand it.
tests/test-shelve.t
+
26
−
1
View file @
905b6668
...
@@ -1057,4 +1057,8 @@
...
@@ -1057,4 +1057,8 @@
$ hg shelve --patch default nonexistentshelf
$ hg shelve --patch default nonexistentshelf
abort: cannot find shelf nonexistentshelf
abort: cannot find shelf nonexistentshelf
[255]
[255]
when the user asks for a patch, we assume they want the most recent shelve if
they don
'
t
provide
a
shelve
name
$
hg
shelve
--
patch
$
hg
shelve
--
patch
...
@@ -1060,5 +1064,26 @@
...
@@ -1060,5 +1064,26 @@
$
hg
shelve
--
patch
$
hg
shelve
--
patch
abort: --patch expects at least one shelf
default
-
01
(
*
)
*
changes
to:
create
conflict
(
glob
)
diff
--
git
a
/shelf-patch-b b/s
helf
-
patch
-
b
new
file
mode
100644
---
/dev/null
+++
b
/
shelf
-
patch
-
b
@@
-
0
,
0
+
1
,
1
@@
+
patch
b
$
cd
..
you
shouldn
'
t be able to ask for the patch/stats of the most recent shelve if
there are no shelves
$ hg init noshelves
$ cd noshelves
$ hg shelve --patch
abort: there are no shelves to show
[255]
$ hg shelve --stat
abort: there are no shelves to show
[255]
[255]
$ cd ..
$ cd ..
...
...
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