Mercurial > hg > mercurial-crew-with-dirclash
diff mercurial/dirstate.py @ 4207:7e1c8a565a4f
Move branch read/write to dirstate where it belongs
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 13 Mar 2007 18:50:02 -0500 |
parents | b36bd7534c08 |
children | dbc3846c09a1 24c22a3f2ef8 |
line wrap: on
line diff
--- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -25,6 +25,7 @@ class dirstate(object): self.dirs = None self.copymap = {} self.ignorefunc = None + self._branch = None def wjoin(self, f): return os.path.join(self.root, f) @@ -137,6 +138,15 @@ class dirstate(object): self.lazyread() return self.pl + def branch(self): + if not self._branch: + try: + self._branch = self.opener("branch").read().strip()\ + or "default" + except IOError: + self._branch = "default" + return self._branch + def markdirty(self): if not self.dirty: self.dirty = 1 @@ -146,6 +156,10 @@ class dirstate(object): self.markdirty() self.pl = p1, p2 + def setbranch(self, branch): + self._branch = branch + self.opener("branch", "w").write(branch + '\n') + def state(self, key): try: return self[key][0]