2101 |
2101 |
2102 return cmd |
2102 return cmd |
2103 |
2103 |
2104 # a list of (ui, repo) functions called by commands.summary |
2104 # a list of (ui, repo) functions called by commands.summary |
2105 summaryhooks = util.hooks() |
2105 summaryhooks = util.hooks() |
|
2106 |
|
2107 # A list of state files kept by multistep operations like graft. |
|
2108 # Since graft cannot be aborted, it is considered 'clearable' by update. |
|
2109 # note: bisect is intentionally excluded |
|
2110 # (state file, clearable, error, hint) |
|
2111 unfinishedstates = [ |
|
2112 ('graftstate', True, _('graft in progress'), |
|
2113 _("use 'hg graft --continue' or 'hg update' to abort")) |
|
2114 ] |
|
2115 |
|
2116 def checkunfinished(repo): |
|
2117 '''Look for an unfinished multistep operation, like graft, and abort |
|
2118 if found. It's probably good to check this right before |
|
2119 bailifchanged(). |
|
2120 ''' |
|
2121 for f, clearable, msg, hint in unfinishedstates: |
|
2122 if repo.vfs.exists(f): |
|
2123 raise util.Abort(msg, hint=hint) |
|
2124 |
|
2125 def clearunfinished(repo): |
|
2126 '''Check for unfinished operations (as above), and clear the ones |
|
2127 that are clearable. |
|
2128 ''' |
|
2129 for f, clearable, msg, hint in unfinishedstates: |
|
2130 if not clearable and repo.vfs.exists(f): |
|
2131 raise util.Abort(msg, hint=hint) |
|
2132 for f, clearable, msg, hint in unfinishedstates: |
|
2133 if clearable and repo.vfs.exists(f): |
|
2134 util.unlink(repo.join(f)) |