merge with i18n stable
authorMatt Mackall <mpm@selenic.com>
Thu, 21 Apr 2011 15:10:59 -0500
branchstable
changeset 13981 5da07017a4ce
parent 13980 2968b5db7929 (current diff)
parent 13968 82845434e974 (diff)
child 13983 144d64cf456e
child 14012 b247123d71f6
child 14105 9dda9b5e744c
merge with i18n
--- a/hgext/convert/filemap.py	Tue Apr 19 12:00:22 2011 -0300
+++ b/hgext/convert/filemap.py	Thu Apr 21 15:10:59 2011 -0500
@@ -209,6 +209,11 @@
             self.children[p] = self.children.get(p, 0) + 1
         return c
 
+    def _cachedcommit(self, rev):
+        if rev in self.commits:
+            return self.commits[rev]
+        return self.base.getcommit(rev)
+
     def _discard(self, *revs):
         for r in revs:
             if r is None:
@@ -308,7 +313,14 @@
 
         self.origparents[rev] = parents
 
-        closed = 'close' in self.commits[rev].extra
+        closed = False
+        if 'close' in self.commits[rev].extra:
+            # A branch closing revision is only useful if one of its
+            # parents belong to the branch being closed
+            branch = self.commits[rev].branch
+            pbranches = [self._cachedcommit(p).branch for p in mparents]
+            if branch in pbranches:
+                closed = True
 
         if len(mparents) < 2 and not closed and not self.wanted(rev, wp):
             # We don't want this revision.
--- a/mercurial/commands.py	Tue Apr 19 12:00:22 2011 -0300
+++ b/mercurial/commands.py	Thu Apr 21 15:10:59 2011 -0500
@@ -2244,10 +2244,10 @@
              num=None, id=None, branch=None, tags=None, bookmarks=None):
     """identify the working copy or specified revision
 
-    Print a summary identifiying the repository state at REV
-    using one or two parent hash identifiers, followed by a
-    "+" if there are uncommitted changes in the working directory,
-    the branch name (omitted if default) and a list of tags, bookmarks.
+    Print a summary identifying the repository state at REV using one or
+    two parent hash identifiers, followed by a "+" if the working
+    directory has uncommitted changes, the branch name (if not default),
+    a list of tags, and a list of bookmarks.
 
     When REV is not given, print a summary of the current state of the
     repository.
--- a/mercurial/help/config.txt	Tue Apr 19 12:00:22 2011 -0300
+++ b/mercurial/help/config.txt	Thu Apr 21 15:10:59 2011 -0500
@@ -22,6 +22,12 @@
 - ``<install-root>/etc/mercurial/hgrc``
 - ``<install-root>/etc/mercurial/hgrc.d/*.rc``
 
+These files do not exist by default and you will have to create the
+appropriate configuration files yourself: global configuration like
+the username setting is typically put into
+``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
+configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
+
 If there is a per-repository configuration file which is not owned by
 the active user, Mercurial will warn you that the file is skipped::
 
--- a/mercurial/hgweb/common.py	Tue Apr 19 12:00:22 2011 -0300
+++ b/mercurial/hgweb/common.py	Thu Apr 21 15:10:59 2011 -0500
@@ -86,12 +86,16 @@
 def statusmessage(code, message=None):
     return '%d %s' % (code, message or _statusmessage(code))
 
-def get_mtime(spath):
+def get_stat(spath):
+    """stat changelog if it exists, spath otherwise"""
     cl_path = os.path.join(spath, "00changelog.i")
     if os.path.exists(cl_path):
-        return os.stat(cl_path).st_mtime
+        return os.stat(cl_path)
     else:
-        return os.stat(spath).st_mtime
+        return os.stat(spath)
+
+def get_mtime(spath):
+    return get_stat(spath).st_mtime
 
 def staticfile(directory, fname, req):
     """return a file inside directory with guessed Content-Type header
--- a/mercurial/hgweb/hgweb_mod.py	Tue Apr 19 12:00:22 2011 -0300
+++ b/mercurial/hgweb/hgweb_mod.py	Thu Apr 21 15:10:59 2011 -0500
@@ -8,7 +8,7 @@
 
 import os
 from mercurial import ui, hg, hook, error, encoding, templater
-from common import get_mtime, ErrorResponse, permhooks, caching
+from common import get_stat, ErrorResponse, permhooks, caching
 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
 from request import wsgirequest
@@ -38,6 +38,7 @@
         self.repo.ui.setconfig('ui', 'interactive', 'off')
         hook.redirect(True)
         self.mtime = -1
+        self.size = -1
         self.reponame = name
         self.archives = 'zip', 'gz', 'bz2'
         self.stripecount = 1
@@ -62,9 +63,12 @@
     def refresh(self, request=None):
         if request:
             self.repo.ui.environ = request.env
-        mtime = get_mtime(self.repo.spath)
-        if mtime != self.mtime:
-            self.mtime = mtime
+        st = get_stat(self.repo.spath)
+        # compare changelog size in addition to mtime to catch
+        # rollbacks made less than a second ago
+        if st.st_mtime != self.mtime or st.st_size != self.size:
+            self.mtime = st.st_mtime
+            self.size = st.st_size
             self.repo = hg.repository(self.repo.ui, self.repo.root)
             self.maxchanges = int(self.config("web", "maxchanges", 10))
             self.stripecount = int(self.config("web", "stripes", 1))
--- a/mercurial/localrepo.py	Tue Apr 19 12:00:22 2011 -0300
+++ b/mercurial/localrepo.py	Thu Apr 21 15:10:59 2011 -0500
@@ -736,8 +736,8 @@
                     branch = self.opener("undo.branch").read()
                     self.dirstate.setbranch(branch)
                 except IOError:
-                    self.ui.warn(_("Named branch could not be reset, "
-                                   "current branch still is: %s\n")
+                    self.ui.warn(_("named branch could not be reset, "
+                                   "current branch is still: %s\n")
                                  % self.dirstate.branch())
                 self.invalidate()
                 self.dirstate.invalidate()
--- a/tests/test-convert-filemap.t	Tue Apr 19 12:00:22 2011 -0300
+++ b/tests/test-convert-filemap.t	Thu Apr 21 15:10:59 2011 -0500
@@ -282,3 +282,83 @@
   errors.fmap:5: path to exclude is missing
   abort: errors in filemap
   [255]
+
+test branch closing revision pruning if branch is pruned
+
+  $ hg init branchpruning
+  $ cd branchpruning
+  $ hg branch foo
+  marked working directory as branch foo
+  $ echo a > a
+  $ hg ci -Am adda
+  adding a
+  $ hg ci --close-branch -m closefoo
+  $ hg up 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch empty
+  marked working directory as branch empty
+  $ hg ci -m emptybranch
+  $ hg ci --close-branch -m closeempty
+  $ hg up 0
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch default
+  marked working directory as branch default
+  $ echo b > b
+  $ hg ci -Am addb
+  adding b
+  $ hg ci --close-branch -m closedefault
+  $ cat > filemap <<EOF
+  > include b
+  > EOF
+  $ cd ..
+  $ hg convert branchpruning branchpruning-hg1
+  initializing destination branchpruning-hg1 repository
+  scanning source...
+  sorting...
+  converting...
+  5 adda
+  4 closefoo
+  3 emptybranch
+  2 closeempty
+  1 addb
+  0 closedefault
+  $ glog -R branchpruning-hg1
+  o  5 "closedefault" files:
+  |
+  o  4 "addb" files: b
+  |
+  | o  3 "closeempty" files:
+  | |
+  | o  2 "emptybranch" files:
+  |/
+  | o  1 "closefoo" files:
+  |/
+  o  0 "adda" files: a
+  
+
+exercise incremental conversion at the same time
+
+  $ hg convert -r0 --filemap branchpruning/filemap branchpruning branchpruning-hg2
+  initializing destination branchpruning-hg2 repository
+  scanning source...
+  sorting...
+  converting...
+  0 adda
+  $ hg convert -r4 --filemap branchpruning/filemap branchpruning branchpruning-hg2
+  scanning source...
+  sorting...
+  converting...
+  0 addb
+  $ hg convert --filemap branchpruning/filemap branchpruning branchpruning-hg2
+  scanning source...
+  sorting...
+  converting...
+  3 closefoo
+  2 emptybranch
+  1 closeempty
+  0 closedefault
+  $ glog -R branchpruning-hg2
+  o  1 "closedefault" files:
+  |
+  o  0 "addb" files: b
+  
--- a/tests/test-convert-hg-source.t	Tue Apr 19 12:00:22 2011 -0300
+++ b/tests/test-convert-hg-source.t	Thu Apr 21 15:10:59 2011 -0500
@@ -32,24 +32,18 @@
   created new head
   $ chmod +x baz
   $ hg ci -m 'mark baz executable' -d '5 0'
-  $ hg branch foo
-  marked working directory as branch foo
-  $ hg ci -m 'branch foo' -d '6 0'
-  $ hg ci --close-branch -m 'close' -d '7 0'
   $ cd ..
   $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
   initializing destination new repository
   scanning source...
   sorting...
   converting...
-  7 add foo bar
-  6 change foo
-  5 make bar and baz copies of foo
-  4 merge local copy
-  3 merge remote copy
-  2 mark baz executable
-  1 branch foo
-  0 close
+  5 add foo bar
+  4 change foo
+  3 make bar and baz copies of foo
+  2 merge local copy
+  1 merge remote copy
+  0 mark baz executable
   $ cd new
   $ hg out ../orig
   comparing with ../orig
--- a/tests/test-rollback.t	Tue Apr 19 12:00:22 2011 -0300
+++ b/tests/test-rollback.t	Thu Apr 21 15:10:59 2011 -0500
@@ -57,7 +57,7 @@
   $ rm .hg/undo.branch
   $ hg rollback
   repository tip rolled back to revision -1 (undo commit)
-  Named branch could not be reset, current branch still is: test
+  named branch could not be reset, current branch is still: test
   working directory now based on revision -1
   $ hg branch
   test
@@ -92,3 +92,29 @@
   $ cat .hg/last-message.txt
   another precious commit message
 
+test rollback on served repository
+
+  $ hg commit -m "precious commit message"
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+  $ cd ..
+  $ hg clone http://localhost:$HGPORT u
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  updating to branch test
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd u
+  $ hg id default
+  1df294f7b1a2
+
+now rollback and observe that 'hg serve' reloads the repository and
+presents the correct tip changeset:
+
+  $ hg -R ../t rollback
+  repository tip rolled back to revision -1 (undo commit)
+  working directory now based on revision -1
+  $ hg id default
+  000000000000