Skip to content

Isolate work in a scope

Every branch belongs to one scope, set when the branch is created: the scope of its parent, unless you name another. lore branch info shows the scope a branch is in, and no command acts on it yet. Use this guide to create a scope, create branches in it, and rename, archive and restore it.

Before you start

  • A repository on a Lore Server that supports scopes. A server that predates scopes fails every lore scope command, and lore branch create --scope, as an unsupported operation. A branch whose first push reaches such a server lands in the default scope there, where it stays.
  • Write access to the repository. Renaming and archiving a scope also need repository administration, or to be the user who created the scope.

Steps

  1. Create the scope. The command prints the name and the ID of the new scope. The name default is reserved for the scope every repository has.
lore scope create release-2
  1. Check the scope. lore scope info shows a scope named by its name or its ID.
lore scope info release-2
  1. Create a branch in the scope. Name the scope by its name or its ID. The command asks the remote for the scope, so it needs the remote, and it refuses a scope the remote doesn't hold or an archived one before it creates the branch. It prints the scope the branch is in.
lore branch create release-2-fixes --scope release-2
  1. Push the branch before the branches created off it. The remote creates a branch on its first push. A branch that names no scope gets the scope of the nearest branch of its stack the remote holds, and keeps it. A branch pushed before its parent therefore skips the parent's scope. lore branch info shows the scope the remote assigned.
lore push
lore branch info
  1. Create branches off it. A branch created without --scope inherits the scope of its parent, and lore branch create prints that scope. To leave the scope, name another one, such as --scope default.
lore branch create release-2-hotfix
  1. Rename, archive or restore the scope. These commands take the scope's ID, which lore scope create, lore scope info and lore branch info print. Archiving drops the scope's name and keeps its branches working, and lore scope info then finds the scope by its ID only. Creating the scope again with its ID restores it under a name, as lore branch create --id restores an archived branch, which --scope puts in the scope it names. The default scope can't be renamed or archived.
lore scope rename <scope-id> release-2.0
lore scope archive <scope-id>
lore scope info <scope-id>
lore scope create release-2.0 --id <scope-id>

Result

lore branch info on each branch of the release line shows the release-2.0 scope.

See also