##// END OF EJS Templates
merge with stable
Martin Geisler -
r13959:141f88ae merge default
parent child Browse files
Show More
@@ -22,6 +22,12 b' On Unix, these files are read:'
22 - ``<install-root>/etc/mercurial/hgrc``
22 - ``<install-root>/etc/mercurial/hgrc``
23 - ``<install-root>/etc/mercurial/hgrc.d/*.rc``
23 - ``<install-root>/etc/mercurial/hgrc.d/*.rc``
24
24
25 These files do not exist by default and you will have to create the
26 appropriate configuration files yourself: global configuration like
27 the username setting is typically put into
28 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
29 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
30
25 If there is a per-repository configuration file which is not owned by
31 If there is a per-repository configuration file which is not owned by
26 the active user, Mercurial will warn you that the file is skipped::
32 the active user, Mercurial will warn you that the file is skipped::
27
33
@@ -105,12 +105,16 b' def _statusmessage(code):'
105 def statusmessage(code, message=None):
105 def statusmessage(code, message=None):
106 return '%d %s' % (code, message or _statusmessage(code))
106 return '%d %s' % (code, message or _statusmessage(code))
107
107
108 def get_mtime(spath):
108 def get_stat(spath):
109 """stat changelog if it exists, spath otherwise"""
109 cl_path = os.path.join(spath, "00changelog.i")
110 cl_path = os.path.join(spath, "00changelog.i")
110 if os.path.exists(cl_path):
111 if os.path.exists(cl_path):
111 return os.stat(cl_path).st_mtime
112 return os.stat(cl_path)
112 else:
113 else:
113 return os.stat(spath).st_mtime
114 return os.stat(spath)
115
116 def get_mtime(spath):
117 return get_stat(spath).st_mtime
114
118
115 def staticfile(directory, fname, req):
119 def staticfile(directory, fname, req):
116 """return a file inside directory with guessed Content-Type header
120 """return a file inside directory with guessed Content-Type header
@@ -8,7 +8,7 b''
8
8
9 import os
9 import os
10 from mercurial import ui, hg, hook, error, encoding, templater
10 from mercurial import ui, hg, hook, error, encoding, templater
11 from common import get_mtime, ErrorResponse, permhooks, caching
11 from common import get_stat, ErrorResponse, permhooks, caching
12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
12 from common import HTTP_OK, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST
13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
13 from common import HTTP_NOT_FOUND, HTTP_SERVER_ERROR
14 from request import wsgirequest
14 from request import wsgirequest
@@ -39,6 +39,7 b' class hgweb(object):'
39 self.repo.ui.setconfig('ui', 'interactive', 'off')
39 self.repo.ui.setconfig('ui', 'interactive', 'off')
40 hook.redirect(True)
40 hook.redirect(True)
41 self.mtime = -1
41 self.mtime = -1
42 self.size = -1
42 self.reponame = name
43 self.reponame = name
43 self.archives = 'zip', 'gz', 'bz2'
44 self.archives = 'zip', 'gz', 'bz2'
44 self.stripecount = 1
45 self.stripecount = 1
@@ -63,9 +64,12 b' class hgweb(object):'
63 def refresh(self, request=None):
64 def refresh(self, request=None):
64 if request:
65 if request:
65 self.repo.ui.environ = request.env
66 self.repo.ui.environ = request.env
66 mtime = get_mtime(self.repo.spath)
67 st = get_stat(self.repo.spath)
67 if mtime != self.mtime:
68 # compare changelog size in addition to mtime to catch
68 self.mtime = mtime
69 # rollbacks made less than a second ago
70 if st.st_mtime != self.mtime or st.st_size != self.size:
71 self.mtime = st.st_mtime
72 self.size = st.st_size
69 self.repo = hg.repository(self.repo.ui, self.repo.root)
73 self.repo = hg.repository(self.repo.ui, self.repo.root)
70 self.maxchanges = int(self.config("web", "maxchanges", 10))
74 self.maxchanges = int(self.config("web", "maxchanges", 10))
71 self.stripecount = int(self.config("web", "stripes", 1))
75 self.stripecount = int(self.config("web", "stripes", 1))
@@ -743,8 +743,8 b' class localrepository(repo.repository):'
743 branch = self.opener("undo.branch").read()
743 branch = self.opener("undo.branch").read()
744 self.dirstate.setbranch(branch)
744 self.dirstate.setbranch(branch)
745 except IOError:
745 except IOError:
746 self.ui.warn(_("Named branch could not be reset, "
746 self.ui.warn(_("named branch could not be reset, "
747 "current branch still is: %s\n")
747 "current branch is still: %s\n")
748 % self.dirstate.branch())
748 % self.dirstate.branch())
749 self.invalidate()
749 self.invalidate()
750 self.dirstate.invalidate()
750 self.dirstate.invalidate()
@@ -56,7 +56,7 b' Test rollback of hg before issue 902 was'
56 $ rm .hg/undo.branch
56 $ rm .hg/undo.branch
57 $ hg rollback
57 $ hg rollback
58 repository tip rolled back to revision -1 (undo commit)
58 repository tip rolled back to revision -1 (undo commit)
59 Named branch could not be reset, current branch still is: test
59 named branch could not be reset, current branch is still: test
60 working directory now based on revision -1
60 working directory now based on revision -1
61 $ hg branch
61 $ hg branch
62 test
62 test
@@ -91,3 +91,29 b' same thing, but run $EDITOR'
91 $ cat .hg/last-message.txt
91 $ cat .hg/last-message.txt
92 another precious commit message
92 another precious commit message
93
93
94 test rollback on served repository
95
96 $ hg commit -m "precious commit message"
97 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
98 $ cat hg.pid >> $DAEMON_PIDS
99 $ cd ..
100 $ hg clone http://localhost:$HGPORT u
101 requesting all changes
102 adding changesets
103 adding manifests
104 adding file changes
105 added 1 changesets with 1 changes to 1 files
106 updating to branch test
107 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 $ cd u
109 $ hg id default
110 1df294f7b1a2
111
112 now rollback and observe that 'hg serve' reloads the repository and
113 presents the correct tip changeset:
114
115 $ hg -R ../t rollback
116 repository tip rolled back to revision -1 (undo commit)
117 working directory now based on revision -1
118 $ hg id default
119 000000000000
General Comments 0
You need to be logged in to leave comments. Login now