Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 16243:b9c4302310e5 stable
localrepo: fix unpushable repos when using bookmarks (issue3317)
bookmarks is copied to journal.bookmarks differently from how dirstate is
copied to journal.dirstate. The different way is less robust, which can render
the repo unpushable by other users if the first pushing user aborts their
transaction.
The underlying cause is that the copyfile method attempts an unnecessary chmod,
which fails if the user is not the owner of the journal.bookmarks file.
This patch makes the bookmarks journaling more consistent with the rest of the
journaling, and will allow users to update lingering journal.bookmarks files
that they're not the owners of.
author | Michael Bacarella <mbacarella@janestreet.com> |
---|---|
date | Fri, 09 Mar 2012 15:34:21 -0500 |
parents | 9d4a2942a732 |
children | 17f179805297 |
comparison
equal
deleted
inserted
replaced
16242:55174ab81973 | 16243:b9c4302310e5 |
---|---|
770 self.opener.write("journal.branch", | 770 self.opener.write("journal.branch", |
771 encoding.fromlocal(self.dirstate.branch())) | 771 encoding.fromlocal(self.dirstate.branch())) |
772 self.opener.write("journal.desc", | 772 self.opener.write("journal.desc", |
773 "%d\n%s\n" % (len(self), desc)) | 773 "%d\n%s\n" % (len(self), desc)) |
774 | 774 |
775 bkname = self.join('bookmarks') | 775 try: |
776 if os.path.exists(bkname): | 776 bk = self.opener.read("bookmarks") |
777 util.copyfile(bkname, self.join('journal.bookmarks')) | 777 except IOError: |
778 else: | 778 bk = "" |
779 self.opener.write('journal.bookmarks', '') | 779 self.opener.write("journal.bookmarks", bk) |
780 | |
780 phasesname = self.sjoin('phaseroots') | 781 phasesname = self.sjoin('phaseroots') |
781 if os.path.exists(phasesname): | 782 if os.path.exists(phasesname): |
782 util.copyfile(phasesname, self.sjoin('journal.phaseroots')) | 783 util.copyfile(phasesname, self.sjoin('journal.phaseroots')) |
783 else: | 784 else: |
784 self.sopener.write('journal.phaseroots', '') | 785 self.sopener.write('journal.phaseroots', '') |