def _get_prop_diff(self, path):
    """Get property changes as a GNU-style diff."""
    try:
      root_props = fs.node_proplist(self.root, path)
    except:
      root_props = []

    try:
      base_props = fs.node_proplist(self.base_root, path)
    except:
      base_props = []

    file_props = list(itertools.chain(base_props, root_props))
    diff_content = ''

    file_props.sort()

    for prop_name in file_props:
      try:
        old_prop_val = fs.node_prop(self.base_root, path, prop_name)
      except core.SubversionException:
        old_prop_val = None
        pass # Must be a new path

      try:
        new_prop_val = fs.node_prop(self.root, path, prop_name)
      except core.SubversionException:
        new_prop_val = None
        pass # Must be a deleted path

      if not old_prop_val == new_prop_val:
        diff = StringIO.StringIO()

        diff.write("Property changes on: %s\n" % path)
        diff.write("_______________________________________________________" + \
                   "_______________________\n")

        if old_prop_val:
          if new_prop_val:
            diff.write("Modified: %s\n" % prop_name)
            diff.write("   - %s\n" % str(old_prop_val))
            diff.write("   + %s\n" % str(new_prop_val))
          else:
            diff.write("Deleted: %s\n" % prop_name)
            diff.write("   - %s\n" % str(old_prop_val))
        else:
          diff.write("Added: %s\n" % prop_name)
          diff.write("   + %s\n" % str(new_prop_val))

        diff.write("\n")

        diff_content = diff_content + diff.getvalue()

        diff.close()

    return diff_content
Пример #2
0
    def _do_prop_diff(self, path, prop_name, prop_val, pool):
        print("Property changes on: " + path)
        print("_______________________________________________________________" + \
              "_______________")

        old_prop_val = None

        try:
            old_prop_val = fs.node_prop(self.base_root, path, prop_name, pool)
        except core.SubversionException:
            pass  # Must be a new path

        if old_prop_val:
            if prop_val:
                print("Modified: " + prop_name)
                print("   - " + str(old_prop_val))
                print("   + " + str(prop_val))
            else:
                print("Deleted: " + prop_name)
                print("   - " + str(old_prop_val))
        else:
            print("Added: " + prop_name)
            print("   + " + str(prop_val))

        print("")
Пример #3
0
  def _do_prop_diff(self, path, prop_name, prop_val, pool):
    print("Property changes on: " + path)
    print("_______________________________________________________________" + \
          "_______________")

    old_prop_val = None

    try:
      old_prop_val = fs.node_prop(self.base_root, path, prop_name, pool)
    except core.SubversionException:
      pass # Must be a new path

    if old_prop_val:
      if prop_val:
        print("Modified: " + prop_name)
        print("   - " + str(old_prop_val))
        print("   + " + str(prop_val))
      else:
        print("Deleted: " + prop_name)
        print("   - " + str(old_prop_val))
    else:
      print("Added: " + prop_name)
      print("   + " + str(prop_val))

    print("")
Пример #4
0
 def _get_prop(self, name):
     return fs.node_prop(self.root, self._scoped_path_utf8, name,
                         self.pool())
Пример #5
0
 def _get_prop(self, name):
     return fs.node_prop(self.root, self.scoped_path, name)
Пример #6
0
Файл: svn_fs.py Проект: t2y/trac
 def _get_prop(self, name):
     return fs.node_prop(self.root, self._scoped_path_utf8, name,
                         self.pool())

native = locale.getlocale()[1]
if not native: native = 'ascii'
repos_handle = repos.open(sys.argv[1].decode(native).encode('utf-8'))
fs_handle = repos.fs(repos_handle)
txn_handle = fs.open_txn(fs_handle, sys.argv[2].decode(native).encode('utf-8'))
txn_root = fs.txn_root(txn_handle)
rev_root = fs.revision_root(fs_handle, fs.txn_root_base_revision(txn_root))

for path, change in fs.paths_changed2(txn_root).iteritems():

    if change.prop_mod:

        # The new value, if any
        txn_prop = fs.node_prop(txn_root, path, "svn:externals")
        if not txn_prop:
            continue

        # The old value, if any
        rev_prop = None
        if change.change_kind == fs.path_change_modify:
            rev_prop = fs.node_prop(rev_root, path, "svn:externals")
        elif change.change_kind == fs.path_change_add and change.copyfrom_path:
            copy_root = fs.revision_root(fs_handle, change.copyfrom_rev)
            rev_prop = fs.node_prop(copy_root, change.copyfrom_path,
                                    "svn:externals")

        if txn_prop != rev_prop:
            error_path = path.decode('utf-8').encode(native, 'replace')
            externals = []
Пример #8
0
 def _get_prop(self, name):
     return fs.node_prop(self.root, self.scoped_path, name)
    return False

native = locale.getlocale()[1]
if not native: native = 'ascii'
repos_handle = repos.open(sys.argv[1].decode(native).encode('utf-8'))
fs_handle = repos.fs(repos_handle)
txn_handle = fs.open_txn(fs_handle, sys.argv[2].decode(native).encode('utf-8'))
txn_root = fs.txn_root(txn_handle)
rev_root = fs.revision_root(fs_handle, fs.txn_root_base_revision(txn_root))

for path, change in fs.paths_changed2(txn_root).iteritems():

    if change.prop_mod:

        # The new value, if any
        txn_prop = fs.node_prop(txn_root, path, "svn:externals")
        if not txn_prop:
            continue

        # The old value, if any
        rev_prop = None
        if change.change_kind == fs.path_change_modify:
            rev_prop = fs.node_prop(rev_root, path, "svn:externals")
        elif change.change_kind == fs.path_change_add and change.copyfrom_path:
            copy_root = fs.revision_root(fs_handle, change.copyfrom_rev)
            rev_prop = fs.node_prop(copy_root, change.copyfrom_path,
                                    "svn:externals")

        if txn_prop != rev_prop:
            error_path = path.decode('utf-8').encode(native, 'replace')
            externals = []