Build a utility to interact with TFS.

Review Request #8303 — Created July 20, 2016 and submitted

Information

rb-tfs
master
a3aeb6e...

Reviewers

The "tf" command that ships with Team Explorer Everywhere is pretty good, but
it is missing some functionality that we'd like. Most notably, there's no way
to get the content of files within a shelveset without unshelving it. That
means that in order to be able to post shelvesets, we need our own adapter.
This change is the beginnings of such an adapter, using the TFS SDK for Java.

Because we have such an adapter now, we can make it do exactly what we need for
interacting with TFS, which dramatically reduces the number of times it needs
to be called. This is good because each time it is called, we have to spin up
the whole JRE.

I've written this using a modular command format with individual commands for
each of the steps we have. These steps are:

  • Verify the workspace and get the URL of the collection.
  • Parse a given revision spec (with zero, one, or two "revisions" specified).
    This converts those revisions into either numeric changesets or special
    internal keys representing either the working copy or a shelveset.
  • Do a diff based on the parsed revisions. Diffs are currently implemented for
    the working directory and shelvesets. I haven't yet implemented diffs for
    committed revisions, because that's somewhat more complex, but the existing
    tf.cmd-based implementation doesn't do it either.

This does not yet handle rbtools' -I and -X flags.

Used this to post pending and shelved changes.

Description From Last Updated

Looks like you meant to have an itemized list of some sort in the description. A bunch of line are …

chipx86chipx86

Well over 80 chars. We should probably keep the line length limits.

chipx86chipx86

Probably here too.

chipx86chipx86

In JavaScript, we have these align. Should probably be consistent with that.

chipx86chipx86

Might be nice to flesh this out, saying what needs to be done a bit?

chipx86chipx86

We should probably stick with the standard multi-line format we have for the doc comments and that we use in …

chipx86chipx86

Same as above with alignment.

chipx86chipx86

Just to check, only SHELVESET_PREFIX needs a colon?

chipx86chipx86
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        build.xml
        log4j.properties
        org/reviewboard/tfs/Application.java
        ivysettings.xml
        ivy.xml
        org/reviewboard/tfs/Command.java
        org/reviewboard/tfs/CommandGetCollection.java
        org/reviewboard/tfs/Revision.java
        org/reviewboard/tfs/CommandParseRevision.java
        org/reviewboard/tfs/TFSDiffer.java
        org/reviewboard/tfs/CommandDiff.java
        org/reviewboard/tfs/TFSCollection.java
    
    
    
    Tool: Pyflakes
    Ignored Files:
        build.xml
        log4j.properties
        org/reviewboard/tfs/Application.java
        ivysettings.xml
        ivy.xml
        org/reviewboard/tfs/Command.java
        org/reviewboard/tfs/CommandGetCollection.java
        org/reviewboard/tfs/Revision.java
        org/reviewboard/tfs/CommandParseRevision.java
        org/reviewboard/tfs/TFSDiffer.java
        org/reviewboard/tfs/CommandDiff.java
        org/reviewboard/tfs/TFSCollection.java
    
    
  2. 
      
chipx86
  1. I don't have a lot to say about the logic, as I don't really know how the pieces fit together so well. I mostly have stylistic comments designed to keep us in sync with other similar code (JavaScript, in particular) that we write.

  2. Looks like you meant to have an itemized list of some sort in the description. A bunch of line are pretty squashed together.

  3. org/reviewboard/tfs/Application.java (Diff revision 1)
     
     

    Well over 80 chars. We should probably keep the line length limits.

    1. I initially tried to stay within 80 chars but java APIs are so wordy that it gets to be pretty unreadable.

    2. We can easily pull part of that out into a variable.

    3. For this one yes, but in a lot of cases even with new variables, it won't fit, and then the code gets messier. Even a lot of the import statements are longer than 80 characters :(

    4. Fun fun :( Yayyy Java.

  4. org/reviewboard/tfs/Application.java (Diff revision 1)
     
     

    Probably here too.

  5. org/reviewboard/tfs/Command.java (Diff revision 1)
     
     
     
     

    In JavaScript, we have these align. Should probably be consistent with that.

  6. org/reviewboard/tfs/CommandDiff.java (Diff revision 1)
     
     

    Might be nice to flesh this out, saying what needs to be done a bit?

  7. We should probably stick with the standard multi-line format we have for the doc comments and that we use in JavaScript.

  8. org/reviewboard/tfs/CommandParseRevision.java (Diff revision 1)
     
     
     
     

    Same as above with alignment.

  9. org/reviewboard/tfs/Revision.java (Diff revision 1)
     
     
     
     
     

    Just to check, only SHELVESET_PREFIX needs a colon?

    1. Yeah. It's a prefix that gets the shelveset name appended to it, while the others are complete atoms.

  10. 
      
david
reviewbot
  1. Tool: PEP8 Style Checker
    Ignored Files:
        build.xml
        log4j.properties
        org/reviewboard/tfs/Application.java
        ivysettings.xml
        ivy.xml
        org/reviewboard/tfs/Command.java
        org/reviewboard/tfs/CommandGetCollection.java
        org/reviewboard/tfs/Revision.java
        org/reviewboard/tfs/CommandParseRevision.java
        org/reviewboard/tfs/TFSDiffer.java
        org/reviewboard/tfs/CommandDiff.java
        org/reviewboard/tfs/TFSCollection.java
    
    
    
    Tool: Pyflakes
    Ignored Files:
        build.xml
        log4j.properties
        org/reviewboard/tfs/Application.java
        ivysettings.xml
        ivy.xml
        org/reviewboard/tfs/Command.java
        org/reviewboard/tfs/CommandGetCollection.java
        org/reviewboard/tfs/Revision.java
        org/reviewboard/tfs/CommandParseRevision.java
        org/reviewboard/tfs/TFSDiffer.java
        org/reviewboard/tfs/CommandDiff.java
        org/reviewboard/tfs/TFSCollection.java
    
    
  2. 
      
chipx86
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to master (810630c)
Loading...