Commits

Anonymous committed bd8a86f

rm pushed patches

Comments (0)

Files changed (8)

10103.diff

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1261371356 -32400
-# Node ID ea1d25164f9776507ef18dd6d273f49c8a89da9f
-# Parent  1720d70cd6d4cbfdf6ed85833c4b0c1d17fec5f7
-bookmarks: turn repo._bookmarks into a propertycache
-
-diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
---- a/hgext/bookmarks.py
-+++ b/hgext/bookmarks.py
-@@ -43,15 +43,13 @@
-     The parsed dictionary is cached until a write() operation is done.
-     '''
-     try:
--        if repo._bookmarks:
--            return repo._bookmarks
--        repo._bookmarks = {}
-+        bookmarks = {}
-         for line in repo.opener('bookmarks'):
-             sha, refspec = line.strip().split(' ', 1)
--            repo._bookmarks[refspec] = repo.lookup(sha)
-+            bookmarks[refspec] = repo.lookup(sha)
-     except:
-         pass
--    return repo._bookmarks
-+    return bookmarks
- 
- def write(repo, refs):
-     '''Write bookmarks
-@@ -104,7 +102,7 @@
-     if current(repo) == mark:
-         return
- 
--    refs = parse(repo)
-+    refs = repo._bookmarks
- 
-     # do not update if we do update to a rev equal to the current bookmark
-     if (mark and mark not in refs and
-@@ -135,7 +133,7 @@
-     the bookmark is assigned to that revision.
-     '''
-     hexfn = ui.debugflag and hex or short
--    marks = parse(repo)
-+    marks = repo._bookmarks
-     cur   = repo.changectx('.').node()
- 
-     if rename:
-@@ -219,7 +217,7 @@
-     the mercurial.strip method. This usually happens during
-     qpush and qpop"""
-     revisions = _revstostrip(repo.changelog, node)
--    marks = parse(repo)
-+    marks = repo._bookmarks
-     update = []
-     for mark, n in marks.iteritems():
-         if repo.changelog.rev(n) in revisions:
-@@ -236,18 +234,20 @@
- 
-     # init a bookmark cache as otherwise we would get a infinite reading
-     # in lookup()
--    repo._bookmarks = None
-     repo._bookmarkcurrent = None
- 
-     class bookmark_repo(repo.__class__):
-+
-+        @util.propertycache
-+        def _bookmarks(self):
-+            return parse(self)
-+
-         def rollback(self):
-             if os.path.exists(self.join('undo.bookmarks')):
-                 util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
-             return super(bookmark_repo, self).rollback()
- 
-         def lookup(self, key):
--            if self._bookmarks is None:
--                self._bookmarks = parse(self)
-             if key in self._bookmarks:
-                 key = self._bookmarks[key]
-             return super(bookmark_repo, self).lookup(key)
-@@ -263,7 +263,7 @@
-                 parents = self.changelog.parents(node)
-                 if parents[1] == nullid:
-                     parents = (parents[0],)
--                marks = parse(self)
-+                marks = self._bookmarks
-                 update = False
-                 if ui.configbool('bookmarks', 'track.current'):
-                     mark = current(self)
-@@ -290,7 +290,7 @@
-                 # We have more heads than before
-                 return result
-             node = self.changelog.tip()
--            marks = parse(self)
-+            marks = self._bookmarks
-             update = False
-             if ui.configbool('bookmarks', 'track.current'):
-                 mark = current(self)
-@@ -309,7 +309,7 @@
-         def _findtags(self):
-             """Merge bookmarks with normal tags"""
-             (tags, tagtypes) = super(bookmark_repo, self)._findtags()
--            tags.update(parse(self))
-+            tags.update(self._bookmarks)
-             return (tags, tagtypes)
- 
-     repo.__class__ = bookmark_repo

10104.diff

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1261375517 -32400
-# Node ID cacf8011e7a496f199a8a7d6c8a44c91693b306b
-# Parent  ea1d25164f9776507ef18dd6d273f49c8a89da9f
-bookmarks: eliminate infinite lookup suspicions
-
-When parsing _bookmarks, we explicitely need super( ).lookup( )
-Write down this call instead of relying on a (if key in self._bookmarks) test
-that has no reason to work in current code.
-Also update the docstrings of parse: the value of _bookmarks was never deleted,
-even after a write()
-
-diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
---- a/hgext/bookmarks.py
-+++ b/hgext/bookmarks.py
-@@ -37,16 +37,14 @@
-     '''Parse .hg/bookmarks file and return a dictionary
- 
-     Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values
--    in the .hg/bookmarks file. They are read by the parse() method and
--    returned as a dictionary with name => hash values.
--
--    The parsed dictionary is cached until a write() operation is done.
-+    in the .hg/bookmarks file. They are read returned as a dictionary
-+    with name => hash values.
-     '''
-     try:
-         bookmarks = {}
-         for line in repo.opener('bookmarks'):
-             sha, refspec = line.strip().split(' ', 1)
--            bookmarks[refspec] = repo.lookup(sha)
-+            bookmarks[refspec] = super(bookmark_repo, repo).lookup(sha)
-     except:
-         pass
-     return bookmarks
-@@ -232,8 +230,6 @@
-     if not repo.local():
-         return
- 
--    # init a bookmark cache as otherwise we would get a infinite reading
--    # in lookup()
-     repo._bookmarkcurrent = None
- 
-     class bookmark_repo(repo.__class__):

10105.diff

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1261376583 -32400
-# Node ID 449f9a2356777e12a06b07dcdc2536215c687d02
-# Parent  cacf8011e7a496f199a8a7d6c8a44c91693b306b
-bookmarks: write() can simply access repo._bookmarks
-
-diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
---- a/hgext/bookmarks.py
-+++ b/hgext/bookmarks.py
-@@ -49,7 +49,7 @@
-         pass
-     return bookmarks
- 
--def write(repo, refs):
-+def write(repo):
-     '''Write bookmarks
- 
-     Write the given bookmark => hash dictionary to the .hg/bookmarks file
-@@ -58,6 +58,7 @@
-     We also store a backup of the previous state in undo.bookmarks that
-     can be copied back on rollback.
-     '''
-+    refs = repo._bookmarks
-     if os.path.exists(repo.join('bookmarks')):
-         util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
-     if current(repo) not in refs:
-@@ -145,7 +146,7 @@
-         del marks[rename]
-         if current(repo) == rename:
-             setcurrent(repo, mark)
--        write(repo, marks)
-+        write(repo)
-         return
- 
-     if delete:
-@@ -156,7 +157,7 @@
-         if mark == current(repo):
-             setcurrent(repo, None)
-         del marks[mark]
--        write(repo, marks)
-+        write(repo)
-         return
- 
-     if mark != None:
-@@ -174,7 +175,7 @@
-         else:
-             marks[mark] = repo.changectx('.').node()
-             setcurrent(repo, mark)
--        write(repo, marks)
-+        write(repo)
-         return
- 
-     if mark is None:
-@@ -224,7 +225,7 @@
-     if len(update) > 0:
-         for m in update:
-             marks[m] = repo.changectx('.').node()
--        write(repo, marks)
-+        write(repo)
- 
- def reposetup(ui, repo):
-     if not repo.local():
-@@ -272,7 +273,7 @@
-                             marks[mark] = node
-                             update = True
-                 if update:
--                    write(self, marks)
-+                    write(self)
-                 return node
-             finally:
-                 wlock.release()
-@@ -299,7 +300,7 @@
-                         marks[mark] = node
-                         update = True
-             if update:
--                write(self, marks)
-+                write(self)
-             return result
- 
-         def _findtags(self):

10106.diff

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1261371640 -32400
-# Node ID 35575c594a14b6cdd4bd0505947f7a7dd5088857
-# Parent  449f9a2356777e12a06b07dcdc2536215c687d02
-bookmarks: repo._bookmarkcurrent should be a propertycache
-
-replace all current() calls by an attribute access
-
-diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
---- a/hgext/bookmarks.py
-+++ b/hgext/bookmarks.py
-@@ -61,7 +61,7 @@
-     refs = repo._bookmarks
-     if os.path.exists(repo.join('bookmarks')):
-         util.copyfile(repo.join('bookmarks'), repo.join('undo.bookmarks'))
--    if current(repo) not in refs:
-+    if repo._bookmarkcurrent not in refs:
-         setcurrent(repo, None)
-     wlock = repo.wlock()
-     try:
-@@ -79,8 +79,6 @@
-     we are on. This function returns the name of the bookmark. It
-     is stored in .hg/bookmarks.current
-     '''
--    if repo._bookmarkcurrent:
--        return repo._bookmarkcurrent
-     mark = None
-     if os.path.exists(repo.join('bookmarks.current')):
-         file = repo.opener('bookmarks.current')
-@@ -89,7 +87,6 @@
-         if mark == '':
-             mark = None
-         file.close()
--    repo._bookmarkcurrent = mark
-     return mark
- 
- def setcurrent(repo, mark):
-@@ -98,14 +95,15 @@
-     Set the name of the bookmark that we are on (hg update <bookmark>).
-     The name is recorded in .hg/bookmarks.current
-     '''
--    if current(repo) == mark:
-+    current = repo._bookmarkcurrent
-+    if current == mark:
-         return
- 
-     refs = repo._bookmarks
- 
-     # do not update if we do update to a rev equal to the current bookmark
-     if (mark and mark not in refs and
--        current(repo) and refs[current(repo)] == repo.changectx('.').node()):
-+        current and refs[current] == repo.changectx('.').node()):
-         return
-     if mark not in refs:
-         mark = ''
-@@ -144,7 +142,7 @@
-             raise util.Abort(_("new bookmark name required"))
-         marks[mark] = marks[rename]
-         del marks[rename]
--        if current(repo) == rename:
-+        if repo._bookmarkcurrent == rename:
-             setcurrent(repo, mark)
-         write(repo)
-         return
-@@ -154,7 +152,7 @@
-             raise util.Abort(_("bookmark name required"))
-         if mark not in marks:
-             raise util.Abort(_("a bookmark of this name does not exist"))
--        if mark == current(repo):
-+        if mark == repo._bookmarkcurrent:
-             setcurrent(repo, None)
-         del marks[mark]
-         write(repo)
-@@ -186,7 +184,8 @@
-         else:
-             for bmark, n in marks.iteritems():
-                 if ui.configbool('bookmarks', 'track.current'):
--                    prefix = (bmark == current(repo) and n == cur) and '*' or ' '
-+                    current = repo._bookmarkcurrent
-+                    prefix = (bmark == current and n == cur) and '*' or ' '
-                 else:
-                     prefix = (n == cur) and '*' or ' '
- 
-@@ -231,14 +230,16 @@
-     if not repo.local():
-         return
- 
--    repo._bookmarkcurrent = None
--
-     class bookmark_repo(repo.__class__):
- 
-         @util.propertycache
-         def _bookmarks(self):
-             return parse(self)
- 
-+        @util.propertycache
-+        def _bookmarkcurrent(self):
-+            return current(self)
-+
-         def rollback(self):
-             if os.path.exists(self.join('undo.bookmarks')):
-                 util.rename(self.join('undo.bookmarks'), self.join('bookmarks'))
-@@ -263,7 +264,7 @@
-                 marks = self._bookmarks
-                 update = False
-                 if ui.configbool('bookmarks', 'track.current'):
--                    mark = current(self)
-+                    mark = self._bookmarkcurrent
-                     if mark and marks[mark] in parents:
-                         marks[mark] = node
-                         update = True
-@@ -290,7 +291,7 @@
-             marks = self._bookmarks
-             update = False
-             if ui.configbool('bookmarks', 'track.current'):
--                mark = current(self)
-+                mark = self._bookmarkcurrent
-                 if mark and marks[mark] in parents:
-                     marks[mark] = node
-                     update = True

10107.diff

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1261376248 -32400
-# Node ID 1cdeeee6132778aa48ad83fa63c2a4e6e0d0597d
-# Parent  35575c594a14b6cdd4bd0505947f7a7dd5088857
-bookmarks: refactor code responsible for updates of bookmarks
-
-introduce _bookmarksupdate for common parts from commitctx and addchangegroup
-
-diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
---- a/hgext/bookmarks.py
-+++ b/hgext/bookmarks.py
-@@ -250,44 +250,7 @@
-                 key = self._bookmarks[key]
-             return super(bookmark_repo, self).lookup(key)
- 
--        def commitctx(self, ctx, error=False):
--            """Add a revision to the repository and
--            move the bookmark"""
--            wlock = self.wlock() # do both commit and bookmark with lock held
--            try:
--                node  = super(bookmark_repo, self).commitctx(ctx, error)
--                if node is None:
--                    return None
--                parents = self.changelog.parents(node)
--                if parents[1] == nullid:
--                    parents = (parents[0],)
--                marks = self._bookmarks
--                update = False
--                if ui.configbool('bookmarks', 'track.current'):
--                    mark = self._bookmarkcurrent
--                    if mark and marks[mark] in parents:
--                        marks[mark] = node
--                        update = True
--                else:
--                    for mark, n in marks.items():
--                        if n in parents:
--                            marks[mark] = node
--                            update = True
--                if update:
--                    write(self)
--                return node
--            finally:
--                wlock.release()
--
--        def addchangegroup(self, source, srctype, url, emptyok=False):
--            parents = self.dirstate.parents()
--
--            result = super(bookmark_repo, self).addchangegroup(
--                source, srctype, url, emptyok)
--            if result > 1:
--                # We have more heads than before
--                return result
--            node = self.changelog.tip()
-+        def _bookmarksupdate(self, parents, node):
-             marks = self._bookmarks
-             update = False
-             if ui.configbool('bookmarks', 'track.current'):
-@@ -302,6 +265,35 @@
-                         update = True
-             if update:
-                 write(self)
-+
-+        def commitctx(self, ctx, error=False):
-+            """Add a revision to the repository and
-+            move the bookmark"""
-+            wlock = self.wlock() # do both commit and bookmark with lock held
-+            try:
-+                node  = super(bookmark_repo, self).commitctx(ctx, error)
-+                if node is None:
-+                    return None
-+                parents = self.changelog.parents(node)
-+                if parents[1] == nullid:
-+                    parents = (parents[0],)
-+
-+                self._bookmarksupdate(parents, node)
-+                return node
-+            finally:
-+                wlock.release()
-+
-+        def addchangegroup(self, source, srctype, url, emptyok=False):
-+            parents = self.dirstate.parents()
-+
-+            result = super(bookmark_repo, self).addchangegroup(
-+                source, srctype, url, emptyok)
-+            if result > 1:
-+                # We have more heads than before
-+                return result
-+            node = self.changelog.tip()
-+
-+            self._bookmarksupdate(parents, node)
-             return result
- 
-         def _findtags(self):

10108.diff

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1261376588 -32400
-# Node ID b030971ea7222009adf928a56ba2ffc3cd735241
-# Parent  1cdeeee6132778aa48ad83fa63c2a4e6e0d0597d
-bookmarks: move parse() and current() in the property definitions
-
-They are only called once when fetching _bookmarks/_bookmarkcurrent.
-
-diff --git a/hgext/bookmarks.py b/hgext/bookmarks.py
---- a/hgext/bookmarks.py
-+++ b/hgext/bookmarks.py
-@@ -33,22 +33,6 @@
- from mercurial import util, commands, localrepo, repair, extensions
- import os
- 
--def parse(repo):
--    '''Parse .hg/bookmarks file and return a dictionary
--
--    Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values
--    in the .hg/bookmarks file. They are read returned as a dictionary
--    with name => hash values.
--    '''
--    try:
--        bookmarks = {}
--        for line in repo.opener('bookmarks'):
--            sha, refspec = line.strip().split(' ', 1)
--            bookmarks[refspec] = super(bookmark_repo, repo).lookup(sha)
--    except:
--        pass
--    return bookmarks
--
- def write(repo):
-     '''Write bookmarks
- 
-@@ -72,23 +56,6 @@
-     finally:
-         wlock.release()
- 
--def current(repo):
--    '''Get the current bookmark
--
--    If we use gittishsh branches we have a current bookmark that
--    we are on. This function returns the name of the bookmark. It
--    is stored in .hg/bookmarks.current
--    '''
--    mark = None
--    if os.path.exists(repo.join('bookmarks.current')):
--        file = repo.opener('bookmarks.current')
--        # No readline() in posixfile_nt, reading everything is cheap
--        mark = (file.readlines() or [''])[0]
--        if mark == '':
--            mark = None
--        file.close()
--    return mark
--
- def setcurrent(repo, mark):
-     '''Set the name of the bookmark that we are currently on
- 
-@@ -234,11 +201,38 @@
- 
-         @util.propertycache
-         def _bookmarks(self):
--            return parse(self)
-+            '''Parse .hg/bookmarks file and return a dictionary
-+
-+            Bookmarks are stored as {HASH}\\s{NAME}\\n (localtags format) values
-+            in the .hg/bookmarks file. They are read returned as a dictionary
-+            with name => hash values.
-+            '''
-+            try:
-+                bookmarks = {}
-+                for line in repo.opener('bookmarks'):
-+                    sha, refspec = line.strip().split(' ', 1)
-+                    bookmarks[refspec] = super(bookmark_repo, repo).lookup(sha)
-+            except:
-+                pass
-+            return bookmarks
- 
-         @util.propertycache
-         def _bookmarkcurrent(self):
--            return current(self)
-+            '''Get the current bookmark
-+
-+            If we use gittishsh branches we have a current bookmark that
-+            we are on. This function returns the name of the bookmark. It
-+            is stored in .hg/bookmarks.current
-+            '''
-+            mark = None
-+            if os.path.exists(self.join('bookmarks.current')):
-+                file = self.opener('bookmarks.current')
-+                # No readline() in posixfile_nt, reading everything is cheap
-+                mark = (file.readlines() or [''])[0]
-+                if mark == '':
-+                    mark = None
-+                file.close()
-+            return mark
- 
-         def rollback(self):
-             if os.path.exists(self.join('undo.bookmarks')):

loglimit

-# HG changeset patch
-# User Nicolas Dumazet <nicdumz.commits@gmail.com>
-# Date 1260718349 -32400
-cmdutil: loglimit: return None as default value instead of sys.maxint
-
-Semantically, it is better to use None over any other value when there is
-"no value". Using maxint in this context is quite hackish, and is not forward
-compatible.
-
-diff --git a/hgext/graphlog.py b/hgext/graphlog.py
---- a/hgext/graphlog.py
-+++ b/hgext/graphlog.py
-@@ -249,7 +249,8 @@
-     if path: # could be reset in canonpath
-         revdag = graphmod.filerevs(repo, path, start, stop, limit)
-     else:
--        stop = max(stop, start - limit + 1)
-+        if limit is not None:
-+            stop = max(stop, start - limit + 1)
-         revdag = graphmod.revisions(repo, start, stop)
- 
-     displayer = show_changeset(ui, repo, opts, buffered=True)
-@@ -259,7 +260,7 @@
- def graphrevs(repo, nodes, opts):
-     limit = cmdutil.loglimit(opts)
-     nodes.reverse()
--    if limit < sys.maxint:
-+    if limit is not None:
-         nodes = nodes[:limit]
-     return graphmod.nodes(repo, nodes)
- 
-diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
---- a/mercurial/cmdutil.py
-+++ b/mercurial/cmdutil.py
-@@ -95,7 +95,7 @@
-             raise util.Abort(_('limit must be a positive integer'))
-         if limit <= 0: raise util.Abort(_('limit must be positive'))
-     else:
--        limit = sys.maxint
-+        limit = None
-     return limit
- 
- def remoteui(src, opts):
-diff --git a/mercurial/commands.py b/mercurial/commands.py
---- a/mercurial/commands.py
-+++ b/mercurial/commands.py
-@@ -1924,7 +1924,7 @@
-         displayer = cmdutil.show_changeset(ui, other, opts)
-         count = 0
-         for n in o:
--            if count >= limit:
-+            if limit is not None and count >= limit:
-                 break
-             parents = [p for p in other.changelog.parents(n) if p != nullid]
-             if opts.get('no_merges') and len(parents) == 2:
-@@ -2179,7 +2179,7 @@
-     displayer = cmdutil.show_changeset(ui, repo, opts)
-     count = 0
-     for n in o:
--        if count >= limit:
-+        if limit is not None and count >= limit:
-             break
-         parents = [p for p in repo.changelog.parents(n) if p != nullid]
-         if opts.get('no_merges') and len(parents) == 2:
-diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py
---- a/mercurial/graphmod.py
-+++ b/mercurial/graphmod.py
-@@ -17,7 +17,6 @@
- Data depends on type.
- """
- 
--import sys
- from mercurial.node import nullrev
- 
- CHANGESET = 'C'
-@@ -37,7 +36,7 @@
-         yield (cur, CHANGESET, ctx, sorted(parents))
-         cur -= 1
- 
--def filerevs(repo, path, start, stop, limit=sys.maxint):
-+def filerevs(repo, path, start, stop, limit=None):
-     """file cset DAG generator yielding (id, CHANGESET, ctx, [parentids]) tuples
- 
-     This generator function walks through the revision history of a single
 hgweb-map
 fix-clog
 blacklist-improvements
-10103.diff
-10104.diff
-10105.diff
-10106.diff
-10107.diff
-10108.diff
-loglimit
 iterators
 debug
 better-blacklist