HomePhabricator

Provide `phragment.getstate` and `phragment.getpatch` Conduit methods

Description

Provide phragment.getstate and phragment.getpatch Conduit methods

Summary:
This provides a phragment.getstate and a phragment.getpatch Conduit method.

phragment.getstate - This returns the current state of the fragment and all of it's children.

phragment.getpatch - This accepts a base path and a mapping of paths to hashes. The mapping is for the caller to specify the current state of the files it has. This returns a list of patches that the caller needs to apply to it's files to get to the latest version.

Test Plan:
Ran the following script in a folder which had content matching a fragment and it's children:

#!/bin/bash

STATE=""
for i in $(find ./ -type f); do
    HASH=$(cat $i | sha1sum | awk '{ print $1 }')
    BASE=${i:2}
    STATE="$STATE,\"$BASE\":\"$HASH\""
done
STATE=${STATE:1}
STATE="{$STATE}"

echo '{"path":"tychaia3.zip","state":'$STATE'}' | arc --conduit-uri=http://phabricator.local/ call-conduit phragment.getpatch

and I got:

{"error":null,"errorMessage":null,"response":[]}

I updated one of the child fragments with a new file and ran the script again (patch has been omitted due to it's size):

{"error":null,"errorMessage":null,"response":[{"path":"Content\/TitleFont.xnb","hash_old":"4a927d7b90582e50cdd330de9f4b59b0cc5eb5c7","hash_new":"25867504642a3a403102274c68fbb9b430c1980f","patch":"..."}]}

Reviewers: epriestley, Blessed Reviewers

Reviewed By: epriestley

CC: Korvin, epriestley, aran, staticshock

Maniphest Tasks: T4205

Differential Revision: https://secure.phabricator.com/D7739

Details

Provenance
hach-queAuthored on Dec 11 2013, 12:19 AM
hach-quePushed on Dec 11 2013, 12:19 AM
Reviewer
epriestley
Differential Revision
D7739: Provide `phragment.getstate` and `phragment.getpatch` Conduit methods
Parents
rP270c8d27ab4e: Implement "Wait for Previous Builds" build step
Branches
Unknown
Tags
Unknown

Event Timeline