changeset 5325:5971cfc0a56a

Merge with crew
author Matt Mackall <mpm@selenic.com>
date Mon, 24 Sep 2007 12:34:26 -0500
parents 7b4b874ce12c (current diff) 8409a2e3a78d (diff)
children 319c09685f30
files mercurial/revlog.py
diffstat 8 files changed, 94 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/hbisect.py
+++ b/hgext/hbisect.py
@@ -37,10 +37,9 @@ class bisect(object):
         self.ui = ui
         self.goodrevs = []
         self.badrev = None
-        self.good_dirty = 0
-        self.bad_dirty = 0
         self.good_path = "good"
         self.bad_path = "bad"
+        self.is_reset = False
 
         if os.path.exists(os.path.join(self.path, self.good_path)):
             self.goodrevs = self.opener(self.good_path).read().splitlines()
@@ -51,8 +50,10 @@ class bisect(object):
                 self.badrev = hg.bin(r.pop(0))
 
     def write(self):
+        if self.is_reset:
+            return
         if not os.path.isdir(self.path):
-            return
+            os.mkdir(self.path)
         f = self.opener(self.good_path, "w")
         f.write("\n".join([hg.hex(r) for r in  self.goodrevs]))
         if len(self.goodrevs) > 0:
@@ -81,6 +82,7 @@ class bisect(object):
         # Not sure about this
         #self.ui.write("Going back to tip\n")
         #self.repo.update(self.repo.changelog.tip())
+        self.is_reset = True
         return 0
 
     def num_ancestors(self, head=None, stop=None):
@@ -301,10 +303,9 @@ For subcommands see "hg bisect help\"
     if len(args) > bisectcmdtable[cmd][1]:
         ui.warn(_("bisect: Too many arguments\n"))
         return help_()
-    try:
-        return bisectcmdtable[cmd][0](*args)
-    finally:
-        b.write()
+    ret = bisectcmdtable[cmd][0](*args)
+    b.write()
+    return ret
 
 cmdtable = {
     "bisect": (bisect_run, [], _("hg bisect [help|init|reset|next|good|bad]")),
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1045,14 +1045,14 @@ class localrepository(repo.repository):
     def undelete(self, list):
         wlock = None
         try:
-            p = self.dirstate.parents()[0]
-            mn = self.changelog.read(p)[0]
-            m = self.manifest.read(mn)
+            manifests = [self.manifest.read(self.changelog.read(p)[0])
+                         for p in self.dirstate.parents() if p != nullid]
             wlock = self.wlock()
             for f in list:
                 if self.dirstate[f] != 'r':
                     self.ui.warn("%s not removed!\n" % f)
                 else:
+                    m = f in manifests[0] and manifests[0] or manifests[1]
                     t = self.file(f).read(m[f])
                     self.wwrite(f, t, m.flags(f))
                     self.dirstate.normal(f)
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1038,7 +1038,7 @@ class revlog(object):
             ifh.write(entry)
         else:
             offset += curr * self._io.size
-            transaction.add(self.indexfile, offset, prev)
+            transaction.add(self.indexfile, offset, curr)
             ifh.write(entry)
             ifh.write(data[0])
             ifh.write(data[1])
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -33,7 +33,7 @@ class statichttprepository(localrepo.loc
         self._url = path
         self.ui = ui
 
-        self.path = (path + "/.hg")
+        self.path = path.rstrip('/') + "/.hg"
         self.opener = opener(self.path)
         # find requirements
         try:
new file mode 100755
--- /dev/null
+++ b/tests/test-rename-after-merge
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# Test issue 746: renaming files brought by the
+# second parent of a merge was broken.
+
+echo % create source repository
+hg init t
+cd t
+echo a > a
+hg ci -Am a
+cd ..
+
+echo % fork source repository
+hg clone t t2
+cd t2
+echo b > b
+hg ci -Am b
+
+echo % update source repository
+cd ../t
+echo a >> a
+hg ci -m a2
+
+echo % merge repositories
+hg pull ../t2
+hg merge
+
+echo % rename b as c
+hg mv b c
+hg st
+echo % rename back c as b
+hg mv c b
+hg st
new file mode 100644
--- /dev/null
+++ b/tests/test-rename-after-merge.out
@@ -0,0 +1,20 @@
+% create source repository
+adding a
+% fork source repository
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+adding b
+% update source repository
+% merge repositories
+pulling from ../t2
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+% rename b as c
+A c
+R b
+% rename back c as b
--- a/tests/test-static-http
+++ b/tests/test-static-http
@@ -49,4 +49,18 @@ echo '[hooks]' >> .hg/hgrc
 echo 'changegroup = python ../printenv.py changegroup' >> .hg/hgrc
 http_proxy= hg pull
 
+echo '% test with "/" URI (issue 747)'
+cd ..
+hg init
+echo a > a
+hg add a
+hg ci -ma
+
+http_proxy= hg clone static-http://localhost:20059/ local2
+
+cd local2
+hg verify
+cat a
+hg paths
+
 kill $!
--- a/tests/test-static-http.out
+++ b/tests/test-static-http.out
@@ -28,3 +28,17 @@ adding manifests
 adding file changes
 added 1 changesets with 1 changes to 1 files
 (run 'hg update' to get a working copy)
+% test with "/" URI (issue 747)
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+checking changesets
+checking manifests
+crosschecking files in changesets and manifests
+checking files
+1 files, 1 changesets, 1 total revisions
+a
+default = static-http://localhost:20059/