Commit d56fe8ddca

d56fe8ddca3a5799ae51e521cbb0ee1c4e3af9a5

parent: 3aa264c947

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-26 09:08 UTC

Sync a git folder through Working Copy on iOS

Sync with Working Copy (a folder's menu in Folders, and Commands in the
editor) saves every file and opens Working Copy's chain command to
commit every changed file, pull and push, then takes the x-success or
x-error callback through orgstar://working-copy/. Settings ▸ Working
Copy holds the URL key, kept in the Keychain on the device, and per
folder whether it syncs, the repository's name and whether it syncs
when orgstar opens (off by default). A folder with .git at its top
offers the settings from its menu too. The manual covers the setup and
a Shortcuts automation for syncing when orgstar closes, which an app
can't do itself.

Closes #148

Layout: unified · split

Changed files (15)
Sources/OrgApp/CommandRanking.swift +1 −1 · view
@@ -94,7 +94,7 @@ public enum CommandGroups {
94 public static let commandList: [Group] = orgMenu + [ 94 public static let commandList: [Group] = orgMenu + [
95 Group(title: String(localized: "Clock", comment: "Commands list section"), prefixes: ["app.clock."]), 95 Group(title: String(localized: "Clock", comment: "Commands list section"), prefixes: ["app.clock."]),
96 Group(title: String(localized: "Export", comment: "Commands list section"), prefixes: ["app.export", "app.copy-rich-text", "app.publish"]), 96 Group(title: String(localized: "Export", comment: "Commands list section"), prefixes: ["app.export", "app.copy-rich-text", "app.publish"]),
97 Group(title: String(localized: "File", comment: "Commands list section"), prefixes: ["app.save", "app.word-count", "app.recovery", "app.sync-conflicts", "app.lint"]), 97 Group(title: String(localized: "File", comment: "Commands list section"), prefixes: ["app.save", "app.word-count", "app.recovery", "app.sync-conflicts", "app.lint", "app.working-copy"]),
98 Group(title: String(localized: "Edit", comment: "Commands list section"), prefixes: ["edit.", "macro."]), 98 Group(title: String(localized: "Edit", comment: "Commands list section"), prefixes: ["edit.", "macro."]),
99 Group(title: String(localized: "View", comment: "Commands list section"), prefixes: ["app.toggle-markup", "editor.", "app.split-", "app.pane-"]), 99 Group(title: String(localized: "View", comment: "Commands list section"), prefixes: ["app.toggle-markup", "editor.", "app.split-", "app.pane-"]),
100 ] 100 ]
Sources/OrgApp/CommandTitles.swift +1 · view
@@ -328,6 +328,7 @@ enum CommandTitles {
328 String(localized: "Strike-Through", comment: "Command title"), 328 String(localized: "Strike-Through", comment: "Command title"),
329 String(localized: "Switch to Buffer…", comment: "Command title"), 329 String(localized: "Switch to Buffer…", comment: "Command title"),
330 String(localized: "Sync Attachments", comment: "Command title"), 330 String(localized: "Sync Attachments", comment: "Command title"),
331 String(localized: "Sync with Working Copy", comment: "Command title"),
331 String(localized: "Take Photo…", comment: "Command title"), 332 String(localized: "Take Photo…", comment: "Command title"),
332 String(localized: "Tangle Block", comment: "Command title"), 333 String(localized: "Tangle Block", comment: "Command title"),
333 String(localized: "Tangle Block's Target", comment: "Command title"), 334 String(localized: "Tangle Block's Target", comment: "Command title"),
Sources/OrgApp/WorkingCopy.swift added +147 · view
@@ -0,0 +1,147 @@
1import Foundation
2import Security
3
4/// Syncing a folder that is a git repository in Working Copy, through its x-callback-url
5/// commands (https://workingcopyapp.com/url-schemes.html): commit everything changed, pull,
6/// then push, with the answer coming back to `orgstar://working-copy/…`.
7public enum WorkingCopy {
8 public static let scheme = "working-copy"
9 /// The host of the callbacks in orgstar's own scheme.
10 public static let callbackHost = "working-copy"
11
12 /// The commit message.
13 public static let message = "Update from orgstar"
14
15 /// The `chain` command that commits every changed file in `repo`, pulls and pushes, with
16 /// `key` (Working Copy's URL key) and callbacks naming `repo`.
17 public static func syncURL(repo: String, key: String, message: String = message) -> URL {
18 let back = { (result: String) in
19 "\(AppLink.scheme)://\(callbackHost)/\(result)?repo=\(encode(repo))"
20 }
21 // Parameters before the first `command` apply to every command; `x-success` is used by
22 // the last one.
23 let query = [
24 ("repo", repo), ("key", key), ("x-success", back("success")), ("x-error", back("error")),
25 ("command", "commit"), ("message", message), ("limit", "999"),
26 ("command", "pull"),
27 ("command", "push"),
28 ]
29 var components = URLComponents()
30 components.scheme = scheme
31 components.host = "x-callback-url"
32 components.path = "/chain"
33 components.percentEncodedQuery = query.map { "\($0)=\(encode($1))" }.joined(separator: "&")
34 return components.url!
35 }
36
37 /// Spaces as `%20`, not `+`, and every reserved character encoded, as Working Copy asks.
38 static func encode(_ value: String) -> String {
39 var allowed = CharacterSet.alphanumerics
40 allowed.insert(charactersIn: "-._~")
41 return value.addingPercentEncoding(withAllowedCharacters: allowed) ?? value
42 }
43
44 /// Working Copy's answer to a sync.
45 public enum Callback: Equatable, Sendable {
46 case success(repo: String)
47 /// With Working Copy's `errorMessage`, when it gave one.
48 case failure(repo: String, message: String?)
49 }
50
51 /// The callback `url` is, or nil for another URL.
52 public static func callback(_ url: URL) -> Callback? {
53 guard url.scheme == AppLink.scheme, url.host == callbackHost,
54 let components = URLComponents(url: url, resolvingAgainstBaseURL: false),
55 let repo = components.queryItems?.first(where: { $0.name == "repo" })?.value else { return nil }
56 switch url.lastPathComponent {
57 case "success": return .success(repo: repo)
58 case "error":
59 let message = components.queryItems?.first { $0.name == "errorMessage" }?.value
60 return .failure(repo: repo, message: message.flatMap { $0.isEmpty ? nil : $0 })
61 default: return nil
62 }
63 }
64
65 /// Whether `root` holds a git repository: a `.git` folder or file (a worktree's) at its top.
66 /// Working Copy's own File Provider may leave `.git` out, so a folder can be set up without it.
67 public static func isRepository(_ root: String) -> Bool {
68 FileManager.default.fileExists(atPath: (root as NSString).appendingPathComponent(".git"))
69 }
70
71 // MARK: - Settings
72
73 /// How a folder syncs: the repository's name in Working Copy, and whether it syncs each time
74 /// the app opens. A folder without settings doesn't sync.
75 public struct Folder: Codable, Equatable, Sendable {
76 public var repository: String
77 public var syncOnOpen: Bool
78
79 public init(repository: String, syncOnOpen: Bool = false) {
80 self.repository = repository
81 self.syncOnOpen = syncOnOpen
82 }
83 }
84
85 /// The folders set up on this device, by root path. Kept on the device: roots are at
86 /// different paths on each.
87 public struct Folders {
88 static let key = "workingCopyFolders"
89 let defaults: UserDefaults
90
91 public init(defaults: UserDefaults = .standard) {
92 self.defaults = defaults
93 }
94
95 public var all: [String: Folder] {
96 guard let data = defaults.data(forKey: Self.key) else { return [:] }
97 return (try? JSONDecoder().decode([String: Folder].self, from: data)) ?? [:]
98 }
99
100 public func folder(_ root: String) -> Folder? { all[root] }
101
102 /// Sets up `root`, or with nil stops syncing it.
103 public func set(_ folder: Folder?, for root: String) {
104 var all = all
105 all[root] = folder
106 defaults.set(try? JSONEncoder().encode(all), forKey: Self.key)
107 }
108
109 /// The root set up with `repository`.
110 public func root(of repository: String) -> String? {
111 all.filter { $0.value.repository == repository }.map(\.key).sorted().first
112 }
113 }
114
115 // MARK: - The key
116
117 /// Working Copy's URL key, which every command needs. Kept in the Keychain on this device
118 /// only, never in settings or logs.
119 public enum Key {
120 static let service = "sh.krz.orgstar.working-copy"
121
122 static var query: [String: Any] {
123 [kSecClass as String: kSecClassGenericPassword, kSecAttrService as String: service, kSecAttrAccount as String: "url-key"]
124 }
125
126 public static func stored() -> String? {
127 var q = query
128 q[kSecReturnData as String] = true
129 var result: AnyObject?
130 guard SecItemCopyMatching(q as CFDictionary, &result) == errSecSuccess, let data = result as? Data else { return nil }
131 let key = String(decoding: data, as: UTF8.self)
132 return key.isEmpty ? nil : key
133 }
134
135 /// Stores `key`, or removes it when it is nil or empty. False when the Keychain refused.
136 @discardableResult
137 public static func store(_ key: String?) -> Bool {
138 SecItemDelete(query as CFDictionary)
139 guard let key, !key.isEmpty else { return true }
140 var item = query
141 item[kSecValueData as String] = Data(key.utf8)
142 item[kSecAttrLabel as String] = "orgstar: Working Copy URL key"
143 item[kSecAttrAccessible as String] = kSecAttrAccessibleWhenUnlockedThisDeviceOnly
144 return SecItemAdd(item as CFDictionary, nil) == errSecSuccess
145 }
146 }
147}
Sources/OrgstarMobile/EditorScreen.swift +7 · view
@@ -521,6 +521,12 @@ struct EditorScreen: View {
521 sheet = .rename(kind, context.map { kind.initial(text: $0.text, caret: $0.caret, keywords: $0.tree.settings.todoKeywordNames) } ?? "") 521 sheet = .rename(kind, context.map { kind.initial(text: $0.text, caret: $0.caret, keywords: $0.tree.settings.todoKeywordNames) } ?? "")
522 } else if id == "app.lint" { 522 } else if id == "app.lint" {
523 if FileLint.applies(to: path) { sheet = .lint } else { message = String(localized: "Lint File works on Org files", comment: "Lint File in a file that isn't Org") } 523 if FileLint.applies(to: path) { sheet = .lint } else { message = String(localized: "Lint File works on Org files", comment: "Lint File in a file that isn't Org") }
524 } else if id == "app.working-copy.sync" {
525 if let root = model.workingCopy.root(containing: path, roots: workspace.rootPaths) {
526 model.workingCopy.sync(root, session: session)
527 } else {
528 message = String(localized: "This folder doesn't sync with Working Copy; turn it on in Settings ▸ Working Copy.", comment: "Sync with Working Copy in a folder that isn't set up")
529 }
524 } else if id == "app.toggle-markup" { 530 } else if id == "app.toggle-markup" {
525 model.showMarkup.toggle() 531 model.showMarkup.toggle()
526 } else if MobileEditor.linkCommands.contains(id) { 532 } else if MobileEditor.linkCommands.contains(id) {
@@ -1059,6 +1065,7 @@ struct CommandPalette: View {
1059 ("app.toggle-markup", "Show or Hide Markup"), ("app.word-count", "Word Count"), 1065 ("app.toggle-markup", "Show or Hide Markup"), ("app.word-count", "Word Count"),
1060 ("org.snippet.next-field", "Next Snippet Field"), ("org.snippet.previous-field", "Previous Snippet Field"), 1066 ("org.snippet.next-field", "Next Snippet Field"), ("org.snippet.previous-field", "Previous Snippet Field"),
1061 ("app.recovery", "Recovery Versions…"), ("app.sync-conflicts", "Resolve Sync Conflicts…"), ("app.lint", "Lint File"), 1067 ("app.recovery", "Recovery Versions…"), ("app.sync-conflicts", "Resolve Sync Conflicts…"), ("app.lint", "Lint File"),
1068 ("app.working-copy.sync", "Sync with Working Copy"),
1062 ("org.toggle-inline-images", "Show or Hide Inline Images"), ("org.toggle-inline-images-linked", "Show or Hide Inline Images, Including Described Links"), ("org.latex-preview", "Show or Hide LaTeX Previews"), ("editor.toggle-truncate-lines", "Truncate or Wrap Long Lines"), ("editor.toggle-auto-fill", "Turn Auto Fill On or Off"), 1069 ("org.toggle-inline-images", "Show or Hide Inline Images"), ("org.toggle-inline-images-linked", "Show or Hide Inline Images, Including Described Links"), ("org.latex-preview", "Show or Hide LaTeX Previews"), ("editor.toggle-truncate-lines", "Truncate or Wrap Long Lines"), ("editor.toggle-auto-fill", "Turn Auto Fill On or Off"),
1063 ("editor.complete", "Complete at Point"), ("editor.dabbrev-expand", "Expand Word"), ("editor.dabbrev-completion", "Complete Word"), 1070 ("editor.complete", "Complete at Point"), ("editor.dabbrev-expand", "Expand Word"), ("editor.dabbrev-completion", "Complete Word"),
1064 ("edit.isearch-forward", "Incremental Search"), ("edit.isearch-backward", "Incremental Search Backward"), 1071 ("edit.isearch-forward", "Incremental Search"), ("edit.isearch-backward", "Incremental Search Backward"),
Sources/OrgstarMobile/FoldersScreen.swift +23 −1 · view
@@ -17,6 +17,8 @@ struct FoldersScreen: View {
17 @State private var deletingRoot: String? 17 @State private var deletingRoot: String?
18 /// The added folder whose removal from orgstar is being confirmed. 18 /// The added folder whose removal from orgstar is being confirmed.
19 @State private var removingRoot: String? 19 @State private var removingRoot: String?
20 /// The added folder whose Working Copy settings are showing.
21 @State private var workingCopyRoot: String?
20 @Environment(MobileModel.self) private var model 22 @Environment(MobileModel.self) private var model
21 23
22 var body: some View { 24 var body: some View {
@@ -33,13 +35,17 @@ struct FoldersScreen: View {
33 Text((root as NSString).lastPathComponent) 35 Text((root as NSString).lastPathComponent)
34 Spacer() 36 Spacer()
35 Menu { 37 Menu {
38 workingCopyButtons(root)
36 removeButton(root) 39 removeButton(root)
37 } label: { 40 } label: {
38 Label("Folder Actions", systemImage: "ellipsis.circle").labelStyle(.iconOnly) 41 Label("Folder Actions", systemImage: "ellipsis.circle").labelStyle(.iconOnly)
39 } 42 }
40 .textCase(nil) 43 .textCase(nil)
41 } 44 }
42 .contextMenu { removeButton(root) } 45 .contextMenu {
46 workingCopyButtons(root)
47 removeButton(root)
48 }
43 } 49 }
44 } 50 }
45 if let error = workspace.lastError { 51 if let error = workspace.lastError {
@@ -78,6 +84,9 @@ struct FoldersScreen: View {
78 .navigationDestination(for: FolderRoute.self) { route in 84 .navigationDestination(for: FolderRoute.self) { route in
79 FolderPage(workspace: workspace, session: session, route: route) 85 FolderPage(workspace: workspace, session: session, route: route)
80 } 86 }
87 .sheet(isPresented: Binding { workingCopyRoot != nil } set: { if !$0 { workingCopyRoot = nil } }) {
88 if let root = workingCopyRoot { WorkingCopyFolderScreen(root: root) }
89 }
81 .confirmDeletion($deleting, workspace: workspace, session: session) { changes += 1 } 90 .confirmDeletion($deleting, workspace: workspace, session: session) { changes += 1 }
82 .createItem($creating, workspace: workspace) { changes += 1 } 91 .createItem($creating, workspace: workspace) { changes += 1 }
83 .newFromTemplate($templating, workspace: workspace, session: session) 92 .newFromTemplate($templating, workspace: workspace, session: session)
@@ -133,6 +142,19 @@ struct FoldersScreen: View {
133 } 142 }
134} 143}
135extension FoldersScreen { 144extension FoldersScreen {
145 /// Sync for a folder set up with Working Copy, and its settings for one that is set up or
146 /// a git repository; others are set up in Settings ▸ Working Copy.
147 @ViewBuilder
148 private func workingCopyButtons(_ root: String) -> some View {
149 let setUp = model.workingCopy.folders.folder(root) != nil
150 if setUp {
151 Button("Sync with Working Copy", systemImage: "arrow.triangle.2.circlepath") { model.workingCopy.sync(root, session: session) }
152 }
153 if setUp || WorkingCopy.isRepository(root) {
154 Button("Working Copy…", systemImage: "arrow.triangle.branch") { workingCopyRoot = root }
155 }
156 }
157
136 private func removeButton(_ root: String) -> some View { 158 private func removeButton(_ root: String) -> some View {
137 Button("Remove from orgstar…", systemImage: "folder.badge.minus", role: .destructive) { removingRoot = root } 159 Button("Remove from orgstar…", systemImage: "folder.badge.minus", role: .destructive) { removingRoot = root }
138 } 160 }
Sources/OrgstarMobile/MobileEditor.swift +1 · view
@@ -513,6 +513,7 @@ final class MobileEditor: NSObject, DocumentBuffer {
513 case "app.refile", "app.refile.copy", "app.archive": return onAppCommand != nil && Presentation.heading(containing: context.caret, in: context.tree) != nil 513 case "app.refile", "app.refile.copy", "app.archive": return onAppCommand != nil && Presentation.heading(containing: context.caret, in: context.tree) != nil
514 case "app.export-dialog", "app.export-subtree-dialog", "app.copy-rich-text", "app.export.html-open", "app.export-body-only", "app.export.icalendar-agenda", "app.export.icalendar-combined": return onAppCommand != nil 514 case "app.export-dialog", "app.export-subtree-dialog", "app.copy-rich-text", "app.export.html-open", "app.export-body-only", "app.export.icalendar-agenda", "app.export.icalendar-combined": return onAppCommand != nil
515 case _ where id.hasPrefix("app.publish"): return onAppCommand != nil 515 case _ where id.hasPrefix("app.publish"): return onAppCommand != nil
516 case "app.working-copy.sync": return onAppCommand != nil
516 case _ where Self.linkCommands.contains(id): return onAppCommand != nil 517 case _ where Self.linkCommands.contains(id): return onAppCommand != nil
517 case "org.link.open": return OpenLinkAtPoint().applies(in: context) 518 case "org.link.open": return OpenLinkAtPoint().applies(in: context)
518 case "org.table.toggle-column-width", "org.table.shrink", "org.table.expand": 519 case "org.table.toggle-column-width", "org.table.shrink", "org.table.expand":
Sources/OrgstarMobile/MobileModel.swift +2 · view
@@ -49,6 +49,8 @@ final class MobileModel {
49 let reminderLists = ReminderLists() 49 let reminderLists = ReminderLists()
50 /// The file and caret of the editor on screen, advertised for Handoff. 50 /// The file and caret of the editor on screen, advertised for Handoff.
51 @ObservationIgnored let handoff = HandoffAdvertiser() 51 @ObservationIgnored let handoff = HandoffAdvertiser()
52 /// Folders synced through Working Copy.
53 let workingCopy = WorkingCopySync()
52 /// The file of the editor on screen; nil when none is. 54 /// The file of the editor on screen; nil when none is.
53 @ObservationIgnored var handoffPath: String? { 55 @ObservationIgnored var handoffPath: String? {
54 didSet { if handoffPath != oldValue { handoff.changed() } } 56 didSet { if handoffPath != oldValue { handoff.changed() } }
Sources/OrgstarMobile/OrgstarMobileApp.swift +25 −4 · view
@@ -73,6 +73,25 @@ final class AppDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCent
73 } 73 }
74} 74}
75 75
76/// Files continued from another device, and what Working Copy's syncs come to.
77private struct HandoffAndSync: ViewModifier {
78 let model: MobileModel
79 let open: (HandoffPlace) -> Void
80 @Binding var message: String?
81
82 func body(content: Content) -> some View {
83 content
84 .onContinueUserActivity(HandoffPlace.activityType) { activity in
85 if let place = HandoffPlace(userInfo: activity.userInfo) { open(place) }
86 }
87 .onChange(of: model.workingCopy.message) {
88 guard let text = model.workingCopy.message else { return }
89 model.workingCopy.message = nil
90 message = text
91 }
92 }
93}
94
76/// A tab on iPhone, or a row of the sidebar on a regular-width iPad, which also lists search 95/// A tab on iPhone, or a row of the sidebar on a regular-width iPad, which also lists search
77/// and each added folder. 96/// and each added folder.
78enum AppTab: Hashable { case agenda, search, folders, folder(String), settings } 97enum AppTab: Hashable { case agenda, search, folders, folder(String), settings }
@@ -398,6 +417,7 @@ struct RootView: View {
398 } 417 }
399 workspace.startWatching() 418 workspace.startWatching()
400 await workspace.refresh() 419 await workspace.refresh()
420 model.workingCopy.appOpened(roots: workspace.rootPaths, session: session)
401 } 421 }
402 .task { 422 .task {
403 while !Task.isCancelled { 423 while !Task.isCancelled {
@@ -409,9 +429,6 @@ struct RootView: View {
409 .onContinueUserActivity(CSSearchableItemActionType) { activity in 429 .onContinueUserActivity(CSSearchableItemActionType) { activity in
410 if let path = activity.userInfo?[CSSearchableItemActivityIdentifier] as? String { model.openRequest = .file(path) } 430 if let path = activity.userInfo?[CSSearchableItemActivityIdentifier] as? String { model.openRequest = .file(path) }
411 } 431 }
412 .onContinueUserActivity(HandoffPlace.activityType) { activity in
413 if let place = HandoffPlace(userInfo: activity.userInfo) { continueHandoff(place) }
414 }
415 .onChange(of: scenePhase) { _, phase in 432 .onChange(of: scenePhase) { _, phase in
416 // Unsaved edits are written before the app may be stopped. 433 // Unsaved edits are written before the app may be stopped.
417 if phase == .background { 434 if phase == .background {
@@ -426,9 +443,11 @@ struct RootView: View {
426 takeShared() 443 takeShared()
427 model.reloadConfig() 444 model.reloadConfig()
428 model.handoff.update() 445 model.handoff.update()
446 model.workingCopy.appOpened(roots: workspace.rootPaths, session: session)
429 Task { await workspace.refresh() } 447 Task { await workspace.refresh() }
430 } 448 }
431 .onOpenURL(perform: handle) 449 .onOpenURL(perform: handle)
450 .modifier(HandoffAndSync(model: model, open: continueHandoff, message: $message))
432 // The Live Activity follows the clock, wherever it starts or stops. 451 // The Live Activity follows the clock, wherever it starts or stops.
433 .task { 452 .task {
434 LiveClock.publish(model.clock) 453 LiveClock.publish(model.clock)
@@ -472,7 +491,9 @@ struct RootView: View {
472 491
473 /// A widget's or the Live Activity's link, or an org-protocol URL. 492 /// A widget's or the Live Activity's link, or an org-protocol URL.
474 private func handle(_ url: URL) { 493 private func handle(_ url: URL) {
475 if let link = AppLink(url: url) { 494 if let callback = WorkingCopy.callback(url) {
495 model.workingCopy.finished(callback, workspace: workspace, session: session)
496 } else if let link = AppLink(url: url) {
476 open(link) 497 open(link)
477 } else if let request = CaptureRequest(link: url.absoluteString) { 498 } else if let request = CaptureRequest(link: url.absoluteString) {
478 capture = request 499 capture = request
Sources/OrgstarMobile/SettingsScreen.swift +7 · view
@@ -78,6 +78,13 @@ struct SettingsScreen: View {
78 } footer: { 78 } footer: {
79 Text("The buttons above the on-screen keyboard.") 79 Text("The buttons above the on-screen keyboard.")
80 } 80 }
81 if let workspace = model.workspace {
82 Section {
83 NavigationLink("Working Copy") { WorkingCopyScreen(workspace: workspace) }
84 } footer: {
85 Text("Sync folders that are git repositories in Working Copy.")
86 }
87 }
81 Section { 88 Section {
82 let _ = model.settingsVersion 89 let _ = model.settingsVersion
83 Toggle("Show days without entries", isOn: Binding { 90 Toggle("Show days without entries", isOn: Binding {
Sources/OrgstarMobile/WorkingCopySync.swift added +187 · view
@@ -0,0 +1,187 @@
1#if os(iOS)
2import OrgApp
3import SwiftUI
4import UIKit
5
6/// Syncing folders through Working Copy: saves every file, opens Working Copy's commit, pull
7/// and push chain, and takes its answer from `orgstar://working-copy/…`.
8@MainActor
9@Observable
10final class WorkingCopySync {
11 /// What the last sync, or its start, came to, for the app's message line.
12 var message: String?
13 /// Folders waiting for the one being synced, by root.
14 @ObservationIgnored private var queue: [String] = []
15 @ObservationIgnored private var running: String?
16 /// When a sync last started: coming back from Working Copy makes the app active again,
17 /// which mustn't start another.
18 @ObservationIgnored private var started: Date?
19 @ObservationIgnored let folders = WorkingCopy.Folders()
20
21 /// The folder `path` is in, when it is set up.
22 func root(containing path: String, roots: [String]) -> String? {
23 let set = folders.all
24 return roots.filter { set[$0] != nil && (path == $0 || path.hasPrefix($0 + "/")) }.max { $0.count < $1.count }
25 }
26
27 /// Syncs `root`, after the folders already waiting.
28 func sync(_ root: String, session: DocumentSession) {
29 guard running != root, !queue.contains(root) else { return }
30 queue.append(root)
31 if running == nil { next(session: session) }
32 }
33
34 /// The app became active: the folders that sync on opening, unless a sync started a moment
35 /// ago and this is the return from Working Copy.
36 func appOpened(roots: [String], session: DocumentSession) {
37 if let started, Date().timeIntervalSince(started) < 120 { return }
38 let set = folders.all
39 for root in roots where set[root]?.syncOnOpen == true { sync(root, session: session) }
40 }
41
42 private func next(session: DocumentSession) {
43 guard running == nil, !queue.isEmpty else { return }
44 let root = queue.removeFirst()
45 let name = (root as NSString).lastPathComponent
46 guard let folder = folders.folder(root) else { return next(session: session) }
47 // Working Copy commits what is on disk.
48 let unsaved = session.dirtyPaths.filter { !session.save($0) }.sorted()
49 if let failed = unsaved.first {
50 message = String(localized: "\(name) wasn't synced: \((failed as NSString).lastPathComponent) couldn't be saved.", comment: "Working Copy sync")
51 queue.removeAll()
52 return
53 }
54 guard let key = WorkingCopy.Key.stored() else {
55 message = String(localized: "\(name) wasn't synced: set Working Copy's URL key in Settings ▸ Working Copy.", comment: "Working Copy sync")
56 queue.removeAll()
57 return
58 }
59 running = root
60 started = Date()
61 UIApplication.shared.open(WorkingCopy.syncURL(repo: folder.repository, key: key)) { [weak self] opened in
62 guard let self, !opened else { return }
63 self.running = nil
64 self.queue.removeAll()
65 self.message = String(localized: "\(name) wasn't synced: Working Copy isn't installed or couldn't be opened.", comment: "Working Copy sync")
66 }
67 }
68
69 /// Working Copy's answer.
70 func finished(_ callback: WorkingCopy.Callback, workspace: WorkspaceModel, session: DocumentSession) {
71 running = nil
72 switch callback {
73 case .success(let repo):
74 let name = folders.root(of: repo).map { ($0 as NSString).lastPathComponent } ?? repo
75 message = String(localized: "Synced \(name) with Working Copy", comment: "Working Copy sync")
76 Task { await workspace.refresh() }
77 next(session: session)
78 case .failure(let repo, let reason):
79 let name = folders.root(of: repo).map { ($0 as NSString).lastPathComponent } ?? repo
80 message = reason.map { String(localized: "\(name) wasn't synced: \($0)", comment: "Working Copy sync; Working Copy's error follows") }
81 ?? String(localized: "\(name) wasn't synced: Working Copy reported an error.", comment: "Working Copy sync")
82 queue.removeAll()
83 }
84 }
85}
86
87/// Settings ▸ Working Copy: the URL key, and for each folder whether it syncs.
88struct WorkingCopyScreen: View {
89 let workspace: WorkspaceModel
90 @State private var key = WorkingCopy.Key.stored() ?? ""
91 @State private var keyStored = WorkingCopy.Key.stored() != nil
92
93 var body: some View {
94 Form {
95 Section {
96 SecureField("URL key", text: $key)
97 .textInputAutocapitalization(.never)
98 .autocorrectionDisabled()
99 .onSubmit(storeKey)
100 Button(keyStored ? "Replace Key" : "Save Key", action: storeKey).disabled(key.isEmpty)
101 if keyStored {
102 Button("Remove Key", role: .destructive) {
103 WorkingCopy.Key.store(nil)
104 key = ""
105 keyStored = false
106 }
107 }
108 } footer: {
109 Text("Working Copy runs orgstar's sync only with the URL key from Working Copy's settings. orgstar keeps it in the Keychain on this device.")
110 }
111 ForEach(workspace.rootPaths, id: \.self) { root in
112 WorkingCopyFolderSection(root: root)
113 }
114 }
115 .navigationTitle("Working Copy")
116 }
117
118 private func storeKey() {
119 guard !key.isEmpty else { return }
120 keyStored = WorkingCopy.Key.store(key)
121 }
122}
123
124/// Whether a folder syncs with Working Copy, the repository's name there, and whether it syncs
125/// when orgstar opens.
126struct WorkingCopyFolderSection: View {
127 let root: String
128 @State private var folder: WorkingCopy.Folder?
129
130 init(root: String) {
131 self.root = root
132 _folder = State(initialValue: WorkingCopy.Folders().folder(root))
133 }
134
135 var body: some View {
136 let name = (root as NSString).lastPathComponent
137 Section {
138 Toggle("Sync with Working Copy", isOn: Binding {
139 folder != nil
140 } set: { on in
141 save(on ? WorkingCopy.Folder(repository: name) : nil)
142 })
143 if let folder {
144 LabeledContent("Repository") {
145 TextField(name, text: Binding { folder.repository } set: { value in
146 save(WorkingCopy.Folder(repository: value.isEmpty ? name : value, syncOnOpen: folder.syncOnOpen))
147 })
148 .multilineTextAlignment(.trailing)
149 .textInputAutocapitalization(.never)
150 .autocorrectionDisabled()
151 }
152 Toggle("Sync when orgstar opens", isOn: Binding { folder.syncOnOpen } set: { on in
153 save(WorkingCopy.Folder(repository: folder.repository, syncOnOpen: on))
154 })
155 }
156 } header: {
157 Text(verbatim: name)
158 } footer: {
159 if folder != nil {
160 Text("Sync saves every file, then Working Copy commits every changed file in the repository, pulls and pushes. The repository is its name in Working Copy's list.")
161 } else if WorkingCopy.isRepository(root) {
162 Text("This folder is a git repository.")
163 }
164 }
165 }
166
167 private func save(_ new: WorkingCopy.Folder?) {
168 folder = new
169 WorkingCopy.Folders().set(new, for: root)
170 }
171}
172
173/// A folder's Working Copy settings on their own, from its menu in Folders.
174struct WorkingCopyFolderScreen: View {
175 let root: String
176 @Environment(\.dismiss) private var dismiss
177
178 var body: some View {
179 NavigationStack {
180 Form { WorkingCopyFolderSection(root: root) }
181 .navigationTitle("Working Copy")
182 .navigationBarTitleDisplayMode(.inline)
183 .toolbar { ToolbarItem(placement: .confirmationAction) { Button("Done") { dismiss() } } }
184 }
185 }
186}
187#endif
Tests/OrgAppTests/WorkingCopyTests.swift added +64 · view
@@ -0,0 +1,64 @@
1import Foundation
2import Testing
3@testable import OrgApp
4
5struct WorkingCopyTests {
6 @Test func syncChainsCommitPullAndPush() throws {
7 let url = WorkingCopy.syncURL(repo: "my notes", key: "k3y+/&=", message: "Update from orgstar")
8 #expect(url.scheme == "working-copy")
9 #expect(url.host == "x-callback-url")
10 #expect(url.path == "/chain")
11 let query = try #require(url.query(percentEncoded: true))
12 // Spaces as %20, never +, and reserved characters encoded.
13 #expect(!query.contains("+"))
14 #expect(query.hasPrefix("repo=my%20notes&key=k3y%2B%2F%26%3D&x-success="))
15 #expect(query.hasSuffix("&command=commit&message=Update%20from%20orgstar&limit=999&command=pull&command=push"))
16 let items = try #require(URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems)
17 #expect(items.map(\.name) == ["repo", "key", "x-success", "x-error", "command", "message", "limit", "command", "command"])
18 #expect(items.filter { $0.name == "command" }.map(\.value) == ["commit", "pull", "push"])
19 #expect(items.first { $0.name == "key" }?.value == "k3y+/&=")
20 #expect(items.first { $0.name == "x-success" }?.value == "orgstar://working-copy/success?repo=my%20notes")
21 #expect(items.first { $0.name == "x-error" }?.value == "orgstar://working-copy/error?repo=my%20notes")
22 }
23
24 @Test func callbacksComeBackParsed() throws {
25 let success = try #require(URL(string: "orgstar://working-copy/success?repo=my%20notes"))
26 #expect(WorkingCopy.callback(success) == .success(repo: "my notes"))
27 // Working Copy adds x-callback-url's errorCode and errorMessage.
28 let error = try #require(URL(string: "orgstar://working-copy/error?repo=my%20notes&errorCode=1&errorMessage=Merge%20conflict%20in%20a.org"))
29 #expect(WorkingCopy.callback(error) == .failure(repo: "my notes", message: "Merge conflict in a.org"))
30 let bare = try #require(URL(string: "orgstar://working-copy/error?repo=notes"))
31 #expect(WorkingCopy.callback(bare) == .failure(repo: "notes", message: nil))
32 // The callback the sync asks for, as Working Copy would open it.
33 let built = WorkingCopy.syncURL(repo: "a&b", key: "k")
34 let back = try #require(URLComponents(url: built, resolvingAgainstBaseURL: false)?.queryItems?.first { $0.name == "x-success" }?.value)
35 #expect(WorkingCopy.callback(try #require(URL(string: back))) == .success(repo: "a&b"))
36 // Other links aren't callbacks.
37 #expect(WorkingCopy.callback(try #require(URL(string: "orgstar://agenda"))) == nil)
38 #expect(WorkingCopy.callback(try #require(URL(string: "orgstar://working-copy/other?repo=a"))) == nil)
39 #expect(WorkingCopy.callback(try #require(URL(string: "orgstar://working-copy/success"))) == nil)
40 #expect(AppLink(url: success) == nil)
41 }
42
43 @Test func foldersAreKeptByRootAndFoundByRepository() {
44 let defaults = TestDefaults("WorkingCopyTests")
45 let folders = WorkingCopy.Folders(defaults: defaults)
46 #expect(folders.folder("/notes") == nil)
47 folders.set(WorkingCopy.Folder(repository: "notes"), for: "/notes")
48 folders.set(WorkingCopy.Folder(repository: "work", syncOnOpen: true), for: "/w")
49 #expect(WorkingCopy.Folders(defaults: defaults).folder("/notes") == WorkingCopy.Folder(repository: "notes", syncOnOpen: false))
50 #expect(folders.root(of: "work") == "/w")
51 #expect(folders.root(of: "nope") == nil)
52 folders.set(nil, for: "/notes")
53 #expect(folders.all.keys.sorted() == ["/w"])
54 }
55
56 @Test func aGitFolderIsARepository() throws {
57 let root = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
58 defer { try? FileManager.default.removeItem(at: root) }
59 try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)
60 #expect(!WorkingCopy.isRepository(root.path))
61 try FileManager.default.createDirectory(at: root.appendingPathComponent(".git"), withIntermediateDirectories: true)
62 #expect(WorkingCopy.isRepository(root.path))
63 }
64}
docs/manual/guide/01-files-and-folders.org +1 −1 · view
@@ -358,4 +358,4 @@ orgstar does not convert between encodings or line endings.
358 358
359* On iOS 359* On iOS
360 360
361The iOS app adds folders from its Folders screen and lists only org files there. Conflicts, Syncthing copies and recovery versions are in the editor's menu; the iOS app doesn't list git commits or commit to git. Files are watched through file presenters rather than FSEvents. See [[file:14-ios.org][iOS]]. 361The iOS app adds folders from its Folders screen and lists only org files there. Conflicts, Syncthing copies and recovery versions are in the editor's menu; the iOS app doesn't list git commits, and commits, pulls and pushes a git folder through the Working Copy app. Files are watched through file presenters rather than FSEvents. See [[file:14-ios.org][iOS]].
docs/manual/guide/13-configuration.org +11 · view
@@ -176,6 +176,17 @@ Download version only. One row for each folder in the sidebar; a folder that isn
176 176
177The choice is kept on this Mac for the folder's path, not in =config.toml=, since another Mac has other folders. Removing a folder from the sidebar and adding it again keeps it. See [[file:01-files-and-folders.org::*Committing to git][Committing to git]]. 177The choice is kept on this Mac for the folder's path, not in =config.toml=, since another Mac has other folders. Removing a folder from the sidebar and adding it again keeps it. See [[file:01-files-and-folders.org::*Committing to git][Committing to git]].
178 178
179On iPhone and iPad, Settings ▸ Working Copy syncs folders through the Working Copy app instead:
180
181| Control | Choices | Default |
182|--------------------------+-----------------------+--------------------|
183| URL key | Working Copy's key | None |
184| Sync with Working Copy | On or off, per folder | Off |
185| Repository | A name, per folder | The folder's name |
186| Sync when orgstar opens | On or off, per folder | Off |
187
188These are kept on the device, not in =config.toml=: the folders are at other paths on each device, and the key is kept in the Keychain. See [[file:14-ios.org::*Git folders through Working Copy][Git folders through Working Copy]].
189
179** Settings only in config.toml 190** Settings only in config.toml
180 191
181These settings have no control in the Settings window. Some are in the View menu. 192These settings have no control in the Settings window. Some are in the View menu.
docs/manual/guide/14-ios.org +24 · view
@@ -200,6 +200,8 @@ Commands has the org-attach commands, and Attach Photo or Video…, Take Photo
200 200
201Lint File, under File in Commands, lists the problems in the open file with their lines, as the Mac's Lint File panel does; tap one to close the list and move the caret to its line. The checks are the Mac's; see [[file:02-the-editor.org][The editor]]. Run it again after editing to check again. 201Lint File, under File in Commands, lists the problems in the open file with their lines, as the Mac's Lint File panel does; tap one to close the list and move the caret to its line. The checks are the Mac's; see [[file:02-the-editor.org][The editor]]. Run it again after editing to check again.
202 202
203Sync with Working Copy, under File in Commands, syncs the folder of the open file through Working Copy; see Git folders through Working Copy below.
204
203Archive Subtree in Commands (or =C-c C-x C-s= with a hardware keyboard) archives the entry at the caret where =org-archive-location= says, as on the Mac. 205Archive Subtree in Commands (or =C-c C-x C-s= with a hardware keyboard) archives the entry at the caret where =org-archive-location= says, as on the Mac.
204 206
205Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. A remembered passphrase is used after Face ID, Touch ID or the device passcode. 207Commands has the org-crypt commands; see [[file:04-outlines.org][Outlines]]. A remembered passphrase is used after Face ID, Touch ID or the device passcode.
@@ -448,6 +450,28 @@ Recovery Versions… (in Commands, and in the editor's toolbar on iPad while the
448 450
449See [[file:15-alongside-emacs.org][Working alongside Emacs and other tools]] for how merging and recovery work. 451See [[file:15-alongside-emacs.org][Working alongside Emacs and other tools]] for how merging and recovery work.
450 452
453* Git folders through Working Copy
454
455A folder that is a git repository in [[https://workingcopyapp.com][Working Copy]], added to orgstar from Working Copy's place in the folder picker, works like any other folder. orgstar can also ask Working Copy to commit, pull and push it, so you don't have to switch to Working Copy to sync.
456
457Setting it up, once:
458
4591. In Working Copy's settings, find the URL key it uses for x-callback-url commands. Working Copy runs a command from another app only with this key.
4602. In orgstar, open Settings ▸ Working Copy, enter the key in URL key and tap Save Key. orgstar keeps it in the Keychain on this device only, never in =config.toml= or the app's settings.
4613. In the same screen, turn on Sync with Working Copy for the folder. Repository is the repository's name in Working Copy's list; it starts as the folder's name. Sync when orgstar opens is off; turn it on to sync each time you open orgstar.
462
463For a folder with a =.git= folder at its top, the ⋯ button beside its name in Folders also has Working Copy…, with the same settings. Working Copy's own folders may not show =.git=, so set those up in Settings ▸ Working Copy.
464
465To sync, choose Sync with Working Copy from the folder's ⋯ menu in Folders, or from Commands in the editor of a file in the folder. orgstar saves every open file, then opens Working Copy, which commits every changed file in the repository with the message =Update from orgstar=, pulls, pushes and comes back to orgstar. orgstar says =Synced notes with Working Copy= and reads the folder again, or says why the sync didn't happen: a file couldn't be saved, there is no URL key, Working Copy isn't installed, or Working Copy's error, such as a merge conflict. Conflicts are resolved in Working Copy. Pushing needs Working Copy's push feature.
466
467With Sync when orgstar opens, the folders that have it sync, one after another, when you open orgstar or come back to it, except when you come back from Working Copy within two minutes of a sync.
468
469orgstar doesn't sync when you leave it: iOS doesn't let an app open another app as it goes to the background. Use a Shortcuts automation for that, or in place of orgstar's own sync:
470
4711. In Shortcuts, open Automation and add a personal automation with the App trigger. Choose orgstar, and Is Closed (or Is Opened, to pull when you start).
4722. Choose Run Immediately.
4733. Add Working Copy's actions for the repository: commit (with a message), then pull, then push; or only pull for Is Opened.
474
451* Settings 475* Settings
452 476
453The iOS app reads its settings from a configuration folder: a folder holding =config.toml= and =capture.toml=, such as a copy of the Mac's =~/.config/orgstar= synced through iCloud Drive or another app. 477The iOS app reads its settings from a configuration folder: a folder holding =config.toml= and =capture.toml=, such as a copy of the Mac's =~/.config/orgstar= synced through iCloud Drive or another app.
l10n/Localizable.xcstrings +688 · view
@@ -886,6 +886,181 @@
886 } 886 }
887 } 887 }
888 }, 888 },
889 "%@ wasn't synced: %@": {
890 "comment": "Working Copy sync; Working Copy's error follows",
891 "localizations": {
892 "de": {
893 "stringUnit": {
894 "state": "translated",
895 "value": "%1$@ wurde nicht synchronisiert: %2$@"
896 }
897 },
898 "es": {
899 "stringUnit": {
900 "state": "translated",
901 "value": "%1$@ no se sincronizó: %2$@"
902 }
903 },
904 "fr": {
905 "stringUnit": {
906 "state": "translated",
907 "value": "%1$@ n’a pas été synchronisé : %2$@"
908 }
909 },
910 "ja": {
911 "stringUnit": {
912 "state": "translated",
913 "value": "%1$@は同期されませんでした:%2$@"
914 }
915 },
916 "pt-BR": {
917 "stringUnit": {
918 "state": "translated",
919 "value": "%1$@ não foi sincronizado: %2$@"
920 }
921 }
922 }
923 },
924 "%@ wasn't synced: %@ couldn't be saved.": {
925 "comment": "Working Copy sync",
926 "localizations": {
927 "de": {
928 "stringUnit": {
929 "state": "translated",
930 "value": "%1$@ wurde nicht synchronisiert: %2$@ konnte nicht gesichert werden."
931 }
932 },
933 "es": {
934 "stringUnit": {
935 "state": "translated",
936 "value": "%1$@ no se sincronizó: no se pudo guardar %2$@."
937 }
938 },
939 "fr": {
940 "stringUnit": {
941 "state": "translated",
942 "value": "%1$@ n’a pas été synchronisé : %2$@ n’a pas pu être enregistré."
943 }
944 },
945 "ja": {
946 "stringUnit": {
947 "state": "translated",
948 "value": "%1$@は同期されませんでした:%2$@を保存できませんでした。"
949 }
950 },
951 "pt-BR": {
952 "stringUnit": {
953 "state": "translated",
954 "value": "%1$@ não foi sincronizado: não foi possível salvar %2$@."
955 }
956 }
957 }
958 },
959 "%@ wasn't synced: Working Copy isn't installed or couldn't be opened.": {
960 "comment": "Working Copy sync",
961 "localizations": {
962 "de": {
963 "stringUnit": {
964 "state": "translated",
965 "value": "%@ wurde nicht synchronisiert: Working Copy ist nicht installiert oder konnte nicht geöffnet werden."
966 }
967 },
968 "es": {
969 "stringUnit": {
970 "state": "translated",
971 "value": "%@ no se sincronizó: Working Copy no está instalada o no se pudo abrir."
972 }
973 },
974 "fr": {
975 "stringUnit": {
976 "state": "translated",
977 "value": "%@ n’a pas été synchronisé : Working Copy n’est pas installée ou n’a pas pu être ouverte."
978 }
979 },
980 "ja": {
981 "stringUnit": {
982 "state": "translated",
983 "value": "%@は同期されませんでした:Working Copyがインストールされていないか、開けませんでした。"
984 }
985 },
986 "pt-BR": {
987 "stringUnit": {
988 "state": "translated",
989 "value": "%@ não foi sincronizado: o Working Copy não está instalado ou não pôde ser aberto."
990 }
991 }
992 }
993 },
994 "%@ wasn't synced: Working Copy reported an error.": {
995 "comment": "Working Copy sync",
996 "localizations": {
997 "de": {
998 "stringUnit": {
999 "state": "translated",
1000 "value": "%@ wurde nicht synchronisiert: Working Copy hat einen Fehler gemeldet."
1001 }
1002 },
1003 "es": {
1004 "stringUnit": {
1005 "state": "translated",
1006 "value": "%@ no se sincronizó: Working Copy informó de un error."
1007 }
1008 },
1009 "fr": {
1010 "stringUnit": {
1011 "state": "translated",
1012 "value": "%@ n’a pas été synchronisé : Working Copy a signalé une erreur."
1013 }
1014 },
1015 "ja": {
1016 "stringUnit": {
1017 "state": "translated",
1018 "value": "%@は同期されませんでした:Working Copyがエラーを報告しました。"
1019 }
1020 },
1021 "pt-BR": {
1022 "stringUnit": {
1023 "state": "translated",
1024 "value": "%@ não foi sincronizado: o Working Copy relatou um erro."
1025 }
1026 }
1027 }
1028 },
1029 "%@ wasn't synced: set Working Copy's URL key in Settings ▸ Working Copy.": {
1030 "comment": "Working Copy sync",
1031 "localizations": {
1032 "de": {
1033 "stringUnit": {
1034 "state": "translated",
1035 "value": "%@ wurde nicht synchronisiert: Lege den URL-Schlüssel von Working Copy unter Einstellungen ▸ Working Copy fest."
1036 }
1037 },
1038 "es": {
1039 "stringUnit": {
1040 "state": "translated",
1041 "value": "%@ no se sincronizó: introduce la clave URL de Working Copy en Ajustes ▸ Working Copy."
1042 }
1043 },
1044 "fr": {
1045 "stringUnit": {
1046 "state": "translated",
1047 "value": "%@ n’a pas été synchronisé : saisissez la clé URL de Working Copy dans Réglages ▸ Working Copy."
1048 }
1049 },
1050 "ja": {
1051 "stringUnit": {
1052 "state": "translated",
1053 "value": "%@は同期されませんでした:設定 ▸ Working CopyでWorking CopyのURLキーを設定してください。"
1054 }
1055 },
1056 "pt-BR": {
1057 "stringUnit": {
1058 "state": "translated",
1059 "value": "%@ não foi sincronizado: defina a chave de URL do Working Copy em Ajustes ▸ Working Copy."
1060 }
1061 }
1062 }
1063 },
889 "%@ with %@": { 1064 "%@ with %@": {
890 "localizations": { 1065 "localizations": {
891 "de": { 1066 "de": {
@@ -34063,6 +34238,40 @@
34063 } 34238 }
34064 } 34239 }
34065 }, 34240 },
34241 "Remove Key": {
34242 "localizations": {
34243 "de": {
34244 "stringUnit": {
34245 "state": "translated",
34246 "value": "Schlüssel entfernen"
34247 }
34248 },
34249 "es": {
34250 "stringUnit": {
34251 "state": "translated",
34252 "value": "Eliminar clave"
34253 }
34254 },
34255 "fr": {
34256 "stringUnit": {
34257 "state": "translated",
34258 "value": "Supprimer la clé"
34259 }
34260 },
34261 "ja": {
34262 "stringUnit": {
34263 "state": "translated",
34264 "value": "キーを削除"
34265 }
34266 },
34267 "pt-BR": {
34268 "stringUnit": {
34269 "state": "translated",
34270 "value": "Remover Chave"
34271 }
34272 }
34273 }
34274 },
34066 "Remove Priority": { 34275 "Remove Priority": {
34067 "comment": "Command title", 34276 "comment": "Command title",
34068 "localizations": { 34277 "localizations": {
@@ -34892,6 +35101,40 @@
34892 } 35101 }
34893 } 35102 }
34894 }, 35103 },
35104 "Replace Key": {
35105 "localizations": {
35106 "de": {
35107 "stringUnit": {
35108 "state": "translated",
35109 "value": "Schlüssel ersetzen"
35110 }
35111 },
35112 "es": {
35113 "stringUnit": {
35114 "state": "translated",
35115 "value": "Sustituir clave"
35116 }
35117 },
35118 "fr": {
35119 "stringUnit": {
35120 "state": "translated",
35121 "value": "Remplacer la clé"
35122 }
35123 },
35124 "ja": {
35125 "stringUnit": {
35126 "state": "translated",
35127 "value": "キーを置き換え"
35128 }
35129 },
35130 "pt-BR": {
35131 "stringUnit": {
35132 "state": "translated",
35133 "value": "Substituir Chave"
35134 }
35135 }
35136 }
35137 },
34895 "Replace in Files": { 35138 "Replace in Files": {
34896 "comment": "Window title", 35139 "comment": "Window title",
34897 "localizations": { 35140 "localizations": {
@@ -35099,6 +35342,40 @@
35099 } 35342 }
35100 } 35343 }
35101 }, 35344 },
35345 "Repository": {
35346 "localizations": {
35347 "de": {
35348 "stringUnit": {
35349 "state": "translated",
35350 "value": "Repository"
35351 }
35352 },
35353 "es": {
35354 "stringUnit": {
35355 "state": "translated",
35356 "value": "Repositorio"
35357 }
35358 },
35359 "fr": {
35360 "stringUnit": {
35361 "state": "translated",
35362 "value": "Dépôt"
35363 }
35364 },
35365 "ja": {
35366 "stringUnit": {
35367 "state": "translated",
35368 "value": "リポジトリ"
35369 }
35370 },
35371 "pt-BR": {
35372 "stringUnit": {
35373 "state": "translated",
35374 "value": "Repositório"
35375 }
35376 }
35377 }
35378 },
35102 "Reschedule": { 35379 "Reschedule": {
35103 "localizations": { 35380 "localizations": {
35104 "de": { 35381 "de": {
@@ -35994,6 +36271,40 @@
35994 } 36271 }
35995 } 36272 }
35996 }, 36273 },
36274 "Save Key": {
36275 "localizations": {
36276 "de": {
36277 "stringUnit": {
36278 "state": "translated",
36279 "value": "Schlüssel sichern"
36280 }
36281 },
36282 "es": {
36283 "stringUnit": {
36284 "state": "translated",
36285 "value": "Guardar clave"
36286 }
36287 },
36288 "fr": {
36289 "stringUnit": {
36290 "state": "translated",
36291 "value": "Enregistrer la clé"
36292 }
36293 },
36294 "ja": {
36295 "stringUnit": {
36296 "state": "translated",
36297 "value": "キーを保存"
36298 }
36299 },
36300 "pt-BR": {
36301 "stringUnit": {
36302 "state": "translated",
36303 "value": "Salvar Chave"
36304 }
36305 }
36306 }
36307 },
35997 "Save as View…": { 36308 "Save as View…": {
35998 "localizations": { 36309 "localizations": {
35999 "de": { 36310 "de": {
@@ -40923,6 +41234,178 @@
40923 } 41234 }
40924 } 41235 }
40925 }, 41236 },
41237 "Sync folders that are git repositories in Working Copy.": {
41238 "localizations": {
41239 "de": {
41240 "stringUnit": {
41241 "state": "translated",
41242 "value": "Ordner synchronisieren, die Git-Repositorys in Working Copy sind."
41243 }
41244 },
41245 "es": {
41246 "stringUnit": {
41247 "state": "translated",
41248 "value": "Sincroniza carpetas que son repositorios git en Working Copy."
41249 }
41250 },
41251 "fr": {
41252 "stringUnit": {
41253 "state": "translated",
41254 "value": "Synchroniser les dossiers qui sont des dépôts git dans Working Copy."
41255 }
41256 },
41257 "ja": {
41258 "stringUnit": {
41259 "state": "translated",
41260 "value": "Working Copyのgitリポジトリであるフォルダを同期します。"
41261 }
41262 },
41263 "pt-BR": {
41264 "stringUnit": {
41265 "state": "translated",
41266 "value": "Sincronize pastas que são repositórios git no Working Copy."
41267 }
41268 }
41269 }
41270 },
41271 "Sync saves every file, then Working Copy commits every changed file in the repository, pulls and pushes. The repository is its name in Working Copy's list.": {
41272 "localizations": {
41273 "de": {
41274 "stringUnit": {
41275 "state": "translated",
41276 "value": "Beim Synchronisieren werden alle Dateien gesichert; dann committet Working Copy jede geänderte Datei im Repository, führt Pull und dann Push aus. Als Repository gilt sein Name in der Liste von Working Copy."
41277 }
41278 },
41279 "es": {
41280 "stringUnit": {
41281 "state": "translated",
41282 "value": "Al sincronizar se guardan todos los archivos; luego Working Copy hace commit de cada archivo cambiado del repositorio, pull y push. El repositorio es su nombre en la lista de Working Copy."
41283 }
41284 },
41285 "fr": {
41286 "stringUnit": {
41287 "state": "translated",
41288 "value": "La synchronisation enregistre tous les fichiers, puis Working Copy fait un commit de chaque fichier modifié du dépôt, un pull et un push. Le dépôt est son nom dans la liste de Working Copy."
41289 }
41290 },
41291 "ja": {
41292 "stringUnit": {
41293 "state": "translated",
41294 "value": "同期するとすべてのファイルが保存され、Working Copyがリポジトリ内の変更されたファイルをすべてコミットし、プルしてからプッシュします。リポジトリにはWorking Copyの一覧に表示される名前を指定します。"
41295 }
41296 },
41297 "pt-BR": {
41298 "stringUnit": {
41299 "state": "translated",
41300 "value": "Sincronizar salva todos os arquivos; depois o Working Copy faz commit de cada arquivo alterado no repositório, pull e push. O repositório é o nome dele na lista do Working Copy."
41301 }
41302 }
41303 }
41304 },
41305 "Sync when orgstar opens": {
41306 "localizations": {
41307 "de": {
41308 "stringUnit": {
41309 "state": "translated",
41310 "value": "Beim Öffnen von orgstar synchronisieren"
41311 }
41312 },
41313 "es": {
41314 "stringUnit": {
41315 "state": "translated",
41316 "value": "Sincronizar al abrir orgstar"
41317 }
41318 },
41319 "fr": {
41320 "stringUnit": {
41321 "state": "translated",
41322 "value": "Synchroniser à l’ouverture d’orgstar"
41323 }
41324 },
41325 "ja": {
41326 "stringUnit": {
41327 "state": "translated",
41328 "value": "orgstarを開いたときに同期"
41329 }
41330 },
41331 "pt-BR": {
41332 "stringUnit": {
41333 "state": "translated",
41334 "value": "Sincronizar ao abrir o orgstar"
41335 }
41336 }
41337 }
41338 },
41339 "Sync with Working Copy": {
41340 "comment": "Command title",
41341 "localizations": {
41342 "de": {
41343 "stringUnit": {
41344 "state": "translated",
41345 "value": "Mit Working Copy synchronisieren"
41346 }
41347 },
41348 "es": {
41349 "stringUnit": {
41350 "state": "translated",
41351 "value": "Sincronizar con Working Copy"
41352 }
41353 },
41354 "fr": {
41355 "stringUnit": {
41356 "state": "translated",
41357 "value": "Synchroniser avec Working Copy"
41358 }
41359 },
41360 "ja": {
41361 "stringUnit": {
41362 "state": "translated",
41363 "value": "Working Copyと同期"
41364 }
41365 },
41366 "pt-BR": {
41367 "stringUnit": {
41368 "state": "translated",
41369 "value": "Sincronizar com Working Copy"
41370 }
41371 }
41372 }
41373 },
41374 "Synced %@ with Working Copy": {
41375 "comment": "Working Copy sync",
41376 "localizations": {
41377 "de": {
41378 "stringUnit": {
41379 "state": "translated",
41380 "value": "%@ mit Working Copy synchronisiert"
41381 }
41382 },
41383 "es": {
41384 "stringUnit": {
41385 "state": "translated",
41386 "value": "%@ sincronizada con Working Copy"
41387 }
41388 },
41389 "fr": {
41390 "stringUnit": {
41391 "state": "translated",
41392 "value": "%@ synchronisé avec Working Copy"
41393 }
41394 },
41395 "ja": {
41396 "stringUnit": {
41397 "state": "translated",
41398 "value": "%@をWorking Copyと同期しました"
41399 }
41400 },
41401 "pt-BR": {
41402 "stringUnit": {
41403 "state": "translated",
41404 "value": "%@ sincronizado com o Working Copy"
41405 }
41406 }
41407 }
41408 },
40926 "System": { 41409 "System": {
40927 "localizations": { 41410 "localizations": {
40928 "de": { 41411 "de": {
@@ -43286,6 +43769,75 @@
43286 } 43769 }
43287 } 43770 }
43288 }, 43771 },
43772 "This folder doesn't sync with Working Copy; turn it on in Settings ▸ Working Copy.": {
43773 "comment": "Sync with Working Copy in a folder that isn't set up",
43774 "localizations": {
43775 "de": {
43776 "stringUnit": {
43777 "state": "translated",
43778 "value": "Dieser Ordner wird nicht mit Working Copy synchronisiert; schalte es unter Einstellungen ▸ Working Copy ein."
43779 }
43780 },
43781 "es": {
43782 "stringUnit": {
43783 "state": "translated",
43784 "value": "Esta carpeta no se sincroniza con Working Copy; actívalo en Ajustes ▸ Working Copy."
43785 }
43786 },
43787 "fr": {
43788 "stringUnit": {
43789 "state": "translated",
43790 "value": "Ce dossier ne se synchronise pas avec Working Copy ; activez-le dans Réglages ▸ Working Copy."
43791 }
43792 },
43793 "ja": {
43794 "stringUnit": {
43795 "state": "translated",
43796 "value": "このフォルダはWorking Copyと同期していません。設定 ▸ Working Copyでオンにしてください。"
43797 }
43798 },
43799 "pt-BR": {
43800 "stringUnit": {
43801 "state": "translated",
43802 "value": "Esta pasta não sincroniza com o Working Copy; ative em Ajustes ▸ Working Copy."
43803 }
43804 }
43805 }
43806 },
43807 "This folder is a git repository.": {
43808 "localizations": {
43809 "de": {
43810 "stringUnit": {
43811 "state": "translated",
43812 "value": "Dieser Ordner ist ein Git-Repository."
43813 }
43814 },
43815 "es": {
43816 "stringUnit": {
43817 "state": "translated",
43818 "value": "Esta carpeta es un repositorio git."
43819 }
43820 },
43821 "fr": {
43822 "stringUnit": {
43823 "state": "translated",
43824 "value": "Ce dossier est un dépôt git."
43825 }
43826 },
43827 "ja": {
43828 "stringUnit": {
43829 "state": "translated",
43830 "value": "このフォルダはgitリポジトリです。"
43831 }
43832 },
43833 "pt-BR": {
43834 "stringUnit": {
43835 "state": "translated",
43836 "value": "Esta pasta é um repositório git."
43837 }
43838 }
43839 }
43840 },
43289 "This is the only pane.": { 43841 "This is the only pane.": {
43290 "comment": "Close Pane with one pane", 43842 "comment": "Close Pane with one pane",
43291 "localizations": { 43843 "localizations": {
@@ -44431,6 +44983,40 @@
44431 } 44983 }
44432 } 44984 }
44433 }, 44985 },
44986 "URL key": {
44987 "localizations": {
44988 "de": {
44989 "stringUnit": {
44990 "state": "translated",
44991 "value": "URL-Schlüssel"
44992 }
44993 },
44994 "es": {
44995 "stringUnit": {
44996 "state": "translated",
44997 "value": "Clave URL"
44998 }
44999 },
45000 "fr": {
45001 "stringUnit": {
45002 "state": "translated",
45003 "value": "Clé URL"
45004 }
45005 },
45006 "ja": {
45007 "stringUnit": {
45008 "state": "translated",
45009 "value": "URLキー"
45010 }
45011 },
45012 "pt-BR": {
45013 "stringUnit": {
45014 "state": "translated",
45015 "value": "Chave de URL"
45016 }
45017 }
45018 }
45019 },
44434 "Under a parent with the ORDERED property (Org ▸ Properties and Columns ▸ Toggle ORDERED Property), TODO children are also done in order.": { 45020 "Under a parent with the ORDERED property (Org ▸ Properties and Columns ▸ Toggle ORDERED Property), TODO children are also done in order.": {
44435 "localizations": { 45021 "localizations": {
44436 "de": { 45022 "de": {
@@ -46149,6 +46735,108 @@
46149 } 46735 }
46150 } 46736 }
46151 }, 46737 },
46738 "Working Copy": {
46739 "localizations": {
46740 "de": {
46741 "stringUnit": {
46742 "state": "translated",
46743 "value": "Working Copy"
46744 }
46745 },
46746 "es": {
46747 "stringUnit": {
46748 "state": "translated",
46749 "value": "Working Copy"
46750 }
46751 },
46752 "fr": {
46753 "stringUnit": {
46754 "state": "translated",
46755 "value": "Working Copy"
46756 }
46757 },
46758 "ja": {
46759 "stringUnit": {
46760 "state": "translated",
46761 "value": "Working Copy"
46762 }
46763 },
46764 "pt-BR": {
46765 "stringUnit": {
46766 "state": "translated",
46767 "value": "Working Copy"
46768 }
46769 }
46770 }
46771 },
46772 "Working Copy runs orgstar's sync only with the URL key from Working Copy's settings. orgstar keeps it in the Keychain on this device.": {
46773 "localizations": {
46774 "de": {
46775 "stringUnit": {
46776 "state": "translated",
46777 "value": "Working Copy führt die Synchronisierung von orgstar nur mit dem URL-Schlüssel aus den Einstellungen von Working Copy aus. orgstar bewahrt ihn im Schlüsselbund auf diesem Gerät auf."
46778 }
46779 },
46780 "es": {
46781 "stringUnit": {
46782 "state": "translated",
46783 "value": "Working Copy solo ejecuta la sincronización de orgstar con la clave URL de los ajustes de Working Copy. orgstar la guarda en el llavero de este dispositivo."
46784 }
46785 },
46786 "fr": {
46787 "stringUnit": {
46788 "state": "translated",
46789 "value": "Working Copy n’exécute la synchronisation d’orgstar qu’avec la clé URL des réglages de Working Copy. orgstar la conserve dans le trousseau de cet appareil."
46790 }
46791 },
46792 "ja": {
46793 "stringUnit": {
46794 "state": "translated",
46795 "value": "Working CopyはWorking Copyの設定にあるURLキーがある場合にのみorgstarの同期を実行します。orgstarはこのキーをこのデバイスのキーチェーンに保管します。"
46796 }
46797 },
46798 "pt-BR": {
46799 "stringUnit": {
46800 "state": "translated",
46801 "value": "O Working Copy só executa a sincronização do orgstar com a chave de URL dos ajustes do Working Copy. O orgstar a guarda nas Chaves deste dispositivo."
46802 }
46803 }
46804 }
46805 },
46806 "Working Copy…": {
46807 "localizations": {
46808 "de": {
46809 "stringUnit": {
46810 "state": "translated",
46811 "value": "Working Copy …"
46812 }
46813 },
46814 "es": {
46815 "stringUnit": {
46816 "state": "translated",
46817 "value": "Working Copy…"
46818 }
46819 },
46820 "fr": {
46821 "stringUnit": {
46822 "state": "translated",
46823 "value": "Working Copy…"
46824 }
46825 },
46826 "ja": {
46827 "stringUnit": {
46828 "state": "translated",
46829 "value": "Working Copy…"
46830 }
46831 },
46832 "pt-BR": {
46833 "stringUnit": {
46834 "state": "translated",
46835 "value": "Working Copy…"
46836 }
46837 }
46838 }
46839 },
46152 "Yank": { 46840 "Yank": {
46153 "comment": "Command title", 46841 "comment": "Command title",
46154 "localizations": { 46842 "localizations": {
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form