changeset 1026:a5539638c5a3

Merge with MPM.
author Bryan O'Sullivan <bos@serpentine.com>
date Tue, 23 Aug 2005 15:42:06 -0700
parents 5b257e419816 (current diff) ba08f2ef8cbe (diff)
children cb31576ed3e4
files contrib/mercurial.el
diffstat 11 files changed, 88 insertions(+), 44 deletions(-) [+]
line wrap: on
line diff
--- a/MANIFEST.in	Tue Aug 23 15:27:17 2005 -0700
+++ b/MANIFEST.in	Tue Aug 23 15:42:06 2005 -0700
@@ -7,7 +7,7 @@
 include *.txt
 include templates/map templates/map-*[a-z0-9]
 include templates/*.tmpl
-include doc/README doc/*.txt doc/Makefile
+include doc/README doc/Makefile doc/*.txt doc/*.html doc/*.[0-9]
 recursive-include contrib *
 include README
 include CONTRIBUTORS
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Tue Aug 23 15:42:06 2005 -0700
@@ -0,0 +1,23 @@
+# This Makefile is only used by developers.
+PYTHON=python
+
+all:
+	@echo "Read the file README for install instructions."
+
+clean:
+	-$(PYTHON) setup.py clean --all # ignore errors of this command
+	find . -name '*.py[co]' -exec rm -f '{}' ';'
+	make -C doc clean
+
+dist:	tests doc
+	TAR_OPTIONS="--owner=root --group=root --mode=u+w,go-w,a+rX-s" $(PYTHON) setup.py sdist --force-manifest
+
+tests:
+	cd tests && ./run-tests
+
+doc:
+	make -C doc
+
+
+.PHONY: all clean dist tests doc
+
--- a/contrib/mercurial.el	Tue Aug 23 15:27:17 2005 -0700
+++ b/contrib/mercurial.el	Tue Aug 23 15:42:06 2005 -0700
@@ -858,7 +858,6 @@
       (if (> (length path) (length (hg-root path)))
 	  (call-process (hg-binary) nil t nil "log" "-r" rev1 "-r" rev2 path)
 	(call-process (hg-binary) nil t nil "log" "-r" rev1 "-r" rev2))
-      (diff-mode)
       (font-lock-fontify-buffer))))
 
 (defun hg-log-repo (path &optional rev1 rev2)
--- a/doc/Makefile	Tue Aug 23 15:27:17 2005 -0700
+++ b/doc/Makefile	Tue Aug 23 15:42:06 2005 -0700
@@ -2,7 +2,7 @@
 MAN=$(SOURCES:%.txt=%)
 HTML=$(SOURCES:%.txt=%.html)
 
-all: man
+all: man html
 
 man: $(MAN)
 
--- a/hgeditor	Tue Aug 23 15:27:17 2005 -0700
+++ b/hgeditor	Tue Aug 23 15:42:06 2005 -0700
@@ -51,7 +51,11 @@
 grep -vE '^(HG: manifest hash .*)?$' "$1" >> "$HGTMP/msg"
 
 CHECKSUM=`md5sum "$HGTMP/msg"`
-$EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
+if [ -s "$HGTMP/diff" ]; then
+    $EDITOR "$HGTMP/msg" "$HGTMP/diff" || exit $?
+else
+    $EDITOR "$HGTMP/msg" || exit $?
+fi
 echo "$CHECKSUM" | md5sum -c >/dev/null 2>&1 && exit 13
 
 if [ "$SIGN" == "1" ]; then
--- a/mercurial/hg.py	Tue Aug 23 15:27:17 2005 -0700
+++ b/mercurial/hg.py	Tue Aug 23 15:42:06 2005 -0700
@@ -700,7 +700,7 @@
                 h = fl.heads()
                 h.reverse()
                 for r in h:
-                    for l in fl.revision(r).splitlines():
+                    for l in fl.read(r).splitlines():
                         if l:
                             n, k = l.split(" ", 1)
                             addtag(self, k, n)
@@ -1022,7 +1022,7 @@
 
         def fcmp(fn, mf):
             t1 = self.wfile(fn).read()
-            t2 = self.file(fn).revision(mf.get(fn, nullid))
+            t2 = self.file(fn).read(mf.get(fn, nullid))
             return cmp(t1, t2)
 
         def mfmatches(node):
@@ -1659,7 +1659,7 @@
                 # is the wfile new since m1, and match m2?
                 if f not in m1:
                     t1 = self.wfile(f).read()
-                    t2 = self.file(f).revision(m2[f])
+                    t2 = self.file(f).read(m2[f])
                     if cmp(t1, t2) == 0:
                         n = m2[f]
                     del t1, t2
@@ -1749,7 +1749,7 @@
 
         if linear_path or force:
             # we don't need to do any magic, just jump to the new rev
-            mode = 'n'
+            branch_merge = False
             p1, p2 = p2, nullid
         else:
             if not allow:
@@ -1765,7 +1765,7 @@
                 self.ui.status("(use update -m to merge across branches" +
                                " or -C to lose changes)\n")
                 return 1
-            mode = 'm'
+            branch_merge = True
 
         if moddirstate:
             self.dirstate.setparents(p1, p2)
@@ -1784,8 +1784,8 @@
                 self.wfile(f, "w").write(t)
             util.set_exec(self.wjoin(f), mf2[f])
             if moddirstate:
-                if mode == 'm':
-                    self.dirstate.update([f], 'n', st_mtime=0)
+                if branch_merge:
+                    self.dirstate.update([f], 'n', st_mtime=-1)
                 else:
                     self.dirstate.update([f], 'n')
 
@@ -1794,23 +1794,22 @@
         files.sort()
         for f in files:
             self.ui.status("merging %s\n" % f)
-            m, o, flag = merge[f]
-            self.merge3(f, m, o)
+            my, other, flag = merge[f]
+            self.merge3(f, my, other)
             util.set_exec(self.wjoin(f), flag)
             if moddirstate:
-                if mode == 'm':
-                    # only update dirstate on branch merge, otherwise we
-                    # could mark files with changes as unchanged
-                    self.dirstate.update([f], mode)
-                elif p2 == nullid:
-                    # update dirstate from parent1's manifest
-                    m1n = self.changelog.read(p1)[0]
-                    m1 = self.manifest.read(m1n)
-                    f_len = len(self.file(f).read(m1[f]))
-                    self.dirstate.update([f], mode, st_size=f_len, st_mtime=0)
+                if branch_merge:
+                    # We've done a branch merge, mark this file as merged
+                    # so that we properly record the merger later
+                    self.dirstate.update([f], 'm')
                 else:
-                    self.ui.warn("Second parent without branch merge!?\n"
-                                 "Dirstate for file %s may be wrong.\n" % f)
+                    # We've update-merged a locally modified file, so
+                    # we set the dirstate to emulate a normal checkout
+                    # of that file some time in the past. Thus our
+                    # merge will appear as a normal local file
+                    # modification.
+                    f_len = len(self.file(f).read(other))
+                    self.dirstate.update([f], 'n', st_size=f_len, st_mtime=-1)
 
         remove.sort()
         for f in remove:
@@ -1823,10 +1822,10 @@
             try: os.removedirs(os.path.dirname(self.wjoin(f)))
             except: pass
         if moddirstate:
-            if mode == 'n':
+            if branch_merge:
+                self.dirstate.update(remove, 'r')
+            else:
                 self.dirstate.forget(remove)
-            else:
-                self.dirstate.update(remove, 'r')
 
     def merge3(self, fn, my, other):
         """perform a 3-way merge in the working directory"""
@@ -1835,7 +1834,7 @@
             pre = "%s~%s." % (os.path.basename(fn), prefix)
             (fd, name) = tempfile.mkstemp("", pre)
             f = os.fdopen(fd, "wb")
-            f.write(fl.revision(node))
+            f.write(fl.read(node))
             f.close()
             return name
 
--- a/tests/test-filebranch	Tue Aug 23 15:27:17 2005 -0700
+++ b/tests/test-filebranch	Tue Aug 23 15:42:06 2005 -0700
@@ -41,7 +41,7 @@
 
 echo merging
 hg pull ../a
-env HGMERGE=../merge hg update -vm --debug
+env HGMERGE=../merge hg update -vm
 
 echo 2m > foo
 echo 2b > baz
@@ -55,6 +55,9 @@
 echo "main: we should have a merge here"
 hg debugindex .hg/00changelog.i
 
+echo "log should show foo and quux changed"
+hg log -v -r tip
+
 echo "foo: we should have a merge here"
 hg debugindex .hg/data/foo.i
 
@@ -67,6 +70,9 @@
 echo "quux: we shouldn't have a merge here"
 hg debugindex .hg/data/quux.i
 
+echo "manifest entries should match tips of all files"
+hg manifest
+
 echo "everything should be clean now"
 hg status
 
--- a/tests/test-filebranch.out	Tue Aug 23 15:27:17 2005 -0700
+++ b/tests/test-filebranch.out	Tue Aug 23 15:42:06 2005 -0700
@@ -16,14 +16,9 @@
 (run 'hg update' to get a working copy)
 merging for foo
 resolving manifests
- force None allow 1 moddirstate True linear False
- ancestor a0486579db29 local ef1b4dbe2193 remote 336d8406d617
- remote bar is newer, get
- foo versions differ, resolve
 getting bar
 merging foo
 resolving foo
-file foo: other 33d1fb69067a ancestor b8e02f643373
 we shouldn't have anything but foo in merge state here
 m 644          3 foo
 main: we should have a merge here
@@ -31,7 +26,19 @@
      0         0      73      0       0 cdca01651b96 000000000000 000000000000
      1        73      68      1       1 f6718a9cb7f3 cdca01651b96 000000000000
      2       141      68      2       2 bdd988058d16 cdca01651b96 000000000000
-     3       209      66      3       3 9da9fbd62226 f6718a9cb7f3 bdd988058d16
+     3       209      66      3       3 d8a521142a3c f6718a9cb7f3 bdd988058d16
+log should show foo and quux changed
+changeset:   3:d8a521142a3c02186ee6c7254738a7e6427ed4c8
+tag:         tip
+parent:      1:f6718a9cb7f31f1a92d27bd6544c71617d6d4e4f
+parent:      2:bdd988058d16e2d7392958eace7b64817e44a54e
+user:        test
+date:        Thu Jan  1 00:00:00 1970 +0000
+files:       foo quux
+description:
+merge
+
+
 foo: we should have a merge here
    rev    offset  length   base linkrev nodeid       p1           p2
      0         0       3      0       0 b8e02f643373 000000000000 000000000000
@@ -50,6 +57,11 @@
    rev    offset  length   base linkrev nodeid       p1           p2
      0         0       3      0       0 b8e02f643373 000000000000 000000000000
      1         3       5      1       3 6128c0f33108 b8e02f643373 000000000000
+manifest entries should match tips of all files
+33d1fb69067a0139622a3fa3b7ba1cdb1367972e 644 bar
+2ffeddde1b65b4827f6746174a145474129fa2ce 644 baz
+aa27919ee4303cfd575e1fb932dd64d75aa08be4 644 foo
+6128c0f33108e8cfbb4e0824d13ae48b466d7280 644 quux
 everything should be clean now
 checking changesets
 checking manifests
--- a/tests/test-merge6.out	Tue Aug 23 15:27:17 2005 -0700
+++ b/tests/test-merge6.out	Tue Aug 23 15:42:06 2005 -0700
@@ -6,7 +6,7 @@
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
 bar should remain deleted.
-f405ac83a5611071d6b54dd5eb26943b1fdc4460 644 foo
+f9b0e817f6a48de3564c6b2957687c5e7297c5a0 644 foo
 pulling from ../A2
 searching for changes
 adding changesets
--- a/tests/test-rawcommit1.out	Tue Aug 23 15:27:17 2005 -0700
+++ b/tests/test-rawcommit1.out	Tue Aug 23 15:42:06 2005 -0700
@@ -11,7 +11,7 @@
 
 05f9e54f4c9b86b09099803d8b49a50edcb4eaab 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
-changeset:   3:c8225a106186
+changeset:   3:142428fbbcc5
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
@@ -19,7 +19,7 @@
 
 d6e3c4976c13feb1728cd3ac851abaf7256a5c23 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
-changeset:   4:8dfeee82a94b
+changeset:   4:4d450f9aa680
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
@@ -28,16 +28,16 @@
 05f9e54f4c9b86b09099803d8b49a50edcb4eaab 644 a
 54837d97f2932a8194e69745a280a2c11e61ff9c 644 b
 3570202ceac2b52517df64ebd0a062cb0d8fe33a 644 c
-changeset:   4:8dfeee82a94b
+changeset:   4:4d450f9aa680
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
 summary:     4
 
 d6e3c4976c13feb1728cd3ac851abaf7256a5c23 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
-changeset:   6:c0e932ecae5e
+changeset:   6:b4b8b9afa8cc
 tag:         tip
-parent:      4:8dfeee82a94b
+parent:      4:4d450f9aa680
 parent:      5:a7925a42d0df
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
@@ -45,7 +45,7 @@
 
 d6e3c4976c13feb1728cd3ac851abaf7256a5c23 644 a
 76d5e637cbec1bcc04a5a3fa4bcc7d13f6847c00 644 c
-changeset:   7:3a157da4365d
+changeset:   7:f84d0b1b024e
 tag:         tip
 user:        test
 date:        Thu Jan  1 00:00:00 1970 +0000
--- a/tests/test-tags.out	Tue Aug 23 15:27:17 2005 -0700
+++ b/tests/test-tags.out	Tue Aug 23 15:42:06 2005 -0700
@@ -10,4 +10,5 @@
 acb14030fe0a21b60322c440ad2d20cf7685a376+ first
 M a
 c8edf04160c7 tip
-c8edf04160c7+b9154636be93 tip
+c8edf04160c7+b9154636be93+ tip
+M .hgtags