169 |
170 |
170 def getbkfile(orig, repo): |
171 def getbkfile(orig, repo): |
171 if _hassharedbookmarks(repo): |
172 if _hassharedbookmarks(repo): |
172 srcrepo = _getsrcrepo(repo) |
173 srcrepo = _getsrcrepo(repo) |
173 if srcrepo is not None: |
174 if srcrepo is not None: |
|
175 # just orig(srcrepo) doesn't work as expected, because |
|
176 # HG_PENDING refers repo.root. |
|
177 try: |
|
178 fp, pending = txnutil.trypending(repo.root, repo.vfs, |
|
179 'bookmarks') |
|
180 if pending: |
|
181 # only in this case, bookmark information in repo |
|
182 # is up-to-date. |
|
183 return fp |
|
184 fp.close() |
|
185 except IOError as inst: |
|
186 if inst.errno != errno.ENOENT: |
|
187 raise |
|
188 |
|
189 # otherwise, we should read bookmarks from srcrepo, |
|
190 # because .hg/bookmarks in srcrepo might be already |
|
191 # changed via another sharing repo |
174 repo = srcrepo |
192 repo = srcrepo |
|
193 |
|
194 # TODO: Pending changes in repo are still invisible in |
|
195 # srcrepo, because bookmarks.pending is written only into repo. |
|
196 # See also https://www.mercurial-scm.org/wiki/SharedRepository |
175 return orig(repo) |
197 return orig(repo) |
176 |
198 |
177 def recordchange(orig, self, tr): |
199 def recordchange(orig, self, tr): |
178 # Continue with write to local bookmarks file as usual |
200 # Continue with write to local bookmarks file as usual |
179 orig(self, tr) |
201 orig(self, tr) |