Mercurial > hg > mercurial-crew-with-dirclash
changeset 306:f06a4a3b86a7
Merge with TAH
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Merge with TAH
manifest hash: 9ce3631dbbe2070e6e0b8a72e197790c911896e2
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCqc+mywK+sNU5EO8RAshrAJ4rqQXCJqB1rqgDQ5ujwOhFqqRuuQCdEUsK
wpBCgWEm3xr9mxQ6rLLsihU=
=Ozg9
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Fri, 10 Jun 2005 09:36:38 -0800 |
parents | 719812eb0156 (diff) 38fb7d23b78d (current diff) |
children | 3863e08d597c |
files | hgmerge mercurial/commands.py mercurial/hg.py mercurial/revlog.py |
diffstat | 3 files changed, 64 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -306,6 +306,9 @@ def init(ui, source=None): if link: ui.debug("copying by hardlink\n") os.system("cp -al %s/.hg .hg" % source) + try: + os.remove(".hg/dirstate") + except: pass else: repo = hg.repository(ui, ".", create=1) other = hg.repository(ui, source)
--- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -136,7 +136,7 @@ class manifest(revlog): text = "".join(self.addlist) n = self.addrevision(text, transaction, link, p1, p2) - self.mapcache = (n, map) + self.mapcache = (n, map, flags) self.listcache = (text, self.addlist) self.addlist = None @@ -425,28 +425,34 @@ class localrepository: def rawcommit(self, files, text, user, date, p1=None, p2=None): p1 = p1 or self.dirstate.parents()[0] or nullid p2 = p2 or self.dirstate.parents()[1] or nullid - pchange = self.changelog.read(p1) - pmmap = self.manifest.read(pchange[0]) + c1 = self.changelog.read(p1) + c2 = self.changelog.read(p2) + m1 = self.manifest.read(c1[0]) + mf1 = self.manifest.readflags(c1[0]) + m2 = self.manifest.read(c2[0]) + tr = self.transaction() - mmap = {} + mm = m1.copy() + mfm = mf1.copy() linkrev = self.changelog.count() for f in files: try: - t = file(f).read() + t = self.wfile(f).read() + tm = is_exec(self.wjoin(f)) + r = self.file(f) + mfm[f] = tm + mm[f] = r.add(t, tr, linkrev, + m1.get(f, nullid), m2.get(f, nullid)) except IOError: - self.ui.warn("Read file %s error, skipped\n" % f) - continue - r = self.file(f) - # FIXME - need to find both parents properly - prev = pmmap.get(f, nullid) - mmap[f] = r.add(t, tr, linkrev, prev) + del mm[f] + del mfm[f] - mnode = self.manifest.add(mmap, tr, linkrev, pchange[0]) - n = self.changelog.add(mnode, files, text, tr, p1, p2, user ,date, ) + mnode = self.manifest.add(mm, mfm, tr, linkrev, c1[0], c2[0]) + n = self.changelog.add(mnode, files, text, tr, p1, p2, user, date) tr.close() self.dirstate.setparents(p1, p2) self.dirstate.clear() - self.dirstate.update(mmap.keys(), "n") + self.dirstate.update(files, "n") def commit(self, files = None, text = ""): commit = [] @@ -880,6 +886,7 @@ class localrepository: return p1, p2 = pl[0], node + pa = self.changelog.ancestor(p1, p2) m1n = self.changelog.read(p1)[0] m2n = self.changelog.read(p2)[0] man = self.manifest.ancestor(m1n, m2n) @@ -901,6 +908,7 @@ class localrepository: merge = {} get = {} remove = [] + mark = {} # construct a working dir manifest mw = m1.copy() @@ -928,11 +936,15 @@ class localrepository: mode = ((a^b) | (a^c)) ^ a merge[f] = (m1.get(f, nullid), m2[f], mode) s = 1 - # is this an unmodified file or are we clobbering? - elif mw[f] == m1[f] or force: + # are we clobbering? + # is remote's version newer? + # or are we going back in time? + elif force or m2[f] != a or (p2 == pa and mw[f] == m1[f]): self.ui.debug(" remote %s is newer, get\n" % f) get[f] = m2[f] s = 1 + else: + mark[f] = 1 if not s and mfw[f] != mf2[f]: if force: @@ -944,7 +956,7 @@ class localrepository: if mode != b: self.ui.debug(" updating permissions for %s\n" % f) set_exec(self.wjoin(f), mode) - + mark[f] = 1 del m2[f] elif f in ma: if not force and n != ma[f]: @@ -981,22 +993,28 @@ class localrepository: get[f] = merge[f][1] merge = {} - if not merge: + if pa == p1 or pa == p2: # we don't need to do any magic, just jump to the new rev mode = 'n' p1, p2 = p2, nullid else: if not allow: - self.ui.status("the following files conflict:\n") - for f in merge: - self.ui.status(" %s\n" % f) - self.ui.warn("aborting update due to conflicting files!\n") - self.ui.status("(use update -m to allow a merge)\n") + self.ui.status("this update spans a branch" + + " affecting the following files:\n") + fl = merge.keys() + get.keys() + fl.sort() + for f in fl: + cf = "" + if f in merge: cf = " (resolve)" + self.ui.status(" %s%s\n" % (f, cf)) + self.ui.warn("aborting update spanning branches!\n") + self.ui.status("(use update -m to perform a branch merge)\n") return 1 # we have to remember what files we needed to get/change # because any file that's different from either one of its # parents must be in the changeset mode = 'm' + self.dirstate.update(mark.keys(), "m") self.dirstate.setparents(p1, p2) @@ -1065,14 +1083,19 @@ class localrepository: def verify(self): filelinkrevs = {} filenodes = {} - manifestchangeset = {} changesets = revisions = files = 0 errors = 0 + seen = {} self.ui.status("checking changesets\n") for i in range(self.changelog.count()): changesets += 1 n = self.changelog.node(i) + if n in seen: + self.ui.warn("duplicate changeset at revision %d\n" % i) + errors += 1 + seen[n] = 1 + for p in self.changelog.parents(n): if p not in self.changelog.nodemap: self.ui.warn("changeset %s has unknown parent %s\n" % @@ -1084,24 +1107,23 @@ class localrepository: self.ui.warn("unpacking changeset %s: %s\n" % (short(n), inst)) errors += 1 - manifestchangeset[changes[0]] = n for f in changes[3]: filelinkrevs.setdefault(f, []).append(i) + seen = {} self.ui.status("checking manifests\n") for i in range(self.manifest.count()): n = self.manifest.node(i) + if n in seen: + self.ui.warn("duplicate manifest at revision %d\n" % i) + errors += 1 + seen[n] = 1 + for p in self.manifest.parents(n): if p not in self.manifest.nodemap: self.ui.warn("manifest %s has unknown parent %s\n" % (short(n), short(p))) errors += 1 - ca = self.changelog.node(self.manifest.linkrev(n)) - cc = manifestchangeset[n] - if ca != cc: - self.ui.warn("manifest %s points to %s, not %s\n" % - (hex(n), hex(ca), hex(cc))) - errors += 1 try: delta = mdiff.patchtext(self.manifest.delta(n)) @@ -1136,10 +1158,15 @@ class localrepository: files += 1 fl = self.file(f) nodes = { nullid: 1 } + seen = {} for i in range(fl.count()): revisions += 1 n = fl.node(i) + if n in seen: + self.ui.warn("%s: duplicate revision %d\n" % (f, i)) + errors += 1 + if n not in filenodes[f]: self.ui.warn("%s: %d:%s not in manifests\n" % (f, i, short(n)))