[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

How to use txdelta_window?

From: Alexey Neyman <stilor_at_att.net>
Date: Wed, 3 Mar 2010 17:34:02 -0800

Hi all,

I am trying to check for some content changes in the pre-commit script,
and for that I am trying to employ the apply_textdelta method in the
editor. From the comments in the code (e.g. in python bindings), I
understand that the "window handler" callback should be called
repeatedly and the last call would pass None (NULL in C) as the window
pointer.

However that does not seem to be the case. I tried creating the
following editor and invoking it from pre-commit scripts:

  def add_file(self, path, parent_baton, copyfrom_path, copyfrom_revision, file_pool):
    if copyfrom_path is not None:
      sys.stderr.write(("@@ add_file %s (from %s:%d)\n" % (path, copyfrom_path, copyfrom_rev)))
    else:
      sys.stderr.write(("@@ add_file %s\n" % (path)))
    return [ path ]

  def apply_textdelta(self, file_baton, base_checksum):
    sys.stderr.write(("@@ apply_textdelta to %s\n" % (file_baton[0])))
    def winhnd(window, btn=file_baton, rcv=self):
      if window is not None:
        sys.stderr.write(("@@ delta_window on %s - not null\n" % (btn[0])))
      else:
        sys.stderr.write(("@@ delta_window on %s - null\n" % (btn[0])))
    return winhnd

  def open_file(self, path, parent_baton, base_revision, file_pool):
    sys.stderr.write(("@@ open_file %s\n" % (path)))
    return [ path ]

  def close_file(self, file_baton, text_checksum):
    sys.stderr.write(("@@ close_file %s\n" % (file_baton[0])))
    return

With that script, I get the output as below:

@@ open_file foo/bar1
@@ apply_textdelta to foo/bar1
@@ delta_window on foo/bar1 - null
@@ close_file foo/bar1
@@ open_file foo/bar2
@@ apply_textdelta to foo/bar2
@@ delta_window on foo/bar2 - null
@@ close_file foo/bar2

That is, the "window handler" is always called with None object as
the text delta. Am I doing something wrong? Could the change content
be accessed from the pre-commit script?

Regards,
Alexey.
Received on 2010-03-04 02:34:37 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.