Show More
@@ -72,24 +72,6 b" patchextension = b'patch'" | |||
|
72 | 72 | shelveuser = b'shelve@localhost' |
|
73 | 73 | |
|
74 | 74 | |
|
75 | class shelvedfile(object): | |
|
76 | """Helper for the file storing a single shelve | |
|
77 | ||
|
78 | Handles common functions on shelve files (.hg/.patch) using | |
|
79 | the vfs layer""" | |
|
80 | ||
|
81 | def __init__(self, repo, name, filetype=None): | |
|
82 | self.name = name | |
|
83 | self.vfs = vfsmod.vfs(repo.vfs.join(shelvedir)) | |
|
84 | if filetype: | |
|
85 | self.fname = name + b'.' + filetype | |
|
86 | else: | |
|
87 | self.fname = name | |
|
88 | ||
|
89 | def exists(self): | |
|
90 | return self.vfs.exists(self.fname) | |
|
91 | ||
|
92 | ||
|
93 | 75 | class Shelf(object): |
|
94 | 76 | """Represents a shelf, including possibly multiple files storing it. |
|
95 | 77 | |
@@ -113,6 +95,9 b' class Shelf(object):' | |||
|
113 | 95 | def writeinfo(self, info): |
|
114 | 96 | scmutil.simplekeyvaluefile(self.vfs, self.name + b'.shelve').write(info) |
|
115 | 97 | |
|
98 | def hasinfo(self): | |
|
99 | return self.vfs.exists(self.name + b'.shelve') | |
|
100 | ||
|
116 | 101 | def readinfo(self): |
|
117 | 102 | return scmutil.simplekeyvaluefile( |
|
118 | 103 | self.vfs, self.name + b'.shelve' |
@@ -890,7 +875,7 b' def _unshelverestorecommit(ui, repo, tr,' | |||
|
890 | 875 | """Recreate commit in the repository during the unshelve""" |
|
891 | 876 | repo = repo.unfiltered() |
|
892 | 877 | node = None |
|
893 |
if |
|
|
878 | if Shelf(repo, basename).hasinfo(): | |
|
894 | 879 | node = Shelf(repo, basename).readinfo()[b'node'] |
|
895 | 880 | if node is None or node not in repo: |
|
896 | 881 | with ui.configoverride({(b'ui', b'quiet'): True}): |
General Comments 0
You need to be logged in to leave comments.
Login now