Fork channel

Create a new channel as a copy of main.

Rename channel

Rename main to:

Delete channel

Delete main? This cannot be undone.

DraconPushChangesTest.kt
/**
 * Dracon - An IntelliJ-Pijul integration.
 * Copyright 2021 JonathanxD <jhrldev@gmail.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package com.github.jonathanxd.dracon.test

import com.github.jonathanxd.dracon.push.parsePijulPushChanges
import io.kotest.core.spec.style.ShouldSpec
import io.kotest.matchers.shouldBe

class DraconPushChangesTest : ShouldSpec({

    should("correctly parse a 'pijul push' text with example credit") {
        val text = """
# Please select the changes to push. The lines that contain just a
# valid hash, and no other character (except possibly a newline), will
# be pushed.

ZCRW57C5MSBXYGUMGQTZNHGHO4HGHFBICW53X5I2IMGP3H2CKWRQC

  Dependencies: Q7FXTHVUPVAFMNY277C3NFJO3VXLZU5G6C6UYSD5QPURHSG3A7OQC EAGIDXOLFTHZMZ77ZWAM7MVVUBBXJMZD7RZUNBHJPYRFGGKILGVAC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-03-31 22:43:40.062881279 UTC

    Improved support for revisions

5AUENX2YJVFNKZUSPEPDNLLL7TKZS2WTFC6CABWSZK2EC4MNCRQAC

  Dependencies: ZCRW57C5MSBXYGUMGQTZNHGHO4HGHFBICW53X5I2IMGP3H2CKWRQC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-01 00:07:39.373781350 UTC

    Add support to view files affected by a revision

B43WNBLFFR2UQIH3C6KIZAQTAEQOQM3J3IYLGQMVGJHYOME73OKQC

  Dependencies: 5AUENX2YJVFNKZUSPEPDNLLL7TKZS2WTFC6CABWSZK2EC4MNCRQAC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-01 17:04:54.758320581 UTC

    - Add Show History to Pijul menu
    - Always ignore .idea and .pijul in tracking.
    - Make findPijul a generic function to allow to find editor-server.
    - Only show one revision for directories.
    - Add `Hunk::resolvePath(Path)` to resolve the affected file to a Java NIO Path.
    - Fix StringOutOfBounds in Change Parsering Algorithm
    - Use editor-server instead of copie for interfacing with `pijul record` file.
    - Fix FileStatus provider not returning correctly for untracked files.
    - Add CommittedChangesProvider for Pijul.

Q35OTML226J2HZLHOCPV5OY6ZUM2XU4RZBE5E3GDWVHVFASHFEJAC

  Dependencies: B43WNBLFFR2UQIH3C6KIZAQTAEQOQM3J3IYLGQMVGJHYOME73OKQC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-02 21:31:47.581509792 UTC

    Remove use of coroutines, which was blocking IntelliJ UI in larger repositories

    Improvements for bigger repositories, now Dracon caches the changes that happened in a revision in a file, so everytime Dracon needs to query the changes of a revision, it loads directly from memory instead of doing a full-scan in Pijul repository. For tiny projects it is not a problem, but for medium ones it takes more than five minutes to scan the entire repository (and it was tested with a repo of only 700 records, however there was changes that had more than 60.000 lines).

    The cache file is saved in IntelliJ Data Path (project specific) and is compressed with gzip, so it will not use so much disk space (the cost worths the gains).


ISO7J5ZH5UB7NFZKTKKJQHQHCP4DWQ3F7SM2NDMVYJAGGIKDLX4QC

  Dependencies: Q35OTML226J2HZLHOCPV5OY6ZUM2XU4RZBE5E3GDWVHVFASHFEJAC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-03 03:18:36.900275901 UTC

    More caches, better and generic cache code.


    Now Dracon listen to file changes to drop cached data.

    Implemented caches:

    - File contents in specific revision (never dropped)
    - Pijul ls and Pijul diff results
    - File Revision and File changes by patch
    - some others..


    Dracon is incredible fast now, but still will take some time for bigger repos.

2N67RQZCVGL6GYJJLM2US4YVCEIUK25AHCLD66C7HR4PPTNUOCWAC

  Dependencies: ISO7J5ZH5UB7NFZKTKKJQHQHCP4DWQ3F7SM2NDMVYJAGGIKDLX4QC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-04 03:15:58.713132084 UTC

    Add auto installation support and cache content of ContentRevision

37OJKSWJFDRHNWQW6P7HSZX6OWZWVNCJ2IFT42O5TANQF7VOVX6AC

  Dependencies: A7JOR7M3BUKXYMMAR43IK4GXFXGI33HM6H6LZHDES3HWW6GYFAYAC G54TB4QZZ6OYC2KZTB7KUVW3NJ6VASH7WPNFU2IATPZWM3POIRNQC 2N67RQZCVGL6GYJJLM2US4YVCEIUK25AHCLD66C7HR4PPTNUOCWAC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-04 12:07:50.967878750 UTC

    Improved caching code a lot

A7IL6I3VCB3F3QMYQFPXBL33DN5XDGGQPZIBZRHYSQBSIUBBFQJQC

  Dependencies: 37OJKSWJFDRHNWQW6P7HSZX6OWZWVNCJ2IFT42O5TANQF7VOVX6AC
  Author: [{ name = "Jonathan", full_name = "Jonathan H. R. Lopes", email = "jhrldev@gmail.com" }]
  Date: 2021-04-04 18:38:01.065118605 UTC

    More files to support .ignore


        """.trimIndent()

        val push = text.parsePijulPushChanges()


        push.toString() shouldBe "PijulPushChanges(entries=[PijulPushEntry(hash=ZCRW57C5MSBXYGUMGQTZNHGHO4HGHFBICW53X5I2IMGP3H2CKWRQC, dependencies=[Q7FXTHVUPVAFMNY277C3NFJO3VXLZU5G6C6UYSD5QPURHSG3A7OQC, EAGIDXOLFTHZMZ77ZWAM7MVVUBBXJMZD7RZUNBHJPYRFGGKILGVAC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-03-31T22:43:40.062881279Z[Etc/UTC], message=  Improved support for revisions\n" +
                "), PijulPushEntry(hash=5AUENX2YJVFNKZUSPEPDNLLL7TKZS2WTFC6CABWSZK2EC4MNCRQAC, dependencies=[ZCRW57C5MSBXYGUMGQTZNHGHO4HGHFBICW53X5I2IMGP3H2CKWRQC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-01T00:07:39.373781350Z[Etc/UTC], message=  Add support to view files affected by a revision\n" +
                "), PijulPushEntry(hash=B43WNBLFFR2UQIH3C6KIZAQTAEQOQM3J3IYLGQMVGJHYOME73OKQC, dependencies=[5AUENX2YJVFNKZUSPEPDNLLL7TKZS2WTFC6CABWSZK2EC4MNCRQAC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-01T17:04:54.758320581Z[Etc/UTC], message=  - Add Show History to Pijul menu\n" +
                "  - Always ignore .idea and .pijul in tracking.\n" +
                "  - Make findPijul a generic function to allow to find editor-server.\n" +
                "  - Only show one revision for directories.\n" +
                "  - Add `Hunk::resolvePath(Path)` to resolve the affected file to a Java NIO Path.\n" +
                "  - Fix StringOutOfBounds in Change Parsering Algorithm\n" +
                "  - Use editor-server instead of copie for interfacing with `pijul record` file.\n" +
                "  - Fix FileStatus provider not returning correctly for untracked files.\n" +
                "  - Add CommittedChangesProvider for Pijul.\n" +
                "), PijulPushEntry(hash=Q35OTML226J2HZLHOCPV5OY6ZUM2XU4RZBE5E3GDWVHVFASHFEJAC, dependencies=[B43WNBLFFR2UQIH3C6KIZAQTAEQOQM3J3IYLGQMVGJHYOME73OKQC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-02T21:31:47.581509792Z[Etc/UTC], message=  Remove use of coroutines, which was blocking IntelliJ UI in larger repositories\n" +
                "\n" +
                "  Improvements for bigger repositories, now Dracon caches the changes that happened in a revision in a file, so everytime Dracon needs to query the changes of a revision, it loads directly from memory instead of doing a full-scan in Pijul repository. For tiny projects it is not a problem, but for medium ones it takes more than five minutes to scan the entire repository (and it was tested with a repo of only 700 records, however there was changes that had more than 60.000 lines).\n" +
                "\n" +
                "  The cache file is saved in IntelliJ Data Path (project specific) and is compressed with gzip, so it will not use so much disk space (the cost worths the gains).\n" +
                "\n" +
                "), PijulPushEntry(hash=ISO7J5ZH5UB7NFZKTKKJQHQHCP4DWQ3F7SM2NDMVYJAGGIKDLX4QC, dependencies=[Q35OTML226J2HZLHOCPV5OY6ZUM2XU4RZBE5E3GDWVHVFASHFEJAC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-03T03:18:36.900275901Z[Etc/UTC], message=  More caches, better and generic cache code.\n" +
                "\n" +
                "\n" +
                "  Now Dracon listen to file changes to drop cached data.\n" +
                "\n" +
                "  Implemented caches:\n" +
                "\n" +
                "  - File contents in specific revision (never dropped)\n" +
                "  - Pijul ls and Pijul diff results\n" +
                "  - File Revision and File changes by patch\n" +
                "  - some others..\n" +
                "\n" +
                "\n" +
                "  Dracon is incredible fast now, but still will take some time for bigger repos.\n" +
                "), PijulPushEntry(hash=2N67RQZCVGL6GYJJLM2US4YVCEIUK25AHCLD66C7HR4PPTNUOCWAC, dependencies=[ISO7J5ZH5UB7NFZKTKKJQHQHCP4DWQ3F7SM2NDMVYJAGGIKDLX4QC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-04T03:15:58.713132084Z[Etc/UTC], message=  Add auto installation support and cache content of ContentRevision\n" +
                "), PijulPushEntry(hash=37OJKSWJFDRHNWQW6P7HSZX6OWZWVNCJ2IFT42O5TANQF7VOVX6AC, dependencies=[A7JOR7M3BUKXYMMAR43IK4GXFXGI33HM6H6LZHDES3HWW6GYFAYAC, G54TB4QZZ6OYC2KZTB7KUVW3NJ6VASH7WPNFU2IATPZWM3POIRNQC, 2N67RQZCVGL6GYJJLM2US4YVCEIUK25AHCLD66C7HR4PPTNUOCWAC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-04T12:07:50.967878750Z[Etc/UTC], message=  Improved caching code a lot\n" +
                "), PijulPushEntry(hash=A7IL6I3VCB3F3QMYQFPXBL33DN5XDGGQPZIBZRHYSQBSIUBBFQJQC, dependencies=[37OJKSWJFDRHNWQW6P7HSZX6OWZWVNCJ2IFT42O5TANQF7VOVX6AC], authors=[Author(name=Jonathan, fullName=Jonathan H. R. Lopes, email=jhrldev@gmail.com)], date=2021-04-04T18:38:01.065118605Z[Etc/UTC], message=  More files to support .ignore\n" +
                "\n" +
                ")])"
    }
})