WSAPI: Why is the Revision attribute of a Changeset handled as a string in Web Services API
search cancel

WSAPI: Why is the Revision attribute of a Changeset handled as a string in Web Services API

book

Article ID: 131934

calendar_today

Updated On:

Products

CA Agile Central On Premise (Rally) CA Agile Central SaaS (Rally)

Issue/Introduction

The Revision attribute of a changeset is handled as a string in Web Services API (WSAPI).  Why? 

Resolution

Revision supports Query Expression Operators >, <, >=, <= but comparing strings with those may return unexpected results.

 

For example, a Changesets filtered ((Revision >= 19) AND (Revision <= 29))as in this query:




https://rally1.rallydev.com/slm/webservice/v2.0/changeset?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/<WORKSPACE_OID>&query=((Revision >= 19) AND (Revision <= 29))&fetch=true&start=1&pagesize=200



will return results with following revisions, including "2":




Revision: "2", "19", "20", "21","22","23","24","25","26", "27","28","29"


 

The reason for the Revision attribute to be of type string is as follows:



The Changeset object in WS API is intended for integration with a version control systems. Rally currently supports SVN, Mercurial and GitHub connectors, but there can be other integrations written by 3rd parties. The Revision attribute on a Changeset object is intended to capture what the version control system with which Rally is integrated is using as a revision, but it does not have to be a number, and it is not always a number.



 



In a workspace that uses Git or Mercurial connector a changeset query that fetches revisions will show results where revision is a hash. The query below will return revisions in this format:




Revision: "5de97fb357e9624415c0e19bc52c409eee1bb740"


 

Git cannot have revision numbers due to its decentralized nature. If two different users commit to their local repositories, Git cannot assign a sequential revision number. One user has no knowledge of another user before they push/pull each other's changes.



In a workspace that uses the Subversion (SVN) connector, a changeset query that fetches revisions will show results where revision looks like a number, for example, Revision: "43".



In both cases I used a query that followed this format. They differed only by <WORKSPACE_OID>




https://rally1.rallydev.com/slm/webservice/v2.0/changeset?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/<WORKSPACE_OID>&query=&fetch=Revision