Commits

Anonymous committed ebb4208

rm pushed patches

Comments (0)

Files changed (5)

dirstate-stat

-From: Nicolas Dumazet <nicdumz.commits@gmail.com>
-
-inotify: do not rely on stat(.hg/dirstate) to invalidate our dirstate
-
-stat() is not reliable when several events happen quickly. Which means
-that if two hg actions occur in the same second, stat() result will not
-reflect the second change. And only _one_ invalidate() call was done.
-
-Also ignore the events that occur when wlock is held, since wlock release
-will trigger a full rescan anyway.
-
-Fixes 17 run-tests.py --inotify tests.
-
-diff --git a/hgext/inotify/linuxserver.py b/hgext/inotify/linuxserver.py
---- a/hgext/inotify/linuxserver.py
-+++ b/hgext/inotify/linuxserver.py
-@@ -170,6 +170,9 @@
-         server.repowatcher.__init__(self, ui, dirstate, root)
- 
-         self.lastevent = {}
-+
-+        self.queued_events = []
-+        self.dirty = False
-         try:
-             self.watcher = watcher.watcher()
-         except OSError, err:
-@@ -214,7 +217,6 @@
-     def setup(self):
-         self.ui.note(_('watching directories under %r\n') % self.wprefix)
-         self.add_watch(self.wprefix + '.hg', inotify.IN_DELETE)
--        self.check_dirstate()
- 
-     def scan(self, topdir=''):
-         ds = self.dirstate._map.copy()
-@@ -272,8 +274,6 @@
-         if wpath == '.hgignore':
-             self.update_hgignore()
-         elif wpath.startswith('.hg/'):
--            if wpath == '.hg/wlock':
--                self.check_dirstate()
-             return
- 
-         self.deletefile(wpath, self.dirstate[wpath])
-@@ -343,16 +343,26 @@
-             if wpath.startswith('.hg/') and evt.mask & inotify.IN_ISDIR:
-                 # ignore subdirectories of .hg/ (merge, patches...)
-                 continue
-+            if wpath == ".hg/wlock":
-+                if evt.mask & inotify.IN_DELETE:
-+                    self.dirstate.invalidate()
-+                    self.dirty = False
-+                    self.scan()
-+                elif evt.mask & inotify.IN_CREATE:
-+                    self.dirty = True
-+            else:
-+                if self.dirty:
-+                    continue
- 
--            if evt.mask & inotify.IN_UNMOUNT:
--                self.process_unmount(wpath, evt)
--            elif evt.mask & (inotify.IN_MODIFY | inotify.IN_ATTRIB):
--                self.process_modify(wpath, evt)
--            elif evt.mask & (inotify.IN_DELETE | inotify.IN_DELETE_SELF |
--                             inotify.IN_MOVED_FROM):
--                self.process_delete(wpath, evt)
--            elif evt.mask & (inotify.IN_CREATE | inotify.IN_MOVED_TO):
--                self.process_create(wpath, evt)
-+                if evt.mask & inotify.IN_UNMOUNT:
-+                    self.process_unmount(wpath, evt)
-+                elif evt.mask & (inotify.IN_MODIFY | inotify.IN_ATTRIB):
-+                    self.process_modify(wpath, evt)
-+                elif evt.mask & (inotify.IN_DELETE | inotify.IN_DELETE_SELF |
-+                                 inotify.IN_MOVED_FROM):
-+                    self.process_delete(wpath, evt)
-+                elif evt.mask & (inotify.IN_CREATE | inotify.IN_MOVED_TO):
-+                    self.process_create(wpath, evt)
- 
-         self.lastevent.clear()
- 
-diff --git a/hgext/inotify/server.py b/hgext/inotify/server.py
---- a/hgext/inotify/server.py
-+++ b/hgext/inotify/server.py
-@@ -286,17 +286,6 @@
-             del self.statustrees[key].dir(root).files[fn]
-             del self.tree.dir(root).files[fn]
- 
--    def check_dirstate(self):
--        ds_info = self.dirstate_info()
--        if ds_info == self.ds_info:
--            return
--        self.ds_info = ds_info
--        if not self.ui.debugflag:
--            self.last_event = None
--        self.dirstate.invalidate()
--        self.handle_timeout()
--        self.scan()
--
-     def update_hgignore(self):
-         # An update of the ignore file can potentially change the
-         # states of all unknown and ignored files.

graphlimit

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1260512733 -32400
-# Node ID 3d8d5b8162d41bcf16459bbc294222bbb7e14cb6
-# Parent  1c99072a8454b02fd993cf47c66b2b9eea72fa51
-graphlog: fix output when both a limit and a path are provided
-
-Limit was interpreted as absolute, from the topmost revision, without
-counting the number of revisions matching a given file.
-Which caused "glog -lN file" to show sometimes less than N csets if
-the file was not modified in all of the N previous csets.
-
-glog will now match the behavior of log.
-
-diff --git a/hgext/graphlog.py b/hgext/graphlog.py
---- a/hgext/graphlog.py
-+++ b/hgext/graphlog.py
-@@ -241,15 +241,15 @@
-     check_unsupported_flags(opts)
-     limit = cmdutil.loglimit(opts)
-     start, stop = get_revs(repo, opts["rev"])
--    stop = max(stop, start - limit + 1)
-     if start == nullrev:
-         return
- 
-     if path:
-         path = util.canonpath(repo.root, os.getcwd(), path)
-     if path: # could be reset in canonpath
--        revdag = graphmod.filerevs(repo, path, start, stop)
-+        revdag = graphmod.filerevs(repo, path, start, stop, limit)
-     else:
-+        stop = max(stop, start - limit + 1)
-         revdag = graphmod.revisions(repo, start, stop)
- 
-     displayer = show_changeset(ui, repo, opts, buffered=True)
-diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
---- a/mercurial/graphmod.py
-+++ b/mercurial/graphmod.py
-@@ -18,6 +18,7 @@
- """
- 
- from mercurial.node import nullrev
-+import sys
- 
- CHANGESET = 'C'
- 
-@@ -36,21 +37,25 @@
-         yield (cur, CHANGESET, ctx, sorted(parents))
-         cur -= 1
- 
--def filerevs(repo, path, start, stop):
-+def filerevs(repo, path, start, stop, limit=sys.maxint):
-     """file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples
- 
-     This generator function walks through the revision history of a single
-     file from revision start down to revision stop.
-     """
-     filerev = len(repo.file(path)) - 1
--    while filerev >= 0:
-+    if limit < sys.maxint:
-+        lower = max(0, filerev - limit + 1)
-+    else:
-+        lower = 0
-+    count = 0
-+    rev = stop + 1
-+    while filerev >= lower and rev > stop:
-         fctx = repo.filectx(path, fileid=filerev)
-         parents = [f.linkrev() for f in fctx.parents() if f.path() == path]
-         rev = fctx.rev()
-         if rev <= start:
-             yield (rev, CHANGESET, fctx.changectx(), sorted(parents))
--        if rev <= stop:
--            break
-         filerev -= 1
- 
- def nodes(repo, nodes):
-diff --git a/tests/test-glog b/tests/test-glog
---- a/tests/test-glog
-+++ b/tests/test-glog
-@@ -175,3 +175,13 @@
- hg incoming --graph ../repo
- cd ..
- hg -R repo outgoing --graph repo2
-+
-+cd repo
-+echo % file + limit with revs != cset revs
-+touch b
-+hg ci -Aqm0
-+# this used to show only one cset
-+hg glog -l2 a
-+
-+echo "% file + limit + -r, with len(revs) < limit"
-+hg glog -l3000 -r32:tip a
-diff --git a/tests/test-glog.out b/tests/test-glog.out
---- a/tests/test-glog.out
-+++ b/tests/test-glog.out
-@@ -643,3 +643,36 @@
-    date:        Thu Jan 01 00:00:27 1970 +0000
-    summary:     (27) collapse
- 
-+% file + limit with revs != cset revs
-+o  changeset:   34:fea3ac5810e0
-+|  parent:      32:d06dffa21a31
-+|  user:        test
-+|  date:        Thu Jan 01 00:00:34 1970 +0000
-+|  summary:     (34) head
-+|
-+| o  changeset:   33:68608f5145f9
-+| |  parent:      18:1aa84d96232a
-+| |  user:        test
-+| |  date:        Thu Jan 01 00:00:33 1970 +0000
-+| |  summary:     (33) head
-+| |
-+% file + limit + -r, with len(revs) < limit
-+o  changeset:   34:fea3ac5810e0
-+|  parent:      32:d06dffa21a31
-+|  user:        test
-+|  date:        Thu Jan 01 00:00:34 1970 +0000
-+|  summary:     (34) head
-+|
-+| o  changeset:   33:68608f5145f9
-+| |  parent:      18:1aa84d96232a
-+| |  user:        test
-+| |  date:        Thu Jan 01 00:00:33 1970 +0000
-+| |  summary:     (33) head
-+| |
-+o |    changeset:   32:d06dffa21a31
-+|\ \   parent:      27:886ed638191b
-+| | |  parent:      31:621d83e11f67
-+| | |  user:        test
-+| | |  date:        Thu Jan 01 00:00:32 1970 +0000
-+| | |  summary:     (32) expand
-+| | |

inotify-test-permissions

-From: Nicolas Dumazet <nicdumz.commits@gmail.com>
-
-inotify: completely ignore events on the repository root
-
-They can only be events on the top directory object. Those events are
-meaningless for us: permission changes, repository-wide moves...
-And they break the assertion that all events happen in repo/*.
-Just ignore them.
-
-Fixes one of the failures of run-test.py --inotify test-permissions
-
-diff --git a/hgext/inotify/linuxserver.py b/hgext/inotify/linuxserver.py
---- a/hgext/inotify/linuxserver.py
-+++ b/hgext/inotify/linuxserver.py
-@@ -335,6 +335,10 @@
-             self.ui.note(_('%s reading %d events\n') %
-                          (self.event_time(), len(events)))
-         for evt in events:
-+            if evt.fullpath == self.wprefix[:-1]:
-+                # events on the root of the repository
-+                # itself, e.g. permission changes or repository move
-+                continue
-             assert evt.fullpath.startswith(self.wprefix)
-             wpath = evt.fullpath[self.prefixlen:]
- 
-graphlimit
 iterators
 loglimit
-symlink-basic
-dirstate-stat
-inotify-test-permissions
 debug
 inotify-global-dir-visit
 inot-track-dirs