Skip to content

Closes #201: Branch cloning #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: feature
Choose a base branch
from
Open

Conversation

jeremystretch
Copy link
Contributor

@jeremystretch jeremystretch commented Jan 27, 2025

Closes: #201

Implements the ability to pull changes from one branch into another by replaying the change records from the source branch onto the destination.

  • Add related_branch ForeignKey on BranchEvent model
  • Implements a pull() method on the Branch model to effect the replaying of changes
  • Introduces a view & REST API endpoint for "pull" operations (consistent with sync & merge operations)
  • Introduces the pre_pull & post_pull signals
  • Add pull_validators configuration parameter

@jeremystretch jeremystretch marked this pull request as ready for review January 30, 2025 14:32
@jeremystretch jeremystretch added this to the v0.6 milestone Jan 30, 2025
Copy link
Contributor

@arthanson arthanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a bug here - if you do pull it does not pick up synced changes from the other branch. After noticing this I use the following test and ran into a error:

  1. create branch A
  2. create branch B
  3. in main create a new site "site-main"
  4. activate branch A
  5. sync branch A (so it picks up "nsite-main")
  6. create a device on branch A using "nsite-main"
  7. switch to Branch B
  8. Pull from Branch A
  9. Error.

I think there are other errors as when I created the device in A it auto-created some power ports from the device type I created, the error seems to be coming from those:

{
    "log": [
        "Pulling changes from branch aaa into bbb",
        "Found 10 changes to pull",
        "Applying change 16: tdevaaa created by ahanson using schema_branch_uardeem4",
        "Creating device <DeserializedObject: dcim.Device(pk=107)>",
        "Applying change 17: Input created by ahanson using schema_branch_uardeem4",
        "Creating power port <DeserializedObject: dcim.PowerPort(pk=82)>",
        "{'device': ['device instance with id 107 does not exist.']}"
    ]
}

The device I created (using demo data) was:
Name: tdevaaa
Role: Access Switch
Device type: AP7901
Site: nsite-main

@jeremystretch jeremystretch removed this from the v0.6 milestone May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants