@@ -49,7 +49,7 @@ fn push(args: args::PushArgs) -> proc_exit::ExitResult {
49
49
let cwd = std:: env:: current_dir ( ) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
50
50
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
51
51
let repo = git_stack:: git:: GitRepo :: new ( repo) ;
52
- let mut stack = git_stack:: backup :: Stack :: new ( & args. stack , & repo) ;
52
+ let mut stack = git_stack:: stash :: Stack :: new ( & args. stack , & repo) ;
53
53
54
54
let repo_config = git_stack:: config:: RepoConfig :: from_all ( repo. raw ( ) )
55
55
. with_code ( proc_exit:: Code :: CONFIG_ERR ) ?;
@@ -66,13 +66,13 @@ fn push(args: args::PushArgs) -> proc_exit::ExitResult {
66
66
log:: warn!( "Working tree is dirty, only capturing committed changes" ) ;
67
67
}
68
68
69
- let mut backup =
70
- git_stack:: backup :: Backup :: from_repo ( & repo) . with_code ( proc_exit:: Code :: FAILURE ) ?;
69
+ let mut snapshot =
70
+ git_stack:: stash :: Snapshot :: from_repo ( & repo) . with_code ( proc_exit:: Code :: FAILURE ) ?;
71
71
if let Some ( message) = args. message . as_deref ( ) {
72
- backup . insert_message ( message) ;
72
+ snapshot . insert_message ( message) ;
73
73
}
74
- backup . insert_parent ( & repo, & branches, & protected_branches) ;
75
- stack. push ( backup ) ?;
74
+ snapshot . insert_parent ( & repo, & branches, & protected_branches) ;
75
+ stack. push ( snapshot ) ?;
76
76
77
77
Ok ( ( ) )
78
78
}
@@ -87,23 +87,27 @@ fn list(args: args::ListArgs, colored: bool) -> proc_exit::ExitResult {
87
87
let cwd = std:: env:: current_dir ( ) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
88
88
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
89
89
let repo = git_stack:: git:: GitRepo :: new ( repo) ;
90
- let stack = git_stack:: backup :: Stack :: new ( & args. stack , & repo) ;
90
+ let stack = git_stack:: stash :: Stack :: new ( & args. stack , & repo) ;
91
91
92
- let backups : Vec < _ > = stack. iter ( ) . collect ( ) ;
93
- for ( i, backup_path ) in backups . iter ( ) . enumerate ( ) {
94
- let style = if i < backups . len ( ) - 1 {
92
+ let snapshots : Vec < _ > = stack. iter ( ) . collect ( ) ;
93
+ for ( i, snapshot_path ) in snapshots . iter ( ) . enumerate ( ) {
94
+ let style = if i < snapshots . len ( ) - 1 {
95
95
palette. info
96
96
} else {
97
97
palette. good
98
98
} ;
99
- let backup = match git_stack:: backup :: Backup :: load ( backup_path ) {
100
- Ok ( backup ) => backup ,
99
+ let snapshot = match git_stack:: stash :: Snapshot :: load ( snapshot_path ) {
100
+ Ok ( snapshot ) => snapshot ,
101
101
Err ( err) => {
102
- log:: error!( "Failed to load backup {}: {}" , backup_path. display( ) , err) ;
102
+ log:: error!(
103
+ "Failed to load snapshot {}: {}" ,
104
+ snapshot_path. display( ) ,
105
+ err
106
+ ) ;
103
107
continue ;
104
108
}
105
109
} ;
106
- match backup . metadata . get ( "message" ) {
110
+ match snapshot . metadata . get ( "message" ) {
107
111
Some ( message) => {
108
112
writeln ! (
109
113
std:: io:: stdout( ) ,
@@ -115,11 +119,11 @@ fn list(args: args::ListArgs, colored: bool) -> proc_exit::ExitResult {
115
119
writeln ! (
116
120
std:: io:: stdout( ) ,
117
121
"{}" ,
118
- style. paint( format_args!( "Path: {}" , backup_path . display( ) ) )
122
+ style. paint( format_args!( "Path: {}" , snapshot_path . display( ) ) )
119
123
) ?;
120
124
}
121
125
}
122
- for branch in backup . branches . iter ( ) {
126
+ for branch in snapshot . branches . iter ( ) {
123
127
let summary = if let Some ( summary) = branch. metadata . get ( "summary" ) {
124
128
summary. to_string ( )
125
129
} else {
@@ -177,7 +181,7 @@ fn clear(args: args::ClearArgs) -> proc_exit::ExitResult {
177
181
let cwd = std:: env:: current_dir ( ) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
178
182
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
179
183
let repo = git_stack:: git:: GitRepo :: new ( repo) ;
180
- let mut stack = git_stack:: backup :: Stack :: new ( & args. stack , & repo) ;
184
+ let mut stack = git_stack:: stash :: Stack :: new ( & args. stack , & repo) ;
181
185
182
186
stack. clear ( ) ;
183
187
@@ -188,7 +192,7 @@ fn drop(args: args::DropArgs) -> proc_exit::ExitResult {
188
192
let cwd = std:: env:: current_dir ( ) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
189
193
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
190
194
let repo = git_stack:: git:: GitRepo :: new ( repo) ;
191
- let mut stack = git_stack:: backup :: Stack :: new ( & args. stack , & repo) ;
195
+ let mut stack = git_stack:: stash :: Stack :: new ( & args. stack , & repo) ;
192
196
193
197
stack. pop ( ) ;
194
198
@@ -199,17 +203,17 @@ fn pop(args: args::PopArgs) -> proc_exit::ExitResult {
199
203
let cwd = std:: env:: current_dir ( ) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
200
204
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
201
205
let mut repo = git_stack:: git:: GitRepo :: new ( repo) ;
202
- let mut stack = git_stack:: backup :: Stack :: new ( & args. stack , & repo) ;
206
+ let mut stack = git_stack:: stash :: Stack :: new ( & args. stack , & repo) ;
203
207
204
208
if repo. is_dirty ( ) {
205
209
return Err ( proc_exit:: Code :: USAGE_ERR . with_message ( "Working tree is dirty, aborting" ) ) ;
206
210
}
207
211
208
212
match stack. peek ( ) {
209
213
Some ( last) => {
210
- let backup =
211
- git_stack:: backup :: Backup :: load ( & last) . with_code ( proc_exit:: Code :: FAILURE ) ?;
212
- backup
214
+ let snapshot =
215
+ git_stack:: stash :: Snapshot :: load ( & last) . with_code ( proc_exit:: Code :: FAILURE ) ?;
216
+ snapshot
213
217
. apply ( & mut repo)
214
218
. with_code ( proc_exit:: Code :: FAILURE ) ?;
215
219
let _ = std:: fs:: remove_file ( & last) ;
@@ -226,17 +230,17 @@ fn apply(args: args::ApplyArgs) -> proc_exit::ExitResult {
226
230
let cwd = std:: env:: current_dir ( ) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
227
231
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
228
232
let mut repo = git_stack:: git:: GitRepo :: new ( repo) ;
229
- let mut stack = git_stack:: backup :: Stack :: new ( & args. stack , & repo) ;
233
+ let mut stack = git_stack:: stash :: Stack :: new ( & args. stack , & repo) ;
230
234
231
235
if repo. is_dirty ( ) {
232
236
return Err ( proc_exit:: Code :: USAGE_ERR . with_message ( "Working tree is dirty, aborting" ) ) ;
233
237
}
234
238
235
239
match stack. peek ( ) {
236
240
Some ( last) => {
237
- let backup =
238
- git_stack:: backup :: Backup :: load ( & last) . with_code ( proc_exit:: Code :: FAILURE ) ?;
239
- backup
241
+ let snapshot =
242
+ git_stack:: stash :: Snapshot :: load ( & last) . with_code ( proc_exit:: Code :: FAILURE ) ?;
243
+ snapshot
240
244
. apply ( & mut repo)
241
245
. with_code ( proc_exit:: Code :: FAILURE ) ?;
242
246
}
@@ -253,7 +257,7 @@ fn stacks(_args: args::StacksArgs) -> proc_exit::ExitResult {
253
257
let repo = git2:: Repository :: discover ( & cwd) . with_code ( proc_exit:: Code :: USAGE_ERR ) ?;
254
258
let repo = git_stack:: git:: GitRepo :: new ( repo) ;
255
259
256
- for stack in git_stack:: backup :: Stack :: all ( & repo) {
260
+ for stack in git_stack:: stash :: Stack :: all ( & repo) {
257
261
writeln ! ( std:: io:: stdout( ) , "{}" , stack. name) ?;
258
262
}
259
263
0 commit comments