Merge from http://moffetthome.net:8012/
authormpm@selenic.com
Fri, 24 Jun 2005 23:07:16 -0800
changeset 464 50da4bb9cab6
parent 462 512d76558bd4 (diff)
parent 463 ea93402b81b9 (current diff)
child 465 f8cb8d082d40
Merge from http://moffetthome.net:8012/ -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Merge from http://moffetthome.net:8012/ manifest hash: 3a67864af6b0276eabe640274633ca2625dbd4a5 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCvQKkywK+sNU5EO8RArUHAKCSGtpEfJwYGoAIpj4mBDvcPted9wCgnzML xr8WQ8DdPkJ9DVsLjvsbhJU= =O7Fd -----END PGP SIGNATURE-----
mercurial/bdiff.c
mercurial/commands.py
mercurial/mpatch.c
mercurial/util.py
mercurial/version.py
tests/test-copy
tests/test-copy.out
new file mode 100644
--- /dev/null
+++ b/contrib/mercurial.spec
@@ -0,0 +1,48 @@
+Summary: Mercurial -- a distributed SCM
+Name: mercurial
+Version: 0.6
+Release: 1
+Copyright: GPL
+Group: Development/Tools
+Distribution: RedHat
+Source: http://www.selenic.com/mercurial/release/%{name}-%{version}.tar.gz
+Packager: Arun Sharma <arun@sharma-home.net>
+Prefix: /usr
+BuildRoot: /tmp/build.%{name}-%{version}-%{release}
+
+%description
+
+Mercurial is a fast, lightweight source control management system designed
+for efficient handling of very large distributed projects.
+
+%prep
+
+rm -rf $RPM_BUILD_ROOT
+
+%setup -q -n %{name}-%{version}
+
+%build
+
+python setup.py build
+
+%install
+
+python setup.py install --root $RPM_BUILD_ROOT
+
+cd $RPM_BUILD_ROOT
+find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > \
+	$RPM_BUILD_DIR/file.list.%{name}
+
+find . -type f | sed -e 's,^\.,\%attr(-\,root\,root) ,' \
+	-e '/\/config\//s|^|%config|' \
+	-e '/\/applnk\//s|^|%config|' >> \
+	$RPM_BUILD_DIR/file.list.%{name}
+
+find . -type l | sed 's,^\.,\%attr(-\,root\,root) ,' >> \
+	$RPM_BUILD_DIR/file.list.%{name}
+
+%clean
+rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/file.list.%{name}
+
+%files -f ../file.list.%{name}
+%doc doc
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -275,6 +275,43 @@ def copy(ui, repo, source, dest):
     """mark a file as copied or renamed for the next commit"""
     return repo.copy(*relpath(repo, (source, dest)))
 
+def debugcheckdirstate(ui, repo):
+    parent1, parent2 = repo.dirstate.parents()
+    dc = repo.dirstate.dup()
+    keys = dc.keys()
+    keys.sort()
+    m1n = repo.changelog.read(parent1)[0]
+    m2n = repo.changelog.read(parent2)[0]
+    m1 = repo.manifest.read(m1n)
+    m2 = repo.manifest.read(m2n)
+    errors = 0
+    for f in dc:
+        state = repo.dirstate.state(f)
+        if state in "nr" and f not in m1:
+            print "%s in state %s, but not listed in manifest1" % (f, state)
+            errors += 1
+        if state in "a" and f in m1:
+            print "%s in state %s, but also listed in manifest1" % (f, state)
+            errors += 1
+        if state in "m" and f not in m1 and f not in m2:
+            print "%s in state %s, but not listed in either manifest" % (f, state)
+            errors += 1
+    for f in m1:
+        state = repo.dirstate.state(f)
+        if state not in "nrm":
+            print "%s in manifest1, but listed as state %s" % (f, state)
+            errors += 1
+    if errors:
+        print ".hg/dirstate inconsistent with current parent's manifest, aborting"
+        sys.exit(1)
+
+def debugdumpdirstate(ui, repo):
+    dc = repo.dirstate.dup()
+    keys = dc.keys()
+    keys.sort()
+    for file in keys:
+        print "%s => %c" % (file, dc[file][0])
+
 def debugindex(ui, file):
     r = hg.revlog(hg.opener(""), file, "")
     print "   rev    offset  length   base linkrev"+\
@@ -376,7 +413,6 @@ def import_(ui, repo, patch1, *patches, 
     
     d = opts["base"]
     strip = opts["strip"]
-    quiet = ui.quiet and "> /dev/null" or ""
 
     for patch in patches:
         ui.status("applying %s\n" % patch)
@@ -677,6 +713,8 @@ table = {
                    ('u', 'user', "", 'user')],
                   'hg commit [files]'),
     "copy": (copy, [], 'hg copy <source> <dest>'),
+    "debugcheckdirstate": (debugcheckdirstate, [], 'debugcheckdirstate'),
+    "debugdumpdirstate": (debugdumpdirstate, [], 'debugdumpdirstate'),
     "debugindex": (debugindex, [], 'debugindex <file>'),
     "debugindexdot": (debugindexdot, [], 'debugindexdot <file>'),
     "diff": (diff, [('r', 'rev', [], 'revision')],
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -16,6 +16,8 @@ def rename(src, dst):
 
 # Platfor specific varients
 if os.name == 'nt':
+    nulldev = 'NUL:'
+
     def is_exec(f, last):
         return last
 
@@ -32,7 +34,10 @@ if os.name == 'nt':
 
     def readlock(pathname):
         return file(pathname).read()
+
 else:
+    nulldev = '/dev/null'
+
     def is_exec(f, last):
         return (os.stat(f).st_mode & 0100 != 0)
 
@@ -57,5 +62,3 @@ else:
 
     def readlock(pathname):
         return os.readlink(pathname)
-
-
--- a/mercurial/version.py
+++ b/mercurial/version.py
@@ -13,6 +13,7 @@ import os
 import os.path
 import re
 import time
+import util
 
 unknown_version = 'unknown'
 remembered_version = False
@@ -37,7 +38,7 @@ def remember_version(version=None):
     """Store version information."""
     global remembered_version
     if not version and os.path.isdir(".hg"):
-        f = os.popen("hg identify 2>/dev/null")  # use real hg installation
+        f = os.popen("hg identify 2> %s" % util.nulldev)  # use real hg installation
         ident = f.read()[:-1]
         if not f.close() and ident:
             ids = ident.split(' ', 1)
--- a/tests/test-copy
+++ b/tests/test-copy
@@ -13,6 +13,8 @@ hg -d commit -t "2" -u test -d "0 0"
 hg history
 hg log a
 hexdump -C .hg/data/b.d
-hg cat b | md5sum
-hg cat a | md5sum
+hg cat b > bsum
+md5sum bsum
+hg cat a > asum
+md5sum asum
 hg verify
--- a/tests/test-copy.out
+++ b/tests/test-copy.out
@@ -39,11 +39,11 @@ 00000030  36 38 65 33 0a 63 6f 70  79 3a
 00000040  0a                                                |.|
 00000041
 + hg cat b
-+ md5sum
-60b725f10c9c85c70d97880dfe8191b3  -
++ md5sum bsum
+60b725f10c9c85c70d97880dfe8191b3  bsum
 + hg cat a
-+ md5sum
-60b725f10c9c85c70d97880dfe8191b3  -
++ md5sum asum
+60b725f10c9c85c70d97880dfe8191b3  asum
 + hg verify
 checking changesets
 checking manifests