Rev 1086: Merge property changes from 0.4. in file:///data/jelmer/bzr-svn/cext/

Jelmer Vernooij jelmer at samba.org
Thu Jun 5 18:34:38 BST 2008


At file:///data/jelmer/bzr-svn/cext/

------------------------------------------------------------
revno: 1086
revision-id: jelmer at samba.org-20080605173437-aj6yq3ruicymv351
parent: jelmer at samba.org-20080605170557-o621fr0vw6rvjhzb
parent: jelmer at samba.org-20080605172628-h99zhrgfr7tggflq
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: cext
timestamp: Thu 2008-06-05 19:34:37 +0200
message:
  Merge property changes from 0.4.
renamed:
  util.py => properties.py util.py-20080502170127-o220e9py99vt69s6-1
modified:
  commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
  config.py                      config.py-20070624185721-0j8f1ly75uo4s1lk-1
  constants.py                   constants.py-20080313210342-fuq3eruf2102bwml-1
  fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
  mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
  mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
  mapping3/scheme.py             scheme.py-20060516195850-95181aae6b272f9e
  transport.py                   transport.py-20060406231150-b3472d06b3a0818d
  tree.py                        tree.py-20060624222557-dudlwqcmkf22lt2s-1
  workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
  properties.py                  util.py-20080502170127-o220e9py99vt69s6-1
    ------------------------------------------------------------
    revno: 950.3.152
    revision-id: jelmer at samba.org-20080605172628-h99zhrgfr7tggflq
    parent: jelmer at samba.org-20080605164448-bcu17il5q8ouqvx3
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: 0.4
    timestamp: Thu 2008-06-05 19:26:28 +0200
    message:
      Move property definitions to a separate file.
    renamed:
      util.py => properties.py util.py-20080502170127-o220e9py99vt69s6-1
    modified:
      commit.py                      commit.py-20060607190346-qvq128wgfubhhgm2-1
      config.py                      config.py-20070624185721-0j8f1ly75uo4s1lk-1
      fetch.py                       fetch.py-20060625004942-x2lfaib8ra707a8p-1
      mapping.py                     mapping.py-20080128201303-6cp01phc0dmc0kiv-1
      mapping3/__init__.py           __init__.py-20080502174630-9324zh25kka98vlw-1
      mapping3/scheme.py             scheme.py-20060516195850-95181aae6b272f9e
      transport.py                   transport.py-20060406231150-b3472d06b3a0818d
      tree.py                        tree.py-20060624222557-dudlwqcmkf22lt2s-1
      workingtree.py                 workingtree.py-20060306120941-b083cb0fdd4a69de
      properties.py                  util.py-20080502170127-o220e9py99vt69s6-1
=== modified file 'commit.py'
--- a/commit.py	2008-06-05 17:05:57 +0000
+++ b/commit.py	2008-06-05 17:34:37 +0000
@@ -28,7 +28,7 @@
 from bzrlib.revision import NULL_REVISION
 from bzrlib.trace import mutter, warning
 
-from bzrlib.plugins.svn import util
+from bzrlib.plugins.svn import properties
 
 from cStringIO import StringIO
 
@@ -280,18 +280,18 @@
             if child_editor is not None:
                 if old_executable != child_ie.executable:
                     if child_ie.executable:
-                        value = constants.PROP_EXECUTABLE_VALUE
+                        value = properties.PROP_EXECUTABLE_VALUE
                     else:
                         value = None
-                    child_editor.change_prop(constants.PROP_EXECUTABLE, value)
+                    child_editor.change_prop(properties.PROP_EXECUTABLE, value)
 
                 if old_special != (child_ie.kind == 'symlink'):
                     if child_ie.kind == 'symlink':
-                        value = constants.PROP_SPECIAL_VALUE
+                        value = properties.PROP_SPECIAL_VALUE
                     else:
                         value = None
 
-                    child_editor.change_prop(constants.PROP_SPECIAL, value)
+                    child_editor.change_prop(properties.PROP_SPECIAL, value)
 
             # handle the file
             if child_ie.file_id in self.modified_files:
@@ -445,13 +445,13 @@
         if self._config.get_log_strip_trailing_newline():
             self.base_mapping.export_message(message, self._svn_revprops, self._svnprops)
             message = message.rstrip("\n")
-        self._svn_revprops[constants.PROP_REVISION_LOG] = message.encode("utf-8")
+        self._svn_revprops[properties.PROP_REVISION_LOG] = message.encode("utf-8")
 
         try:
             existing_bp_parts = _check_dirs_exist(self.repository.transport, 
                                               bp_parts, -1)
             for prop in self._svn_revprops:
-                if not util.is_valid_property_name(prop):
+                if not properties.is_valid_property_name(prop):
                     warning("Setting property %r with invalid characters in name" % prop)
             conn = self.repository.transport.get_connection()
             try:
@@ -464,9 +464,9 @@
                         raise
                     # Try without bzr: revprops
                     self.editor = conn.get_commit_editor({
-                        constants.PROP_REVISION_LOG: self._svn_revprops[constants.PROP_REVISION_LOG]},
+                        properties.PROP_REVISION_LOG: self._svn_revprops[properties.PROP_REVISION_LOG]},
                         done, None, False)
-                    del self._svn_revprops[constants.PROP_REVISION_LOG]
+                    del self._svn_revprops[properties.PROP_REVISION_LOG]
 
                 root = self.editor.open_root(self.base_revnum)
 
@@ -523,10 +523,10 @@
         override_svn_revprops = self._config.get_override_svn_revprops()
         if override_svn_revprops is not None:
             new_revprops = {}
-            if constants.PROP_REVISION_AUTHOR in override_svn_revprops:
-                new_revprops[constants.PROP_REVISION_AUTHOR] = self._committer.encode("utf-8")
-            if constants.PROP_REVISION_DATE in override_svn_revprops:
-                new_revprops[constants.PROP_REVISION_DATE] = time_to_cstring(1000000*self._timestamp)
+            if properties.PROP_REVISION_AUTHOR in override_svn_revprops:
+                new_revprops[properties.PROP_REVISION_AUTHOR] = self._committer.encode("utf-8")
+            if properties.PROP_REVISION_DATE in override_svn_revprops:
+                new_revprops[properties.PROP_REVISION_DATE] = time_to_cstring(1000000*self._timestamp)
             set_svn_revprops(self.repository.transport, self.revision_metadata.revision, new_revprops)
 
         try:

=== modified file 'config.py'
--- a/config.py	2008-06-05 17:05:57 +0000
+++ b/config.py	2008-06-05 17:34:37 +0000
@@ -22,6 +22,8 @@
 
 import os
 
+from bzrlib.plugins.svn import properties
+
 # Settings are stored by UUID. 
 # Data stored includes default branching scheme and locations the repository 
 # was seen at.
@@ -120,7 +122,7 @@
         def get_list(parser, section):
             try:
                 if parser.get_bool(section, "override-svn-revprops"):
-                    return [constants.PROP_REVISION_DATE, constants.PROP_REVISION_AUTHOR]
+                    return [properties.PROP_REVISION_DATE, properties.PROP_REVISION_AUTHOR]
                 return []
             except ValueError:
                 val = parser.get_value(section, "override-svn-revprops")

=== modified file 'constants.py'
--- a/constants.py	2008-05-31 04:01:48 +0000
+++ b/constants.py	2008-06-05 17:34:37 +0000
@@ -43,25 +43,3 @@
 AUTH_SSL_CNMISMATCH  = 0x00000004
 AUTH_SSL_UNKNOWNCA   = 0x00000008
 AUTH_SSL_OTHER       = 0x40000000
-
-PROP_EXECUTABLE = 'svn:executable'
-PROP_EXECUTABLE_VALUE = '*'
-PROP_EXTERNALS = 'svn:externals'
-PROP_IGNORE = 'svn:ignore'
-PROP_KEYWORDS = 'svn:keywords'
-PROP_MIME_TYPE = 'svn:mime-type'
-PROP_NEEDS_LOCK = 'svn:needs-lock'
-PROP_NEEDS_LOCK_VALUE = '*'
-PROP_PREFIX = 'svn:'
-PROP_SPECIAL = 'svn:special'
-PROP_SPECIAL_VALUE = '*'
-PROP_WC_PREFIX = 'svn:wc:'
-PROP_ENTRY_COMMITTED_DATE = 'svn:entry:committed-date'
-PROP_ENTRY_COMMITTED_REV = 'svn:entry:committed-rev'
-PROP_ENTRY_LAST_AUTHOR = 'svn:entry:last-author'
-PROP_ENTRY_LOCK_TOKEN = 'svn:entry:lock-token'
-PROP_ENTRY_UUID = 'svn:entry:uuid'
-
-PROP_REVISION_LOG = "svn:log"
-PROP_REVISION_AUTHOR = "svn:author"
-PROP_REVISION_DATE = "svn:date"

=== modified file 'fetch.py'
--- a/fetch.py	2008-06-04 18:56:53 +0000
+++ b/fetch.py	2008-06-05 17:34:37 +0000
@@ -28,6 +28,7 @@
 import constants
 
 from bzrlib.plugins.svn.delta import apply_txdelta_handler
+from bzrlib.plugins.svn import properties
 from bzrlib.plugins.svn.errors import InvalidFileName
 from bzrlib.plugins.svn.logwalker import lazy_dict
 from bzrlib.plugins.svn.mapping import (SVN_PROP_BZR_MERGE, 
@@ -281,16 +282,16 @@
                 self.editor.revmeta.fileprops = {}
             self.editor.revmeta.fileprops[name] = value
 
-        if name in (constants.PROP_ENTRY_COMMITTED_DATE,
-                    constants.PROP_ENTRY_COMMITTED_REV,
-                    constants.PROP_ENTRY_LAST_AUTHOR,
-                    constants.PROP_ENTRY_LOCK_TOKEN,
-                    constants.PROP_ENTRY_UUID,
-                    constants.PROP_EXECUTABLE):
-            pass
-        elif (name.startswith(constants.PROP_WC_PREFIX)):
-            pass
-        elif name.startswith(constants.PROP_PREFIX):
+        if name in (properties.PROP_ENTRY_COMMITTED_DATE,
+                    properties.PROP_ENTRY_COMMITTED_REV,
+                    properties.PROP_ENTRY_LAST_AUTHOR,
+                    properties.PROP_ENTRY_LOCK_TOKEN,
+                    properties.PROP_ENTRY_UUID,
+                    properties.PROP_EXECUTABLE):
+            pass
+        elif (name.startswith(properties.PROP_WC_PREFIX)):
+            pass
+        elif name.startswith(properties.PROP_PREFIX):
             mutter('unsupported dir property %r' % name)
 
     def add_file(self, path, copyfrom_path=None, copyfrom_revnum=-1):
@@ -368,21 +369,21 @@
             # how SVN behaves. It appears to consider the presence 
             # of the property sufficient to mark it executable.
             self.is_executable = (value != None)
-        elif (name == constants.PROP_SPECIAL):
+        elif (name == properties.PROP_SPECIAL):
             self.is_symlink = (value != None)
-        elif name == constants.PROP_ENTRY_COMMITTED_REV:
+        elif name == properties.PROP_ENTRY_COMMITTED_REV:
             self.last_file_rev = int(value)
-        elif name in (constants.PROP_ENTRY_COMMITTED_DATE,
-                      constants.PROP_ENTRY_LAST_AUTHOR,
-                      constants.PROP_ENTRY_LOCK_TOKEN,
-                      constants.PROP_ENTRY_UUID,
-                      constants.PROP_MIME_TYPE):
-            pass
-        elif name.startswith(constants.PROP_WC_PREFIX):
-            pass
-        elif name == constants.PROP_EXTERNALS:
+        elif name in (properties.PROP_ENTRY_COMMITTED_DATE,
+                      properties.PROP_ENTRY_LAST_AUTHOR,
+                      properties.PROP_ENTRY_LOCK_TOKEN,
+                      properties.PROP_ENTRY_UUID,
+                      properties.PROP_MIME_TYPE):
+            pass
+        elif name.startswith(properties.PROP_WC_PREFIX):
+            pass
+        elif name == properties.PROP_EXTERNALS:
             mutter('svn:externals property on file!')
-        elif (name.startswith(constants.PROP_PREFIX) or
+        elif (name.startswith(properties.PROP_PREFIX) or
               name.startswith(SVN_PROP_BZR_PREFIX)):
             mutter('unsupported file property %r' % name)
 

=== modified file 'mapping.py'
--- a/mapping.py	2008-06-05 11:17:13 +0000
+++ b/mapping.py	2008-06-05 17:34:37 +0000
@@ -19,7 +19,7 @@
 from bzrlib.errors import InvalidRevisionId
 from bzrlib.trace import mutter
 
-from bzrlib.plugins.svn import core, constants, version_info, constants, errors
+from bzrlib.plugins.svn import core, constants, version_info, constants, errors, properties
 import calendar
 import sha
 import time
@@ -137,12 +137,12 @@
     return tuple(filter(lambda x: x != "", line.split("\t")))
 
 def parse_svn_revprops(svn_revprops, rev):
-    if svn_revprops.has_key(constants.PROP_REVISION_AUTHOR):
-        rev.committer = svn_revprops[constants.PROP_REVISION_AUTHOR]
+    if svn_revprops.has_key(properties.PROP_REVISION_AUTHOR):
+        rev.committer = svn_revprops[properties.PROP_REVISION_AUTHOR]
     else:
         rev.committer = ""
-
-    rev.message = svn_revprops.get(constants.PROP_REVISION_LOG)
+    
+    rev.message = svn_revprops.get(properties.PROP_REVISION_LOG)
 
     if rev.message:
         try:
@@ -150,8 +150,8 @@
         except UnicodeDecodeError:
             pass
 
-    if svn_revprops.has_key(constants.PROP_REVISION_DATE):
-        rev.timestamp = core.time_from_cstring(svn_revprops[constants.PROP_REVISION_DATE]) / 1000000.0
+    if svn_revprops.has_key(properties.PROP_REVISION_DATE):
+        rev.timestamp = core.time_from_cstring(svn_revprops[properties.PROP_REVISION_DATE]) / 1000000.0
     else:
         rev.timestamp = 0.0 # FIXME: Obtain repository creation time
     rev.timezone = None

=== modified file 'mapping3/__init__.py'
--- a/mapping3/__init__.py	2008-06-04 18:56:53 +0000
+++ b/mapping3/__init__.py	2008-06-05 17:34:37 +0000
@@ -16,7 +16,7 @@
 from bzrlib import osutils, ui
 from bzrlib.errors import InvalidRevisionId
 from bzrlib.trace import mutter
-from bzrlib.plugins.svn import core, constants, mapping
+from bzrlib.plugins.svn import core, constants, mapping, properties
 from bzrlib.plugins.svn.layout import RepositoryLayout
 from bzrlib.plugins.svn.mapping3.scheme import (BranchingScheme, guess_scheme_from_branch_path, 
                              guess_scheme_from_history, ListBranchingScheme, 
@@ -121,7 +121,7 @@
     def done(revmetadata, pool):
         pass
     editor = repository.transport.get_commit_editor(
-            {constants.PROP_REVISION_LOG: "Updating branching scheme for Bazaar."},
+            {properties.PROP_REVISION_LOG: "Updating branching scheme for Bazaar."},
             done, None, False)
     root = editor.open_root(-1)
     editor.change_dir_prop(root, SVN_PROP_BZR_BRANCHING_SCHEME, 

=== modified file 'mapping3/scheme.py'
--- a/mapping3/scheme.py	2008-06-04 15:47:00 +0000
+++ b/mapping3/scheme.py	2008-06-05 17:26:28 +0000
@@ -23,7 +23,7 @@
 
 from base64 import urlsafe_b64decode, urlsafe_b64encode
 from bzrlib.plugins.svn.errors import InvalidSvnBranchPath
-from bzrlib.plugins.svn import util
+from bzrlib.plugins.svn import properties
 import bz2
 import urllib
 
@@ -338,7 +338,7 @@
                 path[len(self.path):].strip("/"))
 
     def __str__(self):
-        if util.is_valid_property_name(self.path):
+        if properties.is_valid_property_name(self.path):
             return "single-%s" % self.path
         else:
             return "single1-%s" % prop_name_quote(self.path)

=== renamed file 'util.py' => 'properties.py'
--- a/util.py	2008-05-02 17:05:05 +0000
+++ b/properties.py	2008-06-05 17:26:28 +0000
@@ -20,3 +20,25 @@
         if not c.isalnum() and not c in "-:._":
             return False
     return True
+
+PROP_EXECUTABLE = 'svn:executable'
+PROP_EXECUTABLE_VALUE = '*'
+PROP_EXTERNALS = 'svn:externals'
+PROP_IGNORE = 'svn:ignore'
+PROP_KEYWORDS = 'svn:keywords'
+PROP_MIME_TYPE = 'svn:mime-type'
+PROP_NEEDS_LOCK = 'svn:needs-lock'
+PROP_NEEDS_LOCK_VALUE = '*'
+PROP_PREFIX = 'svn:'
+PROP_SPECIAL = 'svn:special'
+PROP_SPECIAL_VALUE = '*'
+PROP_WC_PREFIX = 'svn:wc:'
+PROP_ENTRY_COMMITTED_DATE = 'svn:entry:committed-date'
+PROP_ENTRY_COMMITTED_REV = 'svn:entry:committed-rev'
+PROP_ENTRY_LAST_AUTHOR = 'svn:entry:last-author'
+PROP_ENTRY_LOCK_TOKEN = 'svn:entry:lock-token'
+PROP_ENTRY_UUID = 'svn:entry:uuid'
+
+PROP_REVISION_LOG = "svn:log"
+PROP_REVISION_AUTHOR = "svn:author"
+PROP_REVISION_DATE = "svn:date"

=== modified file 'transport.py'
--- a/transport.py	2008-06-04 23:03:52 +0000
+++ b/transport.py	2008-06-05 17:34:37 +0000
@@ -27,6 +27,7 @@
 import core
 import constants
 
+from bzrlib.plugins.svn import properties
 from bzrlib.plugins.svn.errors import convert_svn_error, NoSvnRepositoryPresent
 import urlparse
 import urllib

=== modified file 'tree.py'
--- a/tree.py	2008-06-05 11:17:13 +0000
+++ b/tree.py	2008-06-05 17:34:37 +0000
@@ -29,7 +29,7 @@
 import urllib
 
 from bzrlib.plugins.svn.delta import apply_txdelta_handler
-from bzrlib.plugins.svn import core, constants, errors, wc
+from bzrlib.plugins.svn import core, constants, errors, wc, properties
 
 def parse_externals_description(base_url, val):
     """Parse an svn:externals property value.
@@ -157,17 +157,17 @@
         return DirectoryTreeEditor(self.tree, file_id)
 
     def change_prop(self, name, value):
-        if name in (constants.PROP_ENTRY_COMMITTED_DATE,
-                      constants.PROP_ENTRY_COMMITTED_REV,
-                      constants.PROP_ENTRY_LAST_AUTHOR,
-                      constants.PROP_ENTRY_LOCK_TOKEN,
-                      constants.PROP_ENTRY_UUID,
-                      constants.PROP_EXECUTABLE,
-                      constants.PROP_IGNORE):
-            pass
-        elif name.startswith(constants.PROP_WC_PREFIX):
-            pass
-        elif name.startswith(constants.PROP_PREFIX):
+        if name in (properties.PROP_ENTRY_COMMITTED_DATE,
+                      properties.PROP_ENTRY_COMMITTED_REV,
+                      properties.PROP_ENTRY_LAST_AUTHOR,
+                      properties.PROP_ENTRY_LOCK_TOKEN,
+                      properties.PROP_ENTRY_UUID,
+                      properties.PROP_EXECUTABLE,
+                      properties.PROP_IGNORE):
+            pass
+        elif name.startswith(properties.PROP_WC_PREFIX):
+            pass
+        elif name.startswith(properties.PROP_PREFIX):
             mutter('unsupported dir property %r' % name)
 
     def add_file(self, path, copyfrom_path=None, copyfrom_revnum=-1):
@@ -189,23 +189,23 @@
     def change_prop(self, name, value):
         from mapping import SVN_PROP_BZR_PREFIX
 
-        if name == constants.PROP_EXECUTABLE:
+        if name == properties.PROP_EXECUTABLE:
             self.is_executable = (value != None)
-        elif name == constants.PROP_SPECIAL:
+        elif name == properties.PROP_SPECIAL:
             self.is_symlink = (value != None)
-        elif name == constants.PROP_EXTERNALS:
+        elif name == properties.PROP_EXTERNALS:
             mutter('%r property on file!' % name)
-        elif name == constants.PROP_ENTRY_COMMITTED_REV:
+        elif name == properties.PROP_ENTRY_COMMITTED_REV:
             self.last_file_rev = int(value)
-        elif name in (constants.PROP_ENTRY_COMMITTED_DATE,
-                      constants.PROP_ENTRY_LAST_AUTHOR,
-                      constants.PROP_ENTRY_LOCK_TOKEN,
-                      constants.PROP_ENTRY_UUID,
-                      constants.PROP_MIME_TYPE):
-            pass
-        elif name.startswith(constants.PROP_WC_PREFIX):
-            pass
-        elif name.startswith(constants.SVN_PROP_PREFIX):
+        elif name in (properties.PROP_ENTRY_COMMITTED_DATE,
+                      properties.PROP_ENTRY_LAST_AUTHOR,
+                      properties.PROP_ENTRY_LOCK_TOKEN,
+                      properties.PROP_ENTRY_UUID,
+                      properties.PROP_MIME_TYPE):
+            pass
+        elif name.startswith(properties.PROP_WC_PREFIX):
+            pass
+        elif name.startswith(properties.SVN_PROP_PREFIX):
             mutter('unsupported file property %r' % name)
 
     def close(self, checksum=None):
@@ -260,7 +260,7 @@
 
         def add_file_to_inv(relpath, id, revid, adm):
             (delta_props, props) = adm.get_prop_diffs(self.workingtree.abspath(relpath))
-            if props.has_key(constants.PROP_SPECIAL):
+            if props.has_key(properties.PROP_SPECIAL):
                 ie = self._inventory.add_path(relpath, 'symlink', id)
                 ie.symlink_target = open(self._abspath(relpath)).read()[len("link "):]
                 ie.text_sha1 = None
@@ -272,7 +272,7 @@
                 data = osutils.fingerprint_file(open(self._abspath(relpath)))
                 ie.text_sha1 = data['sha1']
                 ie.text_size = data['size']
-                ie.executable = props.has_key(constants.PROP_EXECUTABLE)
+                ie.executable = props.has_key(properties.PROP_EXECUTABLE)
             ie.revision = revid
             return ie
 

=== modified file 'workingtree.py'
--- a/workingtree.py	2008-06-05 14:48:23 +0000
+++ b/workingtree.py	2008-06-05 17:34:37 +0000
@@ -31,7 +31,7 @@
 from bzrlib.transport.local import LocalTransport
 from bzrlib.workingtree import WorkingTree, WorkingTreeFormat
 
-from bzrlib.plugins.svn import constants
+from bzrlib.plugins.svn import constants, properties
 from bzrlib.plugins.svn.branch import SvnBranch
 from bzrlib.plugins.svn.commit import _revision_id_to_svk_feature
 from bzrlib.plugins.svn.convert import SvnConverter
@@ -101,7 +101,7 @@
         ignore_globs.update(ignores.get_user_ignores())
 
         def dir_add(adm, prefix, patprefix):
-            ignorestr = adm.prop_get(constants.PROP_IGNORE, 
+            ignorestr = adm.prop_get(properties.PROP_IGNORE, 
                                     self.abspath(prefix).rstrip("/"))
             if ignorestr is not None:
                 for pat in ignorestr.splitlines():




More information about the bazaar-commits mailing list