P4Python Changelog

What's new in P4Python 2013.1

Aug 5, 2013
  • Bugs fixed:
  • When using Python 3.X P4Python created a memory leak for every call. This has now been fixed. Note that the fix requires upgrading to Python 3.3. All previous version of Python 3.X are not supported and P4Python 2013.1 will not compile with these releases.
  • Reformatted P4.py to use spaces instead of tabs, following the Python coding standard.
  • New functionality:
  • P4Python is now compatible with Python 3.3 and will complete all test cases.
  • Comments in forms are now preserved in the spec object when using P4.parse_spec. The comment can be accessed and changed through the P4.Spec.comment attribute. Comments are used by the P4.format_spec methods such as P4.format_client(). This is useful for form-out triggers.
  • When decoding strings in Python 3 from a non-Unicode Perforce server, P4Python normally assumes that all strings are encoded in UTF8. P4.encoding can be set to a legal Python encoding to change the decoding of any content from the Perforce Server. If P4.encoding is set, any decoding error will cause an exception to be thrown.
  • The special encoding 'raw' can be used to receive Python bytes instead of Unicode strings. P4.encoding is only available when compiled with Python 3.
  • Bugs fixed:
  • In Python 3 it was impossible to reset the charset to None or ''. This is now fixed.

New in P4Python 2012.2 (Aug 5, 2013)

  • New functionality:
  • P4Python now supports Apple Mountain Lion (10.8).
  • P4.run_print() would return None for a non-existing file. Now it returns [] for consistency.
  • Added P4.run_tickets() method to list local tickets. Note that P4.run('tickets') still gives the old error message "Must upgrade to 2004.2 p4 to access tickets."
  • Support for the new progress indicator API. P4Python supplies a new progress attribute, which can take an instance of P4.Progress class or subclass. Progress information is currently only supported for submits ansync -q. Details can be found in the documentation.
  • New convenience method P4.iterate_() that allows easy iteration through some or all spec objects such as clients or changes. Details can be found in the documentation.
  • Bugs fixed:
  • Fixed a bug where P4Python would leak memory when calling an OutputHandler, and would leak more memory if the OutputHandler returned HANDLED.
  • P4#parse_client could raise the exception "Unknown field name 'StreamAtChange'." when parsing a stream client workspace. Internal spec definition has been updated to resolve this.

New in P4Python 2012.1 (Aug 5, 2013)

  • New functionality:
  • Enable "action resolve" to support resolves of branches, deletes and file types. The existing P4.Resolver class has been extended with a new method actionResolve() that will be invoked if an "action resolve" is required. Details can be found in the documentation.
  • P4Python supports SSL connections if compiled with SSL support. Instructions on how to compile with SSL support can be found at the top of this document under "Building P4Python from Source" and in the documentation.
  • P4.identify() will then report the version of the OpenSSL library used for building the Perforce C++ API (not the version P4Python is linked against).
  • Bugs fixed:
  • Fixed a bug where P4Python would increment the reference count of an OutputHandler each time run was called.
  • Fixed a test hardness due an incompatibility with Python 2.6
  • A fatal server error would leave P4Python in an undefined state which would result in incorrect output for successive commands. P4Python will now disconnect and clean up when encountering a fatal error.
  • Python would crash with a segmentation fault if a custom Resolver object was used to resolve binary files. Fixed.

New in P4Python 2011.1 (Aug 5, 2013)

  • New functionality:
  • Enable streams in P4Python by default. With this change, streams specific specs such as streams depots are listed. Disable the listing of streams specific specs by either setting the api_level to a value below 70 or by disabling stream handling explicitly through the P4.streams attribute: p4.streams = False
  • All run methods now support keyword arguments in order to disable 'tagged' mode or to provide an OutputHandler for a single command only without having to wrap the command in a 'with' block:
  • p4.run_counter('mycounter', tagged = False)
  • p4.run_files('//...', handler = MyOutputHandler() )
  • More than one keyword argument can be provided if required. All attributes that can be changed for an active connection can be provided as keyword arguments.
  • P4Python supports a callback interface by providing a P4.handler attribute. Set P4.handler to an instance of a subclass of P4.OutputHandler to enable callbacks. When a handler is defined, P4Python will invoke the handler for every response it receives from the Perforce Server immediately instead of collecting all results together in an array first. This can be used to make applications more scalable and more responsive if large results are expected.
  • See the documentation for details on the OutputHandler class.
  • P4Python now allows setting P4 registry values on Windows and Mac OS. P4.set_env(name, value) sets an entry and P4.set_env(name) deletes the entry. This is equivalent to running 'p4 set name=value' from the command line.
  • Bugs fixed:
  • On Windows Vista, Windows 7, or Windows 2008, a client running as Administrator would fail to properly process file names in non-ASCII character sets (such as Shift-JIS).
  • Prevent users from assigning non-string values to spec objects such as labels or client workspaces. Assigning values other than strings could crash P4Python.
  • Updated the stored spec templates for user, client and change and added streams. These are required, for example, for form-triggers that do not connect to the server first.
  • Under some circumstances P4Python would try to raise a P4Error, which has been renamed to P4Exception.
  • This is now fixed.
  • P4.identify() reports the platform on Mac OS as DARWIN in line with all other Perforce products.
  • P4.identify() now reports P4Python as P4PYTHON in line with all other Perforce products.
  • P4.Map.reverse would return a P4API.P4Map object. It now returns an instance of P4.Map instead.
  • P4.run_filelog() would throw an exception for rare circumstances where no digest is defined for for a deleted revision that was later readed. This is now fixed.
  • Info messages were not shown when an exception was thrown. This is because all messages of type info get silently swallowed. They will still not show in the output with this change, but they will be logged in the P4.message list. Info messages like this will be forwarded to the OutputHandler if present.

New in P4Python 2010.2 (Aug 5, 2013)

  • New functionality:
  • P4Python now comes in a Perforce standardized directory structure: p4python-..[-BETA]. Source and binary distributions created via 'python setup.py' will follow this naming scheme.
  • Python 3.1 is now fully supported. It also has full support for Unicode-enabled Perforce Servers. This also means that P4.charset can be set to multibyte charsets such as UTF16.
  • Errors and warnings are now instances of P4Message. This object has the additional methods generic(), severity() and (unique) msgid(), which makes parsing of error messages easier. P4.warnings and P4.errors still return the errors and warnings as strings for backwards compatibility.
  • Added new SetTrack() and GetTrack() methods. For more details about server performance tracking see: http://kb.perforce.com/article/883
  • Bugs fixed:
  • The connect() context would silently swallow exceptions thrown within the block. This means problems within the following code would get missed unless explicitly caught within the block with p4.connect():
  • # do something with p4
  • # automatically disconnected
  • Running 'print' on a file that started with '---' would crash Python. This is now fixed. There is still an oddity when p4.track = 1 and a user runs p4.run_print() on a file that only has lines starting with '--- '. In that case, the output of the print is lost. Disable tracking by setting p4.track = 0 (the default) will solve this problem.

New in P4Python 2010.1 (Aug 5, 2013)

  • New functionality:
  • Compatibility with Python 3. This change makes P4Python incompatible with Python 2.5 and prior, but retains compatibility with Python 2.6 (Python 2.7 also works but is unsupported).
  • Python 3.1 is currently only experimental because of Unicode and 8-bit ASCII support. P4Python 2010.1 with Python 3.1 at the moment only supports 7-bit ASCII on non-Unicode servers and UTF8 on Unicode servers.
  • Added new P4.server_unicode attribute that allows script writers to test whether or not a Perforce Server is in internationalized (unicode) mode.
  • P4.server_case_insensitive() has been changed from a method to an attribute (that is, no brackets) P4.server_level, P4.server_unicode and P4.server_case_insensitive all will send a "info" command to the server upon invocation if no previous command was sent before. Previously, these commands would throw an exception instead.
  • New read-only string attributes PATCHLEVEL and OS so that script writers can test the installation of P4Python without having to parse the output of P4.identify()
  • Bugs fixed:
  • P4.identify() now correctly report 'NTX64' for 64-bit builds on Windows.
  • All keyword arguments passed in the constructor are now evaluated correctly.
  • Support for P4.run_print() for more than one file. Previously, P4.run_print() would throw an exception when trying to print more than one file.
  • P4.RAISE_ERROR has been renamed to P4.RAISE_ERRORS for consistency with P4Ruby. P4.RAISE_ERROR is still available for backwards compatibility.
  • Under rare circumstances P4.run_filelog() would throw an "Index out of range" error for "fileSize" fields. This is now prevented.