Git Product home page Git Product logo

p4ztag_to_json's Introduction

P4 Ztag to JSON

https://github.com/kaushalmodi/p4ztag_to_json/actions/workflows/test.yml/badge.svg https://github.com/kaushalmodi/p4ztag_to_json/actions/workflows/docs.yml/badge.svg

Little utility to convert the Perforce P4 “Ztag” format data to JSON.

Command line

Pass a ztag format text file

p4ztag_to_json <ztagfile1.foo> <ztagfile2.bar> ..
# Generates <ztagfile1.json> <ztagfile2.json> ..

Pipe output of a p4 -ztag .. command to p4ztag_to_json

p4 -ztag info | p4ztag_to_json
# Prints JSONified version of that input to stdout

Sample “ztag” data

... depotFile //ydf/yepba/ik/LEMHT/uopd/tr/ofvd/ai_rgl.ng
... rev0 35
... change0 587347
... action0 mdlo
... type0 rkwr
... time0 1778604642
... user0 vtsoq
... client0 nq:awjyr:xrjmh.cyo:3724802i
... fileSize0 73567
... digest0 R008427167X2MKRE116S1Q0WFA4OP01T
... desc0 fnny txoeb: qltuvf KNN HHJ3 gbdr ydwwcj axmdlinwff

- bqq_ljqujqav_ofnw   -> CCW_bv
- nea_hswpfmas_vawxny -> WJA_ny
- fse_hnpoqedk_jxf    -> VVM_xc

... how0,0    poxhsp oilq
... file0,0   //lwj/hfssq/tcjvrcxx/POFJK/lkucc6/ol/gudu/my/kakg/pn_doa.xq
... srev0,0   #ddpk
... erev0,0   #1
... rev1 52
... change1 111522
... action1 myqr
... type1 tkrt
... time1 1332615524
... user1 wpeun
... client1 hu:wedwm:psspa.udl:7045580a
... fileSize1 02622
... digest1 6TVK8T0SV0V8PY454H374KM17AA1K43T
... desc1 Rcrrtxhjv xgr fw_sutxg_nuifp ss ic bxm [QJM]

Llkr ta c fmdikgakkl xxohgh .. fusds xfd td_jurfh_ocxji vc bny fiw ftnlfvdw, lhddefunqh wobbo eluoultw fla fnqb jb peotcc.

Converted JSON

[
  {
    "depotFile": "//ydf/yepba/ik/LEMHT/uopd/tr/ofvd/ai_rgl.ng",
    "nested": [
      "nested0",
      "nested1"
    ],
    "nested0": {
      "rev": "35",
      "change": "587347",
      "action": "mdlo",
      "type": "rkwr",
      "time": "1778604642",
      "user": "vtsoq",
      "client": "nq:awjyr:xrjmh.cyo:3724802i",
      "fileSize": "73567",
      "digest": "R008427167X2MKRE116S1Q0WFA4OP01T",
      "desc": "fnny txoeb: qltuvf KNN HHJ3 gbdr ydwwcj axmdlinwff\n- bqq_ljqujqav_ofnw   -> CCW_bv\n- nea_hswpfmas_vawxny -> WJA_ny\n- fse_hnpoqedk_jxf    -> VVM_xc\n",
      "nested": [
        "nested0"
      ],
      "nested0": {
        "how": "   poxhsp oilq",
        "file": "  //lwj/hfssq/tcjvrcxx/POFJK/lkucc6/ol/gudu/my/kakg/pn_doa.xq",
        "srev": "  #ddpk",
        "erev": "  #1"
      }
    },
    "nested1": {
      "rev": "52",
      "change": "111522",
      "action": "myqr",
      "type": "tkrt",
      "time": "1332615524",
      "user": "wpeun",
      "client": "hu:wedwm:psspa.udl:7045580a",
      "fileSize": "02622",
      "digest": "6TVK8T0SV0V8PY454H374KM17AA1K43T",
      "desc": "Rcrrtxhjv xgr fw_sutxg_nuifp ss ic bxm [QJM]\nLlkr ta c fmdikgakkl xxohgh .. fusds xfd td_jurfh_ocxji vc bny fiw ftnlfvdw, lhddefunqh wobbo eluoultw fla fnqb jb peotcc."
    }
  }
]

References

p4ztag_to_json's People

Contributors

kaushalmodi avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

p4ztag_to_json's Issues

Make GHA pass on Windows

https://github.com/kaushalmodi/p4ztag_to_json/runs/2964916345

[Suite] ztag to json
warning: LF will be replaced by CRLF in D:\a\p4ztag_to_json\p4ztag_to_json\tests\tmp\no_valid_record.actual.json.
The file will have its original line endings in your working directory
    D:\a\p4ztag_to_json\p4ztag_to_json\tests\test1.nim(22, 19): Check failed: actualJson`gensym3 == refJson`gensym3
    actualJson`gensym3 was [
  {
    "message": "//... - file(s) up-to-date."
  }
]
    refJson`gensym3 was [
  {
    "message": "//... - file(s) up-to-date."
  }
]
  [FAILED] case where no valid ztag record is present (like when p4 sync doesn't have anything to update)
warning: LF will be replaced by CRLF in D:\a\p4ztag_to_json\p4ztag_to_json\tests\tmp\basic.actual.json.
The file will have its original line endings in your working directory
    D:\a\p4ztag_to_json\p4ztag_to_json\tests\test1.nim(22, 19): Check failed: actualJson`gensym12 == refJson`gensym12
    actualJson`gensym12 was [
  {
    "depotFile": "//abc/def/ghi/TRUNK/jkl/mno/pqr.stu",
    "clientFile": "//ws:vwx:def.yz:7434600b/ghi/jkl/mno/pqr.stu",
    "rev": "7",
    "haveRev": "3",
    "action": "edit",
    "change": "568524",
    "type": "text",
    "user": "vwx",
    "client": "ws:vwx:def.yz:0680383b",
    "desc": "something something something 1\ncontinued description of first record1\n\ncontinued description of first record2\ncontinued description of first record3\n"
  },
  {
    "depotFile": "//abc/def/ghi/TRUNK/jkl/mno/PQR.STU",
    "clientFile": "//ws:vwx:def.yz:6824560b/ghi/jkl/mno/PQR.STU",
    "rev": "1",
    "haveRev": "6",
    "action": "edit",
    "change": "085030",
    "type": "text",
    "user": "vwx",
    "client": "ws:vwx:def.yz:8464768b",
    "desc": "something something something 100\ncontinued description of second record1\n\ncontinued description of second record2\ncontinued description of second record3"
  }

GHA is disabled on Windows for now: a493291

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.