Jump to content

baptiste

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by baptiste

  1. Hi,

    I'd like to know whether a given workspace (and maybe a given branch of this workspace) is up-to-date with regards to its repository, i.e if launching an update with `POST /api/v1/wkspaces/:wkname/update` will have any effect or not.

    I was not able to find an entry point I could use for that in https://www.plasticscm.com/documentation/restapi/plastic-scm-version-control-rest-api-guide. Do you have an idea on how to make this possible?

    Thanks,

    Baptiste

  2. Hi @ollieblanks,

     

    Thank your answer. Does it mean it's not possible to check in an item deletion if the file has already been removed from the workspace?

     

    I tried your suggestion, but I still can't' check in the deletion.  Here's what I've been trying to do:

     

    I have a workspace named "test_decentralized", with a "cube.glb" file at the root of this workspace. I want to be able to delete this file and check in this deletion.

     

    wkname = "test_decentralized"
    path = "cube.glb" # Its actual filepath on my system is "C:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb"
    
    
    # Checkout the file
    url = __api_url + f"/wkspaces/{wkname}/content/{path}"
    res = requests.put(url)
    print(f"req.status_code = {res.status_code}")
    if res.status_code != 200:
        raise
    print(res.json()) # -> seems to work, I get "{'affectedPaths': ['c:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb']}"
    
    # Locally remove the file
    os.remove("C:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb")
    
    # Try to checkin this deletion
    url = __api_url + "wkspaces/test_decentralized/checkin"
    params = {
        "paths": ["cube.glb"], # I also tried passing an empty list this empty 
        "comment": "Deleting a file",
        "recurse": True,
    }
    res = requests.post(
        url,
        headers={
            "Content-type": "application/json",
            "Accept": "application/json",
        },
        data=json.dumps(params),
    )
    print(res.json()) # -> {'totalSize': 0, 'transferredSize': 0, 'status': 'Checkin operation starting...'}
    
    res = requests.get(__api_url + f"wkspaces/{wkname}/checkin")
    print(res.json()) # -> {'status': 'Failed', 'message': 'The item c:\\Users\\Baptiste\\wkspaces\\test_decentralized\\cube.glb does not exist in the workspace.'}

    The cube.glb file is liested in Plastic GUI in the "Pending Changes" tab, as a deleted item with a status "Removed locally".

     

    Cheers,

     

    Baptiste

  3. Hi Rafael,

    I tried leaving the `paths` parameter empty, either by passing an empty list:
     

    params = {
        "paths": [],
        "comment": "Deleting a file",
        "recurse": True,
    }

    or by omitting the parameter:
     

    params = {
        "comment": "Deleting a file",
        "recurse": True,
    }

    In both cases, I tried with recurse set to `True` or `False`.  The returned response is always:
     

    {'totalSize': 0, 'transferredSize': 0, 'status': 'Checkin operation starting...'}

     

    The item still appears in the "Pending Changes " as "Removed locally".

     

    Cheers,

     

    Baptiste

  4. Hi,

    When using Plastic SCM GUI, a item removed locally (a deleted file) appears in the "Pending Changes" section and this change can be checkin.

    I cannot figure out how to to replicate this using the REST API, i.e I would like to checkin a file deletion. I tried setting the `paths` parameter to the path of the deleted file or of the directory where the deleted file was located.

    url = __api_url + f"/wkspaces/myworkspace/checkin"
    params = {
        "paths": [
            "wkpath/to/file" # also tried "wkpath/to/file_dir"
        ],
        "comment": "Deleting a file",
        "recurse": True,
    }
    res = requests.post(
        url,
        headers={
            "Content-type": "application/json",
            "Accept": "application/json",
        },
        data=json.dumps(params),
    )
    print(res.json())
    # will print: {'totalSize': 0, 'transferredSize': 0, 'status': 'Checkin operation starting...'}

    And the response returned by a GET at "api/v1/wkspaces/myworkspace/checkin" is:
     

    {"status":"Failed", "message":"There are no changes in the workspace c:\\Users\\Baptiste\\wkspaces\\myworkspace"}

     

    What am I missing? How do you submit a file deletion when using the REST API?

    Thank you!

×
×
  • Create New...